Log into the instance where you want to mount the file system.
See Connecting to an Instance.
Example:
ssh user@192.0.2.0
Install the NFS client using this command:
sudo yum install nfs-utils
Create a directory that will be used as the mount point.
Replace <yourmountpoint> with a directory name of your choice. Example:
/mnt/mountpoint-A
See AlsoHow To Mount Multiple Filesystems On The Same ServerCheck if Directory is Mounted in Bash on LinuxHow to Check the Mount Points in Linux? - Scaler TopicsMaster the Linux ‘mount’ Command: A Comprehensive Guidesudo mkdir -p <yourmountpoint>
Mount the file system.
Caution
Omitting the
-o nosuid
option can allow unprivileged users to escalate their permissions to 'root'. Thenosuid
option disables set-user-identifier or set-group-identifier bits within the mounted system, which are rarely used.Example:
sudo mount -t nfs -o nfsvers=<version>,nosuid <10.x.x.x>:<fs-export-path> <yourmountpoint>
Replace <version> with one of the following, based on the NFS protocol version you want to use:
See AlsoMount-points3,noacl
4.0
4.1
Replace <10.x.x.x> with the mount target's private IP address. See Obtaining the Mount Target IP Address .
Replace <fs-export-path> with the export path that was generated when the export was created. See Creating an Export for a File System.
Replace <yourmountpoint>with the full path to the local mount point.
View the mounted file system.
df -h
Write a file to the file system.
Replace <yourmountpoint> with the path to the local mount point and <filename>with your file name.
sudo touch /mnt/<yourmountpoint>/<filename>
Verify that you can access the file system and view the file.
Replace yourmountpoint with the path to the local mount point.
cd <yourmountpoint>ls
Add the file system mount information to the appropriate mount file for your OS.
So far, the file system is manually mounted to the client. If the client is rebooted, the file system won't automatically mount unless you add it to the mount file (for example the
/etc/fstab
or/etc/vfstab
file).
Mounting a File System on Linux, Red Hat, or CentOS (2024)
Author: Rev. Porsche Oberbrunner
Last Updated:
Views: 6137
Rating: 4.2 / 5 (53 voted)
Reviews: 92% of readers found this page helpful
Name: Rev. Porsche Oberbrunner
Birthday: 1994-06-25
Address: Suite 153 582 Lubowitz Walks, Port Alfredoborough, IN 72879-2838
Phone: +128413562823324
Job: IT Strategist
Hobby: Video gaming, Basketball, Web surfing, Book restoration, Jogging, Shooting, Fishing
Introduction: My name is Rev. Porsche Oberbrunner, I am a zany, graceful, talented, witty, determined, shiny, enchanting person who loves writing and wants to share my knowledge and understanding with you.