Mounting a File System on Linux, Red Hat, or CentOS (2024)

  1. Log into the instance where you want to mount the file system.

    See Connecting to an Instance.

    Example:

    ssh user@192.0.2.0
  2. Install the NFS client using this command:

    sudo yum install nfs-utils
  3. 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>
  4. Mount the file system.

    Caution

    Omitting the -o nosuid option can allow unprivileged users to escalate their permissions to 'root'. The nosuid 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 Also
      Mount-points

      • 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.

  5. View the mounted file system.

    df -h
  6. 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>
  7. 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
  8. 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)
Top Articles
Latest Posts
Article information

Author: Rev. Porsche Oberbrunner

Last Updated:

Views: 6137

Rating: 4.2 / 5 (53 voted)

Reviews: 92% of readers found this page helpful

Author information

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.