This topic describes how to mount an SMB file system on an Elastic Compute Service (ECS) instance running Linux and perform read/write operations on the file system.

Prerequisites

Before mounting an NFS file system, you must complete the following prerequisites.

  1. Apsara File Storage NAS is activated.

    When you log on to the Apsara File Storage NAS console for the first time, follow the provided instructions to activate the Apsara File Storage NAS service.

  2. A Virtual Private Cloud (VPC) is available in the region where you want to create a file system.

    If no VPC is available, we recommend that you create a VPC. For more information, see Create a VPC and VSwitch.

  3. An ECS instance is available in the region where you want to create a file system. You must also check whether the ECS instance is attached to the VPC.

    If no ECS instance is available, we recommend that you purchase an ECS instance. For more information, see Create an ECS instance.

  4. A file system is created.

    If no file system is available, we recommend that you create a file system. For more information, see Create file systems.

  5. A mount target of the VPC type is created for the file system.

    If no mount target is available, we recommend that you create a mount target. For more information, see Add a mount target.

Background information

If you want to use a distributed file system and allow access to shared storage from multiple ECS instances, we recommend that you use Apsara File Storage NAS.

The topic describes how to mount an NFS file system on a Windows ECS instance that resides in a VPC.

Mount a file system

  1. Install an NFS client.
    1. Start Server Manager.
    2. Choose Manage > Add Roles and Features.
    3. Follow the provided instructions in the Add Roles and Features Wizard to install an NFS client.
      • In the Server Roles step, choose File and Storage Services > File and iSCSI Services and select Server for NFS.
      • In the Features step, select Client for NFS.
    4. Restart the ECS instance.
    5. Start the command prompt and run the mount command.

      An NFS client is installed if a result that is similar to the following example is displayed.

      Verify the mount result.
  2. Use the following command to mount the Apsara File Storage NAS file system.
    mount -o nolock -o mtype=hard -o timeout=60 \\035XXXXXXX3.cn-hangzhou.nas.aliyuncs.com\! h:                   

    035XXXXXXX3.cn-hangzhou.nas.aliyuncs.com\ specifies the domain name of the new mount target.

  3. Use the mount command to verify the mount result.

    After the mount is complete, the result shows that the value of mount is hard, the value of locking is no, and the value of timeout is greater than or equal to 10. Otherwise, the mount has failed.

    Check the UID and GID
  4. In the Computer window, you can view the new shared file system.

    You can check whether you can manage the new shared file system by creating files and folders in the file system.

    Mount results

Possible issues

If a message showing "file handle error" is displayed during operations, you need to check the following registry keys.

Note If you cannot find the Locking, AnonymousGID, and AnonymousUID registry keys, you need to follow the format required by the Windows registry to create these keys.
Choose HKEY_LOCAL_MACHINE > SOFTWARE > Microsoft > ClientForNFS > CurrentVersion > Users > Default > Mount, create a key named Locking, and set the value of this key to 1. Create a registry key named Locking

Create the following registry keys to configure the GID and UID.

  1. Navigate to the Default path as follows: HKEY_LOCAL_MACHINE > SOFTWARE > Microsoft > ClientForNFS > CurrentVersion > Default.
  2. Right-click a blank area on the right side of the Registry Editor window, choose New > DWORD (32-bit) Value, and create the following registry keys.
    • AnonymousGID. Set the value of the key to 0.
    • AnonymousUID. Set the value of the key to 0. Default path
  3. Restart the instance.
  4. Run the following command to mount a NAS file system.
    mount -o nolock -o mtype=hard -o timeout=60 \\035XXXXXXX3.cn-hangzhou.nas.aliyuncs.com\! h:                   

    035XXXXXXX3.cn-hangzhou.nas.aliyuncs.com\ specifies the domain name of the new mount target.

  5. Run the mount command to check the UID and GID.

    After the mount is complete, the result shows that the value of mount is hard, the value of locking is no, and the value of timeout is greater than or equal to 10. Otherwise, the mount has failed.

    Check the UID and GID