tencent cloud

Feedback

Using CFS File Systems on Windows Clients

Last updated: 2024-01-22 21:58:08

    Overview

    This document describes how to use CFS file systems on Windows clients. The example below shows how to do so on Windows Server 2012 R2. The operations are the same on other Windows editions such as Windows Server 2008 and Windows Server 2016.

    Step 1. Create a File System and Mount Target

    For detailed directions, see Creating File Systems and Mount Targets.

    Step 2. Connect to an Instance

    1. Log in to a Windows instance using the standard method. For other login methods, see Logging in to Windows instance.
    2. Verify the network communication. Before mounting, you need to check the network connectivity between the client and the file system (the Telnet service needs to be enabled on Windows clients). You can use the telnet command for verification, such as telnet 192.168.1.1 445. The specific protocols and ports as follows:
    File System Protocol
    Open Port for Client
    Check Network Connectivity
    NFS 3.0
    111, 892, and 2049
    telnet 111, 892, or 2049
    NFS 4.0
    2049
    telnet 2049
    CIFS/SMB
    445
    telnet 445

    Step 3. Mount a File System

    Note:
    We recommend you use SMB to mount CFS.

    Mounting a CIFS/SMB file system

    A CIFS/SMB file system can be mounted via a command line or graphical interface.

    Mounting a file system via command line

    Use FSID to mount the file system. The mount command is as follows:
    net use <shared directory name>: \\\\<mount target IP>\\FSID
    Sample:
    net use X: \\\\10.10.11.12\\fjie120
    Note:
    You can go to the CFS console, click the file system ID, and choose the Mount Target Info tab to obtain the FSID mount command.

    Mounting a file system via a graphical interface

    1. Click
    
    to enter the Start menu page.
    2. Right-Click This PC and select Map network drive.
    
    
    3. In the pop-up window, set the drive letter for Drive and folder (i.e., the mount directory you see in the CIFS/SMB file system) and click Finish.
    
    
    4. You will be redirected to the file system that has been mounted. You can right-click to create a file and verify read/write correctness.
    
    

    Mounting an NFS file system

    1. Enable the NFS service

    Note:
    Before mounting, please make sure that the NFS service has been enabled.
    1. Click
    
    and select Control Panel > Programs > Turn Windows Features on or off.
    2. In the Add Roles and Features Wizard window that pops up, keep the default configuration and click Next 5 consecutive times.
    3. On the Features page, select Client for NFS and click Next.
    
    
    4. Click Install.
    5. Restart the CVM instance.

    2. Verify whether the NFS service is enabled

    1. Open the command line tool and run the following command:
    mount -h
    If NFS-related information is returned, the NFS client is running properly.
    
    

    3. Add an anonymous user and user group

    1. Right-Click
    
    and select Run.
    2. In the Run window, enter the regedit command and click OK to open the Registry Editor window.
    
    
    3. Find the HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\ClientForNFS\\CurrentVersion\\Default path in the registry and select it.
    4. Right-Click in the blank space on the right and select New > DWORD (32-bit) Value or QWORD (64-bit) Value (subject to the number of bits of your operating system).
    5. In the new record that appears in the list, set its name to AnonymousUid and use the default data value of 0.
    6. Repeat step 4 to add another record, set its name to AnonymousUid, and use the default data value of 0.
    
    
    7. Close the Registry Editor and then run the commands below on the command line tool in sequence to restart the NFS client service so that the modified Registry can take effect. You can also restart the Windows OS for the modified Registry to take effect.
    net stop nfsclnt
    net stop nfsrdr
    net start nfsrdr
    net start nfsclnt

    4. Mount an NFS file system

    A file system can be mounted via a command line or graphical interface.

    Mounting a file system via command line

    Enter the following command on the command line tool to mount the file system. The default subdirectory is FSID.
    mount <mount target IP>:/<FSID> <shared directory name>:
    Sample:
    mount 10.10.0.12:/z3r6k95r X:
    Note:
    You can go to the CFS console, click the file system ID, and choose the Mount Target Info tab to obtain the FSID mount command.

    Mounting a file system via a graphical interface

    1. Click
    
    to enter the Start menu page.
    2. Right-Click This PC and select Map network drive.
    
    
    3. In the pop-up window, set the drive letter for Drive and folder (i.e., the mount directory you see in the NFS file system) and click Finish.
    
    
    4. Open the command line tool and enter the mount command to check whether the above file system is mounted with root permissions in the following way.
    
    Check whether the UID and GID values are 0. If so, the file system has been mounted with root permissions and can be used. If the UID and GID are -2 or other values, data may not be written properly, and you should repeat the previous steps to ensure that the file system is mounted with root permissions.
    If the Windows command-line tool displays "Locking=yes", to avoid read/write exception (NFS v3 does not support locking), you can modify the Registry by performing the following steps:
    1. Find the following registry path: HKEY_LOCAL_MACHINE > SOFTWARE > Microsoft > ClientForNFS > CurrentVersion > User > Default > Mount.
    2. Move the mouse to the right pane and right-click there. Click New and choose DWORD (32-bit) Value from the drop-down menu. Then, change the name to Locking and set the value to 0.
    3. You will be redirected to the file system that has been mounted. You can right-click to create a file and verify read/write correctness.

    Step 4. Unmount the File System

    Unmounting a shared directory via command

    If you need to unmount a shared directory, please open the Windows Command Prompt and run the following command, where "directory name" is the root directory or the full path of the file system.
    Sample for NFS:
    umount X:
    Sample for SMB:
    net use x: /del

    Unmounting a shared directory via a graphical interface

    To disconnect a mounted file system, simply right-click the disk and click Disconnect in the menu that appears.
    
    

    Step 5. Terminate a Resource

    Note:
    Resources cannot be recovered from a deleted file system. Therefore, you are advised to back up all resources before deleting the file system.
    You can terminate a file system in the console. Specifically, go to the CFS console, locate the file system to be terminated, and click Delete > Confirm.
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support