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

Published: 2014-12-04

For the Elastic Cloud Server 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 point in time, then click [Snapshot Mount]

image.png

After mounting is complete, connect to the server remotely, right-click My Computer -- Manage -- Disk Management to 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 is consistent with the server directory structure. Simply go to the corresponding directory on the backup disk and copy the required data. Note: Do not put important data on the mounted disk; the system will recycle 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 the Management Assistant

Windows 2008/2012 system:

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

blob.png

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

blob.png

II. Restore Backup

Note: When restoring a backup, you can select the system disk and database disk, but the restore 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 for restoration.

On 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, please 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 to enter, green indicates explanations):

[root@ebs-37458 ~]# df -lh  //View partition information

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

By using df -lh above to view 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 choose your own name for this directory

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

Run the df -lh command 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 the mount command, use the partition name actually seen.

Next is to copy and restore data. 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 company's 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, to restore this website, the command 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 . To restore the bb database, the command is:

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

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

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

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