NFS permet à un système de partager des répertoires et des fichiers à travers un réseau. En utilisant NFS, utilisateurs et programmes peuvent accéder aux fichiers de systèmes distants comme s'ils étaient des fichiers locaux.
Quelques uns des plus remarquables avantages que NFS peut apporter sont :
Local workstations use less disk space because commonly used data can be stored on a single machine and still remain accessible to others over the network.
There is no need for users to have separate home directories on every network machine. Home directories could be set up on the NFS server and made available throughout the network.
Storage devices such as floppy disks, CDROM drives, and USB Thumb drives can be used by other machines on the network. This may reduce the number of removable media drives throughout the network.
Dans un terminal, entrez la commande suivante pour installer le serveur NFS :
sudo apt-get install nfs-kernel-server
Vous pouvez choisir les répertoires à exporter en les ajoutant au fichier /etc/exports
. Par exemple :
/ubuntu *(ro,sync,no_root_squash) /home *(rw,sync,no_root_squash)
You can replace * with one of the hostname formats. Make the hostname declaration as specific as possible so unwanted systems cannot access the NFS mount.
Pour démarrer le serveur NFS, vous pouvez taper la commande suivante dans un terminal :
sudo /etc/init.d/nfs-kernel-server start
Utilisez la commande mount pour monter un répertoire NFS partagé à partir d'une autre machine, en tapant dans un terminal une commande telle que :
sudo mount exemple.nomhote.com:/ubuntu /local/ubuntu
Le répertoire /local/ubuntu
du point de montage doit exister. Il ne devrait y avoir ni fichiers ni sous-répertoires dans le répertoire /local/ubuntu
An alternate way to mount an NFS share from another machine is to
add a line to the /etc/fstab
file. The line must state the
hostname of the NFS server, the directory on the server being
exported, and the directory on the local machine where the NFS
share is to be mounted.
La syntaxe générale des lignes dans le fichier /etc/fstab
est celle-ci :
exemple.nomhote.com:/ubuntu /local/ubuntu nfs rsize=8192,wsize=8192,timeo=14,intr↵