NFS

From Q
Jump to navigation Jump to search

Client

# mkdir -p /mnt/{movies,music,tvshows}

You may change the ro option to rw to enable write access.

File: /etc/fstab
# NFS4
192.168.0.50:/movies				/mnt/movies	nfs4	_netdev,auto,ro,users		0 0
192.168.0.50:/music				/mnt/music	nfs4	_netdev,auto,ro,users		0 0
192.168.0.50:/tvshows				/mnt/tvshows	nfs4	_netdev,auto,ro,users		0 0

Install the nfs-utils package and enable the service.

# systemctl enable rpcbind.socket
# systemctl enable nfs-client.target

Server

Create the directories you want to share on your storage filesystem:

# mkdir -p /mnt/raid/{movies,music,tvshows}

Set write permissions to the shared directories:

# chmod 0777 /mnt/raid/{movies,music,tvshows}

Create the NFS export root directory:

# mkdir -p /nfs4/{movies,music,tvshows}

Setup NFS4 pseudo file system bind mounts:

File: /etc/fstab
# NFS4 pseudo file system bind mounts
/mnt/raid/movies				/nfs4/movies	none	bind				0 0
/mnt/raid/music					/nfs4/music	none	bind				0 0
/mnt/raid/tvshows				/nfs4/tvshows	none	bind				0 0
File: /etc/exports
/nfs4			192.168.0.0/24(rw,fsid=0,no_subtree_check)
/nfs4/movies		192.168.0.0/24(rw,nohide,insecure,no_subtree_check)
/nfs4/music		192.168.0.0/24(rw,nohide,insecure,no_subtree_check)
/nfs4/tvshows		192.168.0.0/24(rw,nohide,insecure,no_subtree_check)
# systemctl enable rpcbind.socket
# systemctl enable nfs-server.service