How to restore and mount backups for vps and package cloud servers

Published: 2014-12-04

For the Elastic Cloud Host Cloud Snapshot feature, please refer to: https://www.west.cn/faq/list.asp?unid=1215 


I. Mount Backup (Preferred)

1. Windows system:

In the host management interface, under Cloud Snapshot select a time point, then click [Snapshot Mount]

image.png

After mounting is complete, connect to the server remotely. Right-click My Computer -- Manage -- Disk Management, and you can see the unallocated disk

2.jpg

Right-click the unallocated disk -- Change Drive Letter and Paths -- Add to assign a drive letter to the disk. Then open My Computer again, and you can see the newly added disk. The disk directory has the same structure as the server directory. Go to the corresponding directory on the backup disk and copy the required data. Note that important data cannot be placed on the mounted disk; the system will reclaim it the next day.

Default website path: D:\wwwroot\ftp account\wwwroot

Default MySQL storage path: d:\SOFT_PHP_PACKAGE\mysql\

MySQL database storage: d:\SOFT_PHP_PACKAGE\mysql\data

Default MSSQL data storage: d:\mssql 

Note: The above paths are all default paths created with Management Assistant

Windows 2008/2012 system:

Enter compmgmt.msc in the command line to open Computer Management.

blob.png

Open Disk Management, right-click the disk without a drive letter, and select Online.

blob.png

II. Restore Backup

Note: Restoring a backup can select the system disk and database disk, but restoration will overwrite current data. If there is important data, back it up in advance. Unless necessary, it is strongly recommended to use the mount backup method to restore.

In the host control panel, click Cloud Snapshot, select the disk to restore, and click Restore Backup.

image.png


2. Linux system

After mounting, log in to the server via SSH. For how to connect remotely, see the instructions: http://faq.myhostadmin.net/faq/listagent.asp?unid=417 

Run the following commands to mount the backup disk to your server (red indicates commands that need to be entered, green indicates explanations):

[root@ebs-37458 ~]# df -lh  //View 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 disk partitions, as shown in the figure:

4.jpg

From the above df -lh output of mounted partitions, you can see that /dev/vda1 corresponds to the / partition, /dev/vdb1 corresponds to the /home partition, and only /dev/vdc1 has no corresponding mount. /dev/vdc1 is the newly mounted partition. Next, mount it by entering the following commands:

[root@ebs-37458 ~]# mkdir /home1  //Create a directory; you can also name this directory yourself

[root@ebs-37458 ~]# mount /dev/vdc1 /home1 //Mount the backup partition to the home1 directory

Run df -lh again and you can see that /dev/vdc1 has been mounted

5.jpg

Note: The mounted disk partition is generally /dev/vdc1 by default. When entering mount, use the actual partition name you see.

Next, perform data copy recovery. The copy command is cp -rf /home1/xxx/* /home/xxx Explanation: Copy all files under the /home1/xxx/ directory to /home/xxx

The default website directory structure of our wdcp system is: /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.

7.jpg

As shown in the example above, the command to restore this website is as follows

cp -rf /home1/wwwroot/test_com/public_html/* /home/wwwroot/test_com/public_html/

After copying, you also need to reset the website directory permissions. The command is chown www.www /home/wwwroot/ -R

The default database path is /home/wddata/var If you want to restore the database bb, the command is:

cp -rf /home1/wddata/var/bb/*  /home/wddata/var/bb/

Reset directory permissions: chown mysql.mysql /home/wddata/var/ -R

Alternatively, you can connect to the server via SFTP to download the backup data inside. For a tutorial, refer to: https://www.west.cn/faq/list.asp?unid=637

Also attached is the method for restoring a site after reinstalling the system: https://www.west.cn/faq/list.asp?unid=608