NFS
Category:Guider Network File System (NFS) är ett filsystem som tillåter datorer att komma åt filer över ett nätverk på ungefär samma sätt som de kan komma åt filer på lokal lagring. Detta är användbart för att dela filer mellan flera servrar. Här följer generella inställningar för server och klient, de fungerar i de flesta fall.
Installation
Server
sudo apt-get update && sudo apt-get -y install nfs-kernel-server
Klient
sudo apt-get update && sudo apt-get -y install nfs-common
Konfiguration
Server
sudo mkdir /nfsroot
sudo sh -c 'echo "/nfsroot 192.168.1.16/30(rw,root_squash,subtree_check)" >> /etc/exports'
sudo exportfs -a
sudo service nfs-kernel-server start
Klient
sudo mkdir /nfsroot
sudo sh -c 'echo "192.168.1.50:/nfsroot /nfsroot nfs rw,async,hard,intr 0 0" >> /etc/fstab'
sudo mount /nfsroot
Options
Ibland kan man behöva ändra egenskaperna för NFS-share:n. T.ex. om man har problem med att program sätter lock på filer. Här tas de vanligaste alternativen upp som är bra att känna till. Det mesta görs på klientsidan.
Klient
rw: Read/write filesystem.
ro: Read-only filesystem. Remote NFS clients can’t modify the
filesystem.
hard: Applications using files stored on an NFS will always wait if
the server goes down. User cannot terminate the process unless the
option intr is set.
soft: Applications using files stored on an NFS will wait a
specified time (using the timeo option) if the server goes down, and
after that, will throw an error.
intr: Allows user interruption of processes waiting on a NFS
request.
timeo=