Mounting a File System on Linux, Red Hat, or CentOS
-
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
sudo 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:
-
3,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).