
How to Mount and Share an NFS Drive Between Two Linux PCs on the Same Network
This guide explains how to mount a hard disk (HDD) on a remote Linux PC, share it via NFS, and mount it on a local Linux PC on the same LAN.
1. Mount the HDD on the Remote PC Using UUID
First, ensure the disk is auto-mounted at boot using its UUID.
Steps:
-
Find the UUID of the disk:
sudo blkid /dev/sdb1
Example output:
/dev/sdb1: UUID="72957477-b9b8-4771-a450-993396e40f9f" TYPE="ext4"
-
Create a mount point:
sudo mkdir -p /mnt/500GB
-
Edit
/etc/fstab
:sudo nano /etc/fstab
Add this line:
UUID=72957477-b9b8-4771-a450-993396e40f9f /mnt/500GB ext4 defaults 0 2
-
Mount it:
sudo mount -a
✅ Your HDD is now permanently mounted to /mnt/500GB
.
2. Export the Folder Over NFS on the Remote PC
-
Install NFS server if not already:
sudo apt update sudo apt install nfs-kernel-server
-
Edit exports file:
sudo nano /etc/exports
Add:
/mnt/500GB 192.168.0.204(rw,sync,no_subtree_check,no_root_squash)
(Use your local PC’s IP address)
-
Apply changes:
sudo exportfs -ra sudo systemctl restart nfs-kernel-server
-
Verify export:
showmount -e
3. Mount the Remote Share on the Local PC
-
Create a mount point:
mkdir -p /home/manik/500GB
-
Mount it manually to test:
sudo mount 192.168.0.207:/mnt/500GB /home/manik/500GB
(Replace with your remote server’s IP)
-
Confirm it works:
ls /home/manik/500GB
4. Auto-Mount the Share at Boot on the Local PC
-
Edit fstab:
sudo nano /etc/fstab
Add:
192.168.0.207:/mnt/500GB /home/manik/500GB nfs defaults,_netdev,user,nofail 0 0
-
Test it:
sudo umount /home/manik/500GB sudo mount /home/manik/500GB
5. Troubleshooting Tips
-
“Permission denied” → Check
/etc/exports
IPs and permissions. -
“Stale file handle” → Remount or reboot both systems.
-
“Device is busy” → Use
sudo lsof /mnt/500GB
orsudo fuser -vm /mnt/500GB
. -
Restart NFS services if needed:
sudo systemctl restart nfs-kernel-server # on server sudo systemctl restart nfs-common # on client
This setup enables smooth and automatic access to shared storage over a local network.
0% Positive Review (0 Comments)