Using NFS (Network File System), you can mount a disk partition of a remote machine as if it is a local disk. This article explains how to export a file system to a remote machine and mount it both temporarily and permanently.
1. Export File System to Remote Server using exportfs
To export a directory to a remote machine, do the following.
exportfs REMOTEIP:PATH
- REMOTEIP – IP of the remote server to which you want to export.
- : – delimiter
- PATH – Path of directory that you want to export.
2. Mount Remote Server File System as a Local Storage
To mount the remote file system on the local server, do the following.
mount REMOTEIP:PATH PATH
Explanation
- REMOTEIP – IP of the remote server which exported the file system
- : – delimeter
- PATH – Path of directory which you want to export.
3. Unmount Remote File System
Umount the remote file system mounted on the local server using the normal umount PATH. For more option refer to umount command examples.
4. Unexport the File System
You can check the exported file system as shown below.
# exportfs /publicdata webserver.pq.net
To unexport the file system, use the -u option as shown below.
# exportfs -u REMOTEIP:PATH
After unexporting, check to make sure it is not available for NFS mount as shown below.
# exportfs
5. Make NFS Export Permanent Across System Reboot
Export can be made permanent by adding that entry into /etc/exports file.
# cat /etc/exports /publicdata webserver.pq.net
6. Make the Mount Permanent Across Reboot
mount can be made permanent by adding that entry into /etc/fstab file.
# cat /etc/fstab webserver.pq.net:/publicdata /mydata ext3 defaults 0 0
Comments on this entry are closed.
“webserver.pq.net:/publicdata /mydata ext3 defaults 0 0”
Regarding ext3 in the fstab line: are you supposed to know the remote filesystem? Or is it an indication of the local filesystem you want to use? Shouldn’t it be nfs instead of ext3 or whatever else?
As far as I know
webserver.pq.net:/publicdata /mydata ext3 defaults 0 0
is not correct
It should be
webserver.pq.net:/publicdata /mydata nfs defaults 0 0
Or even better
webserver.pq.net:/publicdata /mydata nfs intr,soft defaults 0 0
Omitting intr,soft means the system will hang if webserver.pg.net is not avalable
Hi,
What about “_netdev” value impact on timeout / no response??
webserver.pq.net:/publicdata /mydata ext3 defaults _netdev 0
sir I won 2 know ….. how to work with exportfs -o option…