Mounting SSD with Raspberry Pi and using NFS Kernel Server
Overview
This guide provides steps to share an SSD connected to a Raspberry Pi (referred to as the NFS server) with other devices on the network via the NFS protocol.
Set up automatic mounting
You can modify the fstab file to define where storage devices will be automatically mounted when the Raspberry Pi boots. For this we will need the UUID of the disk partition:
Now open the fstab file:
and add the following lines, replacing with your UUID and mount location:
Now test with
Integrating NFS Kernel Server
-
Install NFS Kernel Server:
Update the package list and install the NFS Kernel Server package on the Raspberry Pi:
-
Create an Export Directory:
Create a directory on your SSD where you’d like to store the files you want to share:
-
Set Appropriate Permissions:
Set the ownership and permissions of the export directory to allow access from network clients:
Note: You might want to adjust permissions and ownership to match your specific security requirements.
-
Configure NFS Exports (Optional):
Edit the
/etc/exports
file to add the export directory:Add the following line, replacing
192.168.1.0/24
with the subnet that matches your network: -
Export the NFS Shares:
After editing the
/etc/exports
file, export the shared directory: -
Start the NFS Service:
Enable and start the NFS Kernel Server:
-
Verify NFS Server Status:
Check that the NFS server is running properly:
-
Configure Firewall (Optional):
If you have a firewall enabled, make sure to allow traffic on the necessary NFS ports (
2049
for NFS): -
Mount on the Client:
On a client machine, mount the shared directory to access the SSD:
Replace
192.168.1.x
with the actual IP address of your NFS server, and/path/to/local/mountpoint
with your chosen local mount point.