Follow

Restore of files and databases from server backup

Do we offer backups for files or databases if they are deleted accidentally ?

Yes !!, everything is stored in between 7 - 14 days by snapshots.

For web:

Login to the SSH and type cd .snapshots  (make a note of dot before the word 'snapshots')
(usually after login you are at the path /storage/content/yy/xxxxxyy/ - yy is the two last digits in the customer ID, and xxxxxyy the entire customer ID)
root@ser-staff-01# cd .snapshots

You will see a list of date stamped folders where you can fetch data. This is how it should look like :
root@ser-staff-01# ls -ahl
total 64K
drwx--x--- 1 1000850 www-data 516 Apr 26 02:00 .
drwx--x--- 1 1000850 www-data 516 Apr 26 09:12 ..
drwx--x--- 1 1000850 www-data 280 Apr 12 15:18 Daily_2018_04_13__02_00
drwx--x--- 1 1000850 www-data 280 Apr 12 15:18 Daily_2018_04_14__02_00
drwx--x--- 1 1000850 www-data 280 Apr 12 15:18 Daily_2018_04_15__02_00
drwx--x--- 1 1000850 www-data 280 Apr 12 15:18 Daily_2018_04_16__02_00
drwx--x--- 1 1000850 www-data 280 Apr 12 15:18 Daily_2018_04_17__02_00
drwx--x--- 1 1000850 www-data 356 Apr 17 11:43 Daily_2018_04_18__02_00
drwx--x--- 1 1000850 www-data 356 Apr 17 11:43 Daily_2018_04_19__02_00
drwx--x--- 1 1000850 www-data 356 Apr 17 11:43 Daily_2018_04_20__02_00
drwx--x--- 1 1000850 www-data 396 Apr 20 12:09 Daily_2018_04_21__02_00
drwx--x--- 1 1000850 www-data 396 Apr 20 12:09 Daily_2018_04_22__02_00
drwx--x--- 1 1000850 www-data 396 Apr 20 12:09 Daily_2018_04_23__02_00
drwx--x--- 1 1000850 www-data 396 Apr 20 12:09 Daily_2018_04_24__02_00
drwx--x--- 1 1000850 www-data 436 Apr 24 21:09 Daily_2018_04_25__02_00
drwx--x--- 1 1000850 www-data 476 Apr 25 09:18 Daily_2018_04_26__02_00

You can then enter to the date stamped folders you want to fetch the data from by typing, for example

root@ser-staff-01# cd Daily_2018_04_26__02_00
You will see your files of your account here. You can fetch the file content you want. These folders contain all backups of your files. Select the last created folder and see if the file is in it. If the file is created and then lost within a time span where a backup has not been taken then, it can not be recovered.

In the following example, we will show you on how to restore servage-default.html file under the sub-domain of james.flensburgfjord.com

NOTE : You will need to replace the account path /storage/content/50/1000850 with your own correct account path.

-securelve_sh-4.1$ cd /storage/content/50/1000850/.snapshots/
-securelve_sh-4.1$ ls -alh
total 64K
drwx--x--- 1 1000850_james www-data 800 May 27 02:01 .
drwx--x--- 1 1000850_james www-data 800 May 26 12:41 ..
..
..
drwx--x--- 1 1000850_james www-data 596 May 1 08:09 Daily_2018_05_14__02_00
drwx--x--- 1 1000850_james www-data 596 May 1 08:09 Daily_2018_05_19__02_00
drwx--x--- 1 1000850_james www-data 596 May 1 08:09 Daily_2018_05_20__02_00
drwx--x--- 1 1000850_james www-data 596 May 1 08:09 Daily_2018_05_21__02_00
drwx--x--- 1 1000850_james www-data 596 May 1 08:09 Daily_2018_05_22__02_00
....
..

Now, suppose I need to restore the file from Daily_2018_05_20__02_00

-securelve_sh-4.1$ cd Daily_2018_05_20__02_00
-securelve_sh-4.1$ ls -alh
total 68K
drwx--x--- 1 1000850_james www-data 596 May 1 08:09 .
drwx--x--- 1 1000850_james www-data 800 May 27 02:01 ..
-rw------- 1 1000850_james 1000850_james 746 Apr 27 19:25 .bash_history
drwxrwx--x 1 1000850_james 1000850_james 96 Apr 16 12:08 .cagefs
drwxr-xr-x 1 root 1000850_james 924 Apr 29 00:20 db_backup
drwx--x--- 1 1000850_james www-data 180 Apr 20 12:09 james.flensburgfjord.com

