Ubuntu Server NFS Mount a Remote Disk
Synonyms:
$[texteditor]$
Prerequisite
$[username]$
- SSH connect using the same username without password as SSH Connect from Ubuntu said.
Mount NFS folder $remote_path$ of server $remote_ip$
$[local_ip]$
$[local_path]$
$[remote_ip]$
$[remote_path]$
config remote server
Login to $username$ account of server $remote_ip$
sudo apt -y install nfs-kernel-server
sudo $texteditor$ /etc/exports
$remote_path$ $local_ip$(rw,sync,no_root_squash,no_subtree_check)
sudo /etc/init.d/nfs-kernel-server restart
Enable Incoming Traffic of TCP Port 2049.
config local server
Login to $username$ account of server $local_ip$.
sudo apt -y install nfs-common
sudo $texteditor$ /etc/fstab
add this line
$remote_ip$:$remote_path$ $local_path$ nfs auto,nofail,noatime,nolock,intr,tcp,actimeo=1800 0 0
or using this one line command
echo '$remote_ip$:$remote_path$ $local_path$ nfs auto,nofail,noatime,nolock,intr,tcp,actimeo=1800 0 0' | sudo tee -a /etc/fstab
mount now and check
sudo mkdir -p $local_path$
sudo mount -a
df -h -x devtmpfs -x tmpfs