All Products
Search
Document Center

Alibaba Cloud Linux:How do I handle errors that occur when I mount NFS file systems?

Last Updated:Mar 28, 2025

This topic describes the common errors that occur when you mount Network File System (NFS) file systems on an Elastic Compute Service (ECS) instance that runs Alibaba Cloud Linux 2 or Alibaba Cloud Linux 3 and how to handle the errors.

The mount.nfs: command not found error message appears

Problem description

  • You replace the <server_ip> parameter in the following mount.nfs command with the public IP address of an ECS instance and then run the command to mount an NFS file system on the instance:

    sudo mount.nfs <server_ip>:/directory /mnt

    The following error message appears:

    -bash: mount.nfs: command not found
  • You replace the <server_ip> parameter in the following mount -t nfs command with the public IP address of an ECS instance and then run the command to mount an NFS file system on the instance:

    sudo mount -t nfs <server_ip>:/directory /mnt

    The following error message appears:

    mount: /mnt: bad option; for several filesystems (e.g. nfs, cifs) you might need a /sbin/mount.<type> helper program.

Cause

The nfs-utils package is missing or the required rpcbind components are not installed.

Solution

  1. Run the following command to install the nfs-utils package and the rpcbind components:

    sudo yum install -y nfs-utils rpcbind
  2. Run the following command to check whether the nfs-utils package and the rpcbind components are installed:

    sudo yum list installed | grep nfs-utils

    The following command output indicates that the nfs-utils package and the rpcbind components are installed.

    image

The mount: /nfs/testdir: mount point does not exist error message appears

Problem description

You replace the <server_ip> parameter in the following command with the public IP address of an ECS instance and then run the command to mount an NFS file system to a mount point on the instance:

sudo mount -t nfs -o vers=3 <server_ip>:/export/fs/dir /nfs/testdir

The following error message appears:

mount: /nfs/testdir: mount point does not exist.

Cause

The specified mount point does not exist on the ECS instance.

Solution

Create a mount point on the ECS instance. In this example, the /nfs/testdir mount point is created.

sudo mkdir -p /nfs/testdir

The "Operation not permitted" error message appears indicating insufficient permissions

Note

This issue may occur only in NFSv4 or later file systems and does not occur in NFSv3 file systems.

Problem description

After you mount an NFS file system to a root-owned directory on an ECS instance, you cannot create files in the directory and receive the "Operation not permitted" error message even if you log on to the instance as root. In this example, the /nfs/testdir directory is used.

  1. Run the following command to display the list of files and subdirectories in the /nfs/testdir directory on the ECS instance:

    cd /nfs/testdir & ls -lh

    The following command output is returned:

    total 20K
    drwxr-xr-x 2 root root 4.0K Sep 5 13:08 subdir
    drwx------ 2 root root 16K Sep 5 13:07 lost+found
  2. Run the following command to go to a subdirectory in the /nfs/testdir directory and create a file named testfile. In this example, the subdirectory named subdir is used.

    cd subdir & touch testfile

    The following error message appears:

    touch: cannot touch 'testfile': Permission denied

Cause

The no_root_squash option is disabled for the NFS file system on the NFS server. Note that the owner and group of the subdir subdirectory are root, which refers to root users on the NFS server. If the no_root_squash option is disabled, root users on the NFS client are mapped to an anonymous user on the NFS server. As a result, the root users can manage only the files to which regular users have access in the NFS file system on the NFS server and cannot perform operations that require superuser privileges. If the no_root_squash option is enabled, root users on the NFS client are granted full permissions on the NFS file system on the NFS server.

Solution

  1. Run the following command to open the /etc/exports file:

    sudo vim /etc/exports
  2. Press the I key to enter Insert mode and append the following content to the file:

    /export/fs/vdc *(rw,no_subtree_check,no_root_squash)
  3. Press the Esc key, enter :wq, and then press the Enter key to save and close the file.

  4. Run the following command to update the export list of the NFS file system on the NFS server:

    sudo exportfs -r