GNU/Linux >> Linux Esercitazione >  >> Cent OS

Come montare i file system NFS usando "autofs" in CentOS/RHEL

Questo post spiega come configurare "autofs" per montare file system NFS con il servizio "autofs".

1. Arresta il servizio "autofs", controlla se il servizio è in esecuzione, quindi procedi per interromperlo.

# service autofs status
automount (pid 25285) is running...
# service autofs stop
Stopping automount: [ OK ]
# service autofs status
automount is stopped

2. Modifica il /etc/auto.master file per impostare la mappa del file:

Il file /etc/auto.master è il file di configurazione principale per il servizio 'autofs', questo file contiene gli elenchi delle mappe principali dei punti di montaggio sul sistema controllato da 'autofs' e i file di configurazione corrispondenti o le fonti di rete note come 'mappe a montaggio automatico '.

Ecco come dovrebbe apparire il file:

# Sample auto.master file
# This is an automounter map and it has the following format
# key [ -mount-options-separated-by-comma ] location
# For details of the format look at autofs(5).
#
/misc /etc/auto.misc     ---------------------> MAP FILE
#
# NOTE: mounts done from a hosts map will be mounted with the
# "nosuid" and "nodev" options unless the "suid" and "dev"
# options are explicitly given.
#
/net -hosts
#
# Include central master map if it can be found using
# nsswitch sources.
#
# Note that if there are entries for /net or /misc (as
# above) in the included master map any keys that are the
# same will not be seen as the first read key seen takes
# precedence.
#
+auto.master

Il "file mappa" può essere modificato in qualsiasi altro file in /etc con il nome "auto.mount" per montare l'esportazione in qualsiasi altra directory desiderata. Per ulteriori informazioni, vai al passaggio numero due.

Modifica "auto.master ‘ e aggiungi il simbolo hash davanti alla riga “/misc /etc/auto.misc”, quindi procedi ad aggiungere la seguente riga alla fine del file:

/- /etc/auto.mount

Il file dovrebbe apparire come il seguente esempio dopo la modifica:

#
# /misc /etc/auto.misc
#
/- /etc/auto.mount

3. Crea e/o modifica il file della mappa:

Il file di mappa è un file separato che definisce i file system da montare in qualsiasi punto di montaggio specificato. Ad esempio, il file /etc/auto.misc potrebbe definire i punti di montaggio nella directory /misc; un altro esempio consiste nell'usare /mnt come un'altra directory per montare l'esportazione. Se è necessaria un'altra directory, è necessario creare un nuovo file nella directory /etc/ con il nome "auto.mount" come raccomandazione.

Quello che segue è un esempio del file '/etc/auto.misc' e del nuovo file 'auto.mount'

# This is an automounter map and it has the following format
# key(mount-point) [ -mount-options-separated-by-comma ] location   ===> THIS IS THE GENERAL FORMAT OF THE MAPS
# Details may be found in the autofs(5) manpage

cd -fstype=iso9660,ro,nosuid,nodev :/dev/cdrom  ===> EXAMPLE

# the following entries are samples to pique your imagination
#linux -ro,soft,intr ftp.example.org:/pub/linux
#boot -fstype=ext2 :/dev/hda1
#floppy -fstype=auto :/dev/fd0
#floppy -fstype=ext2 :/dev/fd0
#e2floppy -fstype=ext2 :/dev/fd0
#jaz -fstype=ext2 :/dev/sdc1
#removable -fstype=ext2 :/dev/hdd

mount_point_name      -rw,soft,intr,rsize=8192,wsize=8192       NFS.example.net:/export_name  ===> IP address can be used instead of the FQDN

Se non vuoi usare la directory /misc né il file 'auto.misc', crea un nuovo file con il nome 'auto.mount' e aggiungi gli stessi parametri con la sintassi corrispondente, come nell'esempio seguente:

# vi /etc/auto.mount

Aggiungi la seguente riga:

/mount_point -fstype=nfs,rw NFS.example.net:/export_name
NOTA :Assicurati di aver modificato il file '/etc/auto.master' e cambia il file della mappa con quello desiderato.

4. Avvia il servizio 'autofs':

# service autofs start
Starting automount: [ OK ]

5. Esegui il comando 'mount' per verificare che la tua condivisione NFS sia ora montata:

# mount
NFS_IP_Address:/export on /mount_point  type nfs (rw,vers=4,addr=NFS_IP_Address,clientaddr=local_IP_Address)


Cent OS
  1. Come configurare il demone autofs su CentOS 7/Rhel 7

  2. Come configurare il server NFS su CentOS 7 / RHEL 7

  3. Come monitorare il montaggio/smontaggio dei punti di montaggio utilizzando Auditd su CentOS/RHEL 6,7

  4. CentOS/RHEL:come trovare il pacchetto con un file mancante utilizzando YUM

  5. Come disabilitare la memorizzazione nella cache del client NFS in CentOS/RHEL

Come abilitare Kdump su RHEL 7 e CentOS 7

Come configurare il server NFS su CentOS 8 / RHEL 8

Come installare e utilizzare Fail2ban su RHEL 8 / CentOS 8

Come utilizzare tmpfs su RHEL/CentOS 7

Come installare flameshot su RHEL/CentOS usando Snapcraft

Come risolvere i problemi di latenza del trasferimento NFS utilizzando "nfsiostat" in CentOS / RHEL