NAS and Storage
NFS: sharing storage with your servers
Samba is useful for Windows and macOS. If your Linux servers, Proxmox or Docker need access to the same storage, NFS is often the best choice: it’s fast, simple and designed for Linux.
On the NAS: sharing the folder
- Install the NFS server:
sudo apt update sudo apt install nfs-kernel-server - Create the folder you want to share:
sudo mkdir -p /srv/nas/media - Open
/etc/exportswithsudo nano /etc/exportsand add a line. Here, every device in192.168.1.0/24can read and write the folder:/srv/nas/media 192.168.1.0/24(rw,sync,no_subtree_check) - Apply the list:
sudo exportfs -ra
Not sure which range belongs to your network? Calculate it with our subnet calculator.
On the server that uses the storage
sudo apt install nfs-common
sudo mkdir -p /mnt/media
sudo mount 192.168.1.20:/srv/nas/media /mnt/media
Replace 192.168.1.20 with the address of your NAS. Want the folder to mount automatically at every startup? Add a line to /etc/fstab:
192.168.1.20:/srv/nas/media /mnt/media nfs defaults,_netdev 0 0
Using in Proxmox and Docker
- Proxmox: go to Datacenter → Storage → Add → NFS, enter the address of the NAS and the folder. Use it for example for backups or installation files.
- Docker: first mount the NFS folder on the server, as shown above, and pass it as a folder to your container:
/mnt/media:/media.
Security
NFS in the basic setup only checks the IP address, not who you are. Anyone on an allowed address has access. Therefore, only open NFS to your own, trusted network and never to the internet. If you want to separate users, choose Samba.
Can't do it yourself?
Have an expert come to your home via hulpaanhuis.nl