# Mount File System (Windows)

## NFS

### Step 1. Install the NFS client  
1. Log in to the Windows cloud host.
2. Click the `Start` button in the lower left corner to open the `Server Manager`.  
    <!-- image-todo -->

3. Select `Add roles and features`.  
    <!-- image-todo -->

4. Follow the prompts to install the NFS client.
    a. For `Before start`, `Installation type`, `Server selection`, keep the default selection and click next.  
    b. In the `Server Roles` tab, check `Files and Storage Services->Files and iSCSI Services-> NFS Server` and click next.  
    c. In the `Features` tab, check `NFS Client` and click next.  
    d. Click Install.  

5. Restart the cloud host.

6. Open the `Command Prompt` window, enter the command `mount`. If the following information is outputted, it means the NFS client is installed.  
    <!-- image-todo -->

<br/>

### Step 2. Mount the UFS file system  
1. Open the `Command Prompt` window and enter the following command to mount the UFS file system.

        mount -o nolock -o mtype=hard -o timeout=10 \\mountpoint_ip\! Z:

    Please replace the `mountpoint_ip` in the command according to the actual situation of the UFS file system mount point information on the console, and the local drive letter `Z` can also be replaced according to the actual demand.

2. After the mount is successful, execute the `mount` command again to check the mount result.  
    <!-- image-todo -->

    Check if the mount type in the properties is `hard`, `timeout` time is `10.0` or above, and `locking` is `no`. If not, it means the mount is abnormal. Please use `umount Z:` (modify the disk letter according to the actual situation) to unmount the file system, and refer to the above steps to re-mount.

3. Double-click `This PC` icon to view the shared file system. Create and delete files/folders in the shared file system to confirm its normal use.
    <!-- image-todo -->

<br/>

### Step 3. Set Up Automatic Mounting of the UFS File System

1. Create a mount script `auto_mount.bat` in the `C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp` directory of the cloud host, with the following script content.

        mount -o nolock -o mtype=hard -o timeout=10 \\mountpoint_ip\! Z:

    Please replace `mountpoint_ip` in the command with the actual UFS file system mount point information on the console, and the local drive letter `Z` can also be replaced as needed.

2. Create a mount task.  
    a. Click the `Start` button in the lower left corner to open the `Control Panel`.  
    <!-- image-todo -->

    b. Click `System and Security` and select `Scheduled Tasks`.  
    <!-- image-todo -->

    c. Click `Create Task` in the operation tab.  
    Set the `Name` in `General` tab, check `Run whether user is logged on or not` (if you are using Windows Server 2016, check `Run only when user is logged in`), and check `Run with the highest privileges`. 
    <!-- image-todo --> 

    Click `New` in the `Triggers` tab, set `Begin the task` to `At log on`, and check `Enabled` in `Advanced settings`.  
    <!-- image-todo -->

    Click `New` in the `Actions` tab, set `Action` to `Start a program`, select the script `auto_mount.bat` created in step 1 in `Program or script`, and click okay.  
    <!-- image-todo -->

    Check `Start the task only if the following network connection is available` in the `Conditions` tab, and select `Any connection` in the drop-down options.  
    <!-- image-todo -->

    In the `Settings` tab, uncheck `Allow task to be run on demand` and `If the task runs for a period longer than this, stop the task`. Check `If the task is still running when requested to stop, force it to stop`. Select `Do not start a new instance` in the drop-down of `If the task is already running, the following rule applies`. Click ok.
    <!-- image-todo -->

3. Restart the cloud host and verify the result.
     a. Check the scheduled task status. If the following information is displayed, it means the task is executing normally.  
     <!-- image-todo -->

     b. Execute the `mount` command in the `Command Prompt` window and check the mount information. Confirm whether the `mount` type is `hard`, `locking` is `no`, and `timeout` is `10` or above. If the mount is normal, the parameters should look as follows.  
     <!-- image-todo -->


## SMB

### Step 1. Environment preparation

1. Log in to the Windows cloud host.
2. For systems running Windows Server 2016 or later, you need to configure to allow anonymous client access. Execute the following command:

        REG ADD HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\LanmanWorkstation\Parameters /f /v AllowInsecureGuestAuth /t REG_DWORD /d 1

### Step 2. Mount the SMB file system
#### Command line mount

1. Log in to the Windows host, open a CMD window, and execute the following command to mount the SMB file system:

        net use Z: \\18.0.0.1\share

##### The meanings of each parameter in the mount command are as follows:
|Parameter/Option Name          |Description     |
|---------|-----------------------------------------------------------------|
|Z	|The target drive letter to be mounted on the current Windows system. If there is a conflict or multiple NAS file systems are mounted, the drive letter will be decremented in alphabetical order.|

2. After successful mounting, execute the net use command to view the mount information.