-securelve_sh-4.1$ cd james.flensburgfjord.com
-securelve_sh-4.1$ ls -alh
total 16K
drwx--x--- 1 1000850_james www-data 180 Apr 20 12:09 .
drwx--x--- 1 1000850_james www-data 596 May 1 08:09 ..
drwx--x--- 1 1000850_james www-data 0 Apr 20 12:09 data
drwxr-xr-x 1 1000850_james www-data 148 Apr 30 04:20 logs
drwxr-s--- 1 1000850_james www-data 192 Apr 25 19:43 public_html
drwx--x--- 1 1000850_james www-data 0 Apr 20 12:09 sessions
drwx--S--- 1 1000850_james www-data 0 Apr 20 12:09 upload_tmp_dir
-securelve_sh-4.1$ cd public_html/
-securelve_sh-4.1$ ls -alh
total 16K
drwxr-s--- 1 1000850_james www-data 192 Apr 25 19:43 .
drwx--x--- 1 1000850_james www-data 180 Apr 20 12:09 ..
drwxr-sr-x 1 1000850_james www-data 588 May 16 07:58 cm4all
-rwxr-xr-x 1 1000850_james www-data 0 Apr 25 19:43 livechat.html
-rw-r----- 1 1000850_james www-data 860 Apr 20 12:09 servage-default.html

NOTE : You can use the 'cp' option copy the files.

-securelve_sh-4.1$ cp <path of the backup file> <destination account path>

You will need to enter the complete path including account path where you want to copy the file as shown below :

-securelve_sh-4.1$ cp servage-default.html /storage/content/50/1000850/james.flensburgfjord.com/public_html
-securelve_sh-4.1$

NOTE : If you want to restore a folder then use the -R option, this will copy all the files and sub-folders under the folder.

Example :

'cm4all' is a folder in this case. This will copy all files and sub-folders under cm4all to the public_html folder of sub-domain james.flensburgfjord.com

-securelve_sh-4.1$ cp -R cm4all /storage/content/50/1000850/james.flensburgfjord.com/public_html
-securelve_sh-4.1$


For databases:
Backups are saved in "db_backup" folder in customers homedir i.e in under the root (/) (every night is overwritten there), and this can also be revised by using snapshot for older bacakups.

This is how it looks on your account:
Type,
root@ser-staff-01# cd /storage/content/yy/xxxxxyy/db_backup
root@ser-staff-01# ls -ahl
-rw-r--r-- 1 root root 4.8K Apr 26 00:20 1000850-fvyfya107187-ser-mysql-01-06.sql.gz
-rw-r--r-- 1 root root 293 Apr 26 00:20 1000850-helge-ser-mysql-01-06.sql.gz
-rw-r--r-- 1 root root 293 Apr 26 00:20 1000850-james-ser-mysql-01-06.sql.gz
-rw-r--r-- 1 root root 4.8K Apr 26 00:20 1000850-jrfliu889295-ser-mysql-01-06.sql.gz

You will see the Mysql backups here.

In the following example, we will show you on how to restore a database file to the root (/ folder) of the account.

Suppose I would like to restore the database '1000850-zqgerg944962-ser-mysql-01-06.sql.gz' from our backup to the root of my account.

-securelve_sh-4.1$ cd /storage/content/50/1000850/db_backup
-securelve_sh-4.1$ ls -alh
total 1004K
drwxr-xr-x 1 root 1000850_james 1.3K May 26 00:20 .
drwx--x--- 1 1000850_james www-data 800 May 26 12:41 ..
-rw-r--r-- 1 root root 293 May 27 00:20 1000850-1000850-fvyfya107187-ser-mysql-01-06.sql.gz
-rw-r--r-- 1 root root 74K May 27 00:20 1000850-aojdev965973-ser-mysql-01-06.sql.gz
..
..
..
-rw-r--r-- 1 root root 4.8K May 27 00:20 1000850-zqgerg944962-ser-mysql-01-06.sql.gz

-securelve_sh-4.1$ cp 1000850-zqgerg944962-ser-mysql-01-06.sql.gz /storage/content/50/1000850

To uncompress the .gz file, you can use gunzip command

-securelve_sh-4.1$ gunzip /storage/content/50/1000850/db_backup/1000850-zqgerg944962-ser-mysql-01-06.sql.gz /storage/content/50/1000850
-securelve_sh-4.1$

The database file will now get uncompressed and will be in .sql format under your root folder.

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

0 Comments

Article is closed for comments.