Data recovery after mounting a cloud snapshot on an Elastic Cloud Host Linux system.
Published: 2018-08-15
First refer to the snapshot mounting guidehttps://www.west.cn/faq/list.asp?unid=1215 Generally, only the data disk is mounted; this tutorial uses mounting the data disk as an example.
Note: After copying and restoring the data, you must shut down the server so that the system can unmount it, and then power it on for use.
If you do not shut down to unmount, when the server automatically unmounts in the early morning, it will also shut down and restart (which may affect data). In addition, do not modify the mounted disk or store other important data on it.
After mounting, log in to the server via SSH. For how to connect remotely, please see the instructions:http://faq.myhostadmin.net/faq/listagent.asp?unid=417
Run the following commands to mount the partition (red text is the command to execute; copy the red part and run it, green text is explanatory notes added in this tutorial).
[root@ebs-37458 ~]# df -lh //Check partition status
Filesystem Size Used Avail Use%% Mounted on
/dev/vda1 30G 2.1G 26G 8% /
tmpfs 2.0G 0 2.0G 0% /dev/shm
/dev/vdb1 20G 194M 19G 2% /home
Then enter fdisk -l to view the disk partitions, as shown in the figure:

Use df -lh to view the mounted partitions. You can see that /dev/vda1 corresponds to the / partition, and /dev/vdb1 corresponds to the /home partition. /dev/vdc1 does not have a corresponding mount; /dev/vdc1 is the newly mounted partition, and next it needs to be mounted.(Note: If both the system disk and the data disk are mounted, there will also be a /dev/vdd1)
Mount commands:
[root@ebs-37458 ~]# mkdir /home1 //Create the home1 directory; you can also name this directory yourself
[root@ebs-37458 ~]# mount /dev/vdc1 /home1 //Mount the backup partition to the home1 directory
Use the df -lh command to check, and you can see that home1 has been mounted to /dev/vdc1. Now /home1 is the backup data; copy whatever data you need from it.

Note: The mounted disk partition is generally /dev/vdc1 by default. When entering the mount command, use the partition name you actually see.
Data copy examples
Copy command cp -rf /home1/xxx/* /home/xxx Explanation: Copy the files under the /home1/xxx/ directory to /home/xxx
Default website directory structure of our wdcp system: /home/wwwroot/site_name/public_html
As shown in the figure, after logging in to wdcp, click the site list to see the specific website path.

Taking the above figure as an example, the website directory path is /home/wwwroot/test_com, and you want to restore the files of this website.
Enter the following commands:
/bin/cp -rf /home1/wwwroot/test_com/public_html/* /home/wwwroot/test_com/public_html/
chown www.www /home/wwwroot/ -R Explanation: Reset the owner of the wwwroot directory
The default database path is /home/wddata/var . If you want to restore the dbsql database, the command is:
cp -rf /home1/wddata/var/dbsql/* /home/wddata/var/dbsql/ Explanation: Copy /home1/wddata/var/dbsql/ to /home/wddata/var/dbsql/
Reset directory owner: chown mysql.mysql /home/wddata/var/dbsql/ -R Explanation: Reset the owner of the /home/wddata/dbsql/ directory
In addition, you can connect to the server via sftp to download the backup data inside. Refer to the tutorial:http://faq.myhostadmin.net/faq/listagent.asp?unid=637
Also attached is the method for restoring sites after reinstalling the system:http://faq.myhostadmin.net/faq/listagent.asp?unid=608
Note: After copying and restoring the data, you must shut down the server so that the system can unmount it, and then power it on for use.
If you do not shut down to unmount, when the server automatically unmounts in the early morning, it will also shut down and restart (which may affect data). In addition, do not modify the mounted disk or store other important data on it.
