1. Log in ali Cloud to find the file storage NAS and open them. There are three types: ordinary NAS file system, super fast NAS file system and CPFS file system.

2. Operation Steps:

1) Click the file system list, click Create File System, and fill in the related content on the Create page. Ensure that the region selected is consistent with the server ECS

2) after creating good can see inside the file system list, click the management after can see basic information, then click on the mount is used, the default already has a mount point, if you still need a mount point can click on add a mount point, and then is mounting the file system to the ECS operation, here is centos, other types can also be found in ali cloud document again.

A. Install the NFS client on the ECS instance

sudo yum install nfs-utils
Copy the code

B. Run the following command to increase the number of NFS requests:

sudo echo "options sunrpc tcp_slot_table_entries=128" >> /etc/modprobe.d/sunrpc.confsudo echo "options sunrpc tcp_max_slot_table_entries=128" >> /etc/modprobe.d/sunrpc.conf
Copy the code

C. Mount the NAS file system. Select a mount point address

sudo mount -t nfs -o vers=3,nolock,proto=tcp,rsize=1048576,wsize=1048576,hard,timeo=600,
 retrans=2,noresvport xxxxxxx.nas.aliyuncs.com:/ /mnt
Copy the code

Nas.aliyuncs.com is the address of the NAS mount point, and MNT is the file directory of the server. The mount directory can be selected by yourself. If you want to mount the project image to it, change the MNT directory to the uploads directory under the project folder.

D. Run the following command to check whether the NFS file system is successfully mounted. If the command output contains the NFS file system mounting address, the NFS file system is successfully mounted.

df -h | grep aliyun
Copy the code

3. You can use the LN soft chain to flexibly expand the space. For example, you can mount the log records and pictures of the project to the NAS file system.

The best operation is to CP to another newly created directory, and then MV to a remote directory such as/MNT /uploads to avoid file leakage. Finally, run the ln command to chain to the remote directory. After the uploads directory of the project is operated by ln, the files in the original directory will not be seen, but the disk space is still occupied. The files will be deleted only after you delete or mv.

Cp (copy) mv (move (cut and paste) ln (link)

Umount (unmount) rm -rf

Mv command operation:

mv /data/www/project/runtime/log/* /mnt/log
Copy the code

Using the ln command :(ln -s source file destination file)

ln -s /mnt/log /data/www/project/runtime/log
Copy the code

When I first started using ln, the source and destination files behind ln were completely reversed

Note that the directory of the target file is automatically created after the ln command is executed. Therefore, the directory cannot exist before the ln command is executed. Otherwise, the execution fails or the execution result is not the desired result. The correct mapping would be log- / MNT /log, which is the log folder is a soft chain, which is a shortcut, and this is the log folder inside the devlog folder is a soft chain.

The correct picture should look like this

The soft chain created is a Devlog directory in log. Here is a copy of the operation record:

1) Test service: After installing the uFS client, I ran the mount command to mount the project to the log directory, and then there was a folder 202107 in the log directory. Then I umount the MNT folder in the root directory of the server and mount it to the MNT folder again. But after entering MNT folder directly in 202107, and then built under mount folder MNT devlog directory, and then I put the project under the runtime log directory renamed log_bak directory, and then execute the ln command operation, Ln -s/MNT/devlog/data/WWW/project/runtime/log and then into the runtime folder ll command, don’t see the mapping relation, and then into the log of the runtime ll command inside, Rm log->/ MNT /devlog ->/ MNT /devlog ->/ MNT /devlog ->/ MNT /devlog ->/ MNT /devlog ->/ MNT /devlog I execute the log in the project folder, so I don’t understand why the soft chain is not log), To rename the original log_bak inside the entire contents of the mv to MNT/devlog inside and then perform ln -s/MNT/devlog/data/WWW/project/runtime/log operation, Log_bak/MNT /devlog/MNT/MNT/MNT/MNT/MNT/MNT/MNT/MNT/MNT/MNT/MNT/MNT

Here’s a point that may be confusing to newcomers: Mount the MNT folder in the root directory of the server, and then mount it to the MNT folder again. But after entering MNT, the folder of 202107 is directly inside. Why is this?

Explanation: Mount is a soft operation. After you mount it to log, create a subdirectory 202107 in it, which is a hard operation, and then mount it to/MNT, which is a soft operation. It doesn’t affect the remote subdirectory 202107. To unmount a usb flash drive, unmount a usb flash drive, unmount a USB flash drive, unmount a USB flash drive, unmount a USB flash drive, unmount a USB flash drive, unmount a USB flash drive, unmount a USB flash drive, unmount a USB flash drive, unmount a USB flash drive, unmount a USB flash drive, unmount a USB flash drive.

2) Production clothing: Run the following command to create the mntshare directory in the root directory of the production server, and then create a plog directory in the directory. Then install the UFS client on the production server, mount the uFS client to the mntshare directory in the root directory of the server. Then all the contents of the log in the runtime of mv project are transferred to the plog directory in mntshare. After mv, the log directory in runtime is deleted. Run the ln -s /mntshare/plog/project folder /runtime/log command. Then run the runtime command. Plog – /mntshare/plog – /mntshare/plog – /mntshare/plog Delete the plog soft link (rm -rf plog), rename the runtime log to log_bak, and run the ln command. The mapping is runtime log-.

The folder with the soft chain is shown in bright blue.

– Production can go to SCP to make a hard backup.