百度智能云

All Product Document

          Cloud File Storage

          Mount SMB File System

          Windows System

          Step 1: Get Mount Address

          After the mount target is created, you can use the file system. You can query the mount address of the mount target on the page of each file system, as shown in the following figure:

          After logging in to the virtual machine or container, use the mount address to operate the file system.

          Step 2: Mount the SMB File System

          In windows system, open Powdershell or cmd command line, and use the following command to mount the SMB file system:

          net use < Target drive >: \\< Mount address >\cfs 

          Among them, is the new drive designated by the user for the CFS file system (not repeated with the existing drive), can be found in the mount point list of the file system, and "cfs" is the name of the fixed SMB share, which cannot be modified.

          Example:

          net use z: \\cfs-WeQ8vqSEOD.lb-b768ef66.cfs.bj.baidubce.com\cfs 

          Compared with manual mounting, there is an extra parameter _netdev here. This parameter requires the operating system to attempt to mount the file system after the network is ready. If this parameter is not specified, the risk of mount failure will rise.

          Step 3: Unmount the SMB File System

          Use the following command to unmount the file system:

          net use < Target drive >: /del 

          Among them, is the drive of the CFS file system to uninstall.

          Step 4: View the Mounted SMB File System

          After the mounting is complete, you can use the following commands in the Windows cmd command line or Powershell to view the mounted file system.

          net use 

          Or directly open Windows Explorer to view the existing drive in the network location.

          Linux System

          Step 1: Install SMB Client

          Most Linux operating systems do not install the SMB client by default, so you need to manually install the SMB client before mounting the file system. Log in to the cloud server to run commands and install the SMB client.

          • For CentOS/RHEL operating system, please run the following command:
          yum install cifs-utils 
          • For Ubuntu/Debian operating system, please run the following command:
          apt-get install cifs-utils 

          Step 2: Mount the SMB File System

          Execute the following command to mount the SMB file system:

          mount -t cifs -o vers=3.0,guest,mfsymlinks,rsize=1048576,wsize=1048576,cache=strict 
          // <mount address>/cfs <target directory> 

          Among them, can be found in the mount point list of the file system, and is the destination directory specified by the user for the CFS file system to mount.

          See the table below for the explanation of the parameters in the command:

          Option Description
          vers SMB protocol version, supports major SMB versions such as 1.0, 2.0, 2.1, 3.0, etc. Because the Linux kernel has limited support for some high-level SMB protocols, it is recommended to choose version 3.0 (the default value when vers is not specified).
          rsize Sets the maximum number of bytes of data that a read request of a client file can receive. Setting the value too small will cause read throughput to decrease. Recommended value: 1048576。
          wsize Sets the maximum number of bytes that a write request of a client file can send. Setting the value too small will cause write throughput to decrease. Recommended value: 1048576。
          guest SMB currently supports guest mounting for identity authentication and file access.
          mfsymlinks Used to support the symbolic link function.
          cache Set whether to use smb client caching, optional values: strict and none. When not set, the default is strict, which means to use client-side caching.

          Example:

          mount -t cifs -o vers=3.0,guest,mfsymlinks,rsize=1048576,wsize=1048576,cache=strict 
          //cfs-WeQ8vqSEOD.lb-b768ef66.cfs.bj.baidubce.com/cfs /mnt/smb_dir 

          Step 3: Unmount the SMB File System

          Use the following command to unmount the file system:

          umount < Target directory > 

          Among them, is the drive of the CFS file system to uninstall.

          Step 4: View the Mounted SMB File System

          After the mounting is complete, use the following command to view the mounted file system:

          cat /proc/mounts 

          To view the capacity information of the file system, you can use the following command:

          df -h 
          Previous
          Mount NFS File System
          Next
          Manage File System