To share files among multiple Elastic Desktop Service (EDS) cloud computers, create a File Storage NAS (NAS) file system and mount it on each cloud computer. This allows you to access the shared files as if they were in a local directory.
Overview
You can mount a NAS file system to multiple EDS cloud computers to provide centralized, shared storage. This process uses the Server Message Block (SMB) protocol to map the cloud-based file system to a local directory on each cloud computer. This setup supports concurrent read and write operations from multiple cloud computers, overcoming the limits of local storage while improving collaboration and data consistency. To keep the file system mounted after a reboot, also configure it to mount automatically at startup.
Use one of the following authentication modes to access the NAS file system:
Anonymous access (guest): This mode does not require a username or password. It is quick to configure and suitable for testing environments.
AD domain with Kerberos authentication: This mode integrates with your enterprise domain controller, enables SMB Access Control List (ACL) to control permissions, and is suitable for production environments.
When you create a NAS file system for sharing, ensure the NAS file system is in the same office network as the cloud computers. To ensure stable and secure file access, you must also allow outbound traffic on port 445 in the policies for the cloud computers.
Procedure
Step 1: Get the NAS mount target
Log on to the Elastic Desktop Service console.
In the left-side navigation pane, choose Networks & Storage > NAS File Systems.
On the page that is displayed, find the NAS file system you want to mount and copy its Mount Target Domain.
If no NAS file system is available in the list, click Create NAS File System and create one. A NAS file system must be in the same office network as the target cloud computers to be mounted.
Creating a NAS file system incurs storage usage fees based on its storage class, capacity, and retention period. For detailed billing rules about General-purpose NAS file systems, see Billing of General-purpose NAS file systems.
Step 2: Install the CIFS client
To use the SMB or Common Internet File System (CIFS) protocol on Linux, install the CIFS client (cifs-utils).
Open the Terminal in your cloud computer and run the appropriate installation command for your operating system.
Ubuntu or Debian
# Update the package manager
sudo apt-get update
# Fix any improperly configured packages
sudo dpkg --configure -a
# Install the CIFS client
sudo apt-get install cifs-utilsRHEL, CentOS, or Alibaba Cloud Linux
sudo yum install cifs-utilsopenSUSE or SLES12-SP2
sudo zypper install cifs-utilsCoreOS
Configure SELinux.
sed -i 's/SELINUXTYPE=mcs/SELINUXTYPE=targeted/' /etc/selinux/configManually compile the CIFS client on the CoreOS system.
Follow the steps below to start a Fedora container and compile the CIFS client. Alternatively, download the official Alibaba Cloud CIFS client package for CoreOS and copy it to the /tmp/ or /bin directory.
Start a Fedora container to compile cifs-utils.
docker run -t -i -v /tmp:/cifs fedora /bin/bashRun the following commands sequentially inside the Docker environment.
yum groupinstall -y "Development Tools" "Development Libraries"yum install -y bzip2curl https://download.samba.org/pub/linux-cifs/cifs-utils/cifs-utils-6.9.tar.bz2 --output cifs-utils-6.9.tar.bz2;bunzip2 cifs-utils-6.9.tar.bz2 && tar xvf cifs-utils-6.9.tarcd cifs-utils-6.9; ./configure && makecp mount.cifs /cifs/exit
Step 3: Create a local mount point
A mount point is the local directory that provides access to the NAS file system on cloud computers.
# Create a directory to serve as the mount point
sudo mkdir -p /mnt/nasStep 4: Mount the NAS file system
Mounting the NAS file system connects the local mount point with the NAS mount target. Once the connection is established, the cloud computer can use the NAS file system as if it were a local directory.
Before mounting, use the telnet command to verify network connectivity between the cloud computer and the NAS mount target. For specific steps, see Network connectivity.
Choose one of the following authentication modes for access from the cloud computer to the NAS file system:
Anonymous access: Use this mode if you are accessing the NAS file system as a convenience user, or if your cloud computer is in an Active Directory (AD) office network but the NAS file system does not have SMB ACL enabled.
AD-authenticated access: Use this mode if your cloud computer is in an AD office network and the NAS file system has SMB ACL enabled. Mounting the NAS file system requires authentication with an enterprise administrator AD account.
In the following sample commands, replace the placeholder values with your own.
nas-example.cn-hangzhou.nas.aliyuncs.com: The NAS mount target that you got in Step 1./mnt/nas: The local mount point that you created in Step 3.myshare: The default name for sharing the NAS file system over the SMB protocol, which cannot be changed.
Anonymous access
If you are mounting the NAS file system as a convenience user, or if your cloud computer is in an AD office network but the NAS file system does not have SMB ACL enabled, run the following commands to mount the NAS file system.
This mode does not require credentials and is not recommended for use in production environments.
Mount the file system
# Get the UID of the current user
id -u
# Get the GID of the current user
id -g
# Mount the file system
sudo mount -t cifs //nas-example.cn-hangzhou.nas.aliyuncs.com/myshare /mnt/nas -o vers=2.1,guest,uid=0,gid=0,dir_mode=0755,file_mode=0755,mfsymlinks,cache=strict,rsize=1048576,wsize=1048576uid and gid: Replace 0 with the UID and GID values that you got.
Configure automatic mounting
To ensure the file system remounts automatically after a cloud computer reboot, configure it for automatic mounting.
Add the following line to the /etc/fstab file on your cloud computer:
# //nas-server/share /mount/point type options dump pass
//<Mount target domain>/myshare /mnt cifs vers=2.1,guest,uid=0,gid=0,dir_mode=0755,file_mode=0755,mfsymlinks,cache=strict,rsize=1048576,wsize=1048576 0 0After you save the file, run sudo systemctl daemon-reload to apply the changes.
AD-authenticated access
If your cloud computer is in an AD office network and the NAS file system has SMB ACL enabled, run the following commands to mount the file system. If you have not enabled SMB ACL, enable it by referring to Join the mount target of an SMB file system to an AD domain.
Mount the file system
# Get the UID of the current user
id -u
# Get the GID of the current user
id -g
# Mount the file system
sudo mount -t cifs //nas-example.cn-hangzhou.nas.aliyuncs.com/myshare /mnt/nas -o vers=3.0,sec=krb5,cruid=0,uid=0,gid=0vers=3.0: When SMB ACL is enabled, the protocol version must be 3.0 or later.cruidanduid: Replace0with the UID value that you got.gid: Replace0with the GID value that you got.
Configure automatic mounting
To ensure the file system remounts automatically after a cloud computer reboot, configure it for automatic mounting.
Add the following line to the /etc/fstab file on your cloud computer:
# //nas-server/share /mount/point type options dump pass
//<Mount target domain>/myshare /mnt cifs vers=3.0,sec=krb5,cruid=0,uid=0,gid=0 0 0After you save the file, run sudo systemctl daemon-reload to apply the changes.
Verify the result
Run the following commands. The mount is successful if the output includes information about your NAS file system. If there is no output or the output does not include the configured mount point, the mount failed.
# Check the status of the mount point
mount | grep cifs
# View the file system capacity information
df -h | grep /mnt/nasTroubleshooting
If the mount fails, check the following common causes.
Network connectivity
Use this command to verify network connectivity from the cloud computer to the mount target:
# Test network port connectivity
telnet nas-example.cn-hangzhou.nas.aliyuncs.com 445If the connection to the mount target fails, verify the following:
The NAS file system is in the same office network as the the cloud computer.
The policy for the cloud computer does not block outbound traffic on port 445.