Restoring Plesk server

I have recently had to restore plesk from an offsite filesystem backup due to disk drive failure and loss of data. Below are notes for reference and the corresponding list of important folder/files to be backed up for a successful restore.

It helps if you are restoring sites to the same version of OS and Plesk Control Panel, so reload the OS and version of Plesk as was running prior to the data loss.

SYSTEM:

1. Merge "/etc/passwd", "/etc/group" and "/etc/shadow" for domain user accounts.
2. Bring up all IP aliases:

ifconfig eth0:0 xxx.xxx.xxx.xxx

Note: Keep backup of "/etc".

MYSQL:

1. Reset Plesk "admin" user password to old one.
2. Copy over "/etc/mysql/debian.conf".
3. Import all mysql databases:

Export:

mysqldump --opt --all-databases | gzip > all_db.sql.gz

Import:

gunzip < all_db.sql.gz | mysql -u admin -p

4. Restart mysql.

Note: Keep backup of "/var/lib/mysql" and "/var/log/mysql" (if incase database is corrupted and need to be restored using binary log files).

PLESK:

1. Reload ssl certificates from "/opt/psa/var/certificates/" or reinstall the certs via the control panel.
2. Restore/Merge phpmyadmin config "/opt/psa/admin/htdocs/domains/databases/phpMyAdmin/libraries/config.default.php", the below variables in particular:

$cfg['Servers'][$i]['controluser']
$cfg['Servers'][$i]['controlpass']
$cfg['Servers'][$i]['pmadb']

Note: Keep backup of "/opt/psa".

WEB:

1. Restore "conf.d/zz010_psa_httpd.conf".
2. Sync "/var/www/vhosts".
3. Check for psaserv and psacln folder permissions on "/var/www/vhosts/domains".

chgrp psaserv /var/www/vhosts/<domain>/httpdocs
chgrp -R psacln /var/www/vhosts/<domain>/httpdocs/*

Note: Keep backup of "/var/www/vhosts".

DNS:
1. Copy over "/var/named/run-root/etc/named.conf".
2. Copy over "/var/named/run-root/var".
3. Set the permissions correct:

chown bind /var/named/run-root/var
chgrp bind /var/named/run-root/var/run

Note: Keep backup of "/var/named".

MAIL:

1. Sync "/var/qmail".

Note: Keep backup of "/var/qmail".

Lessons Learned:

1. Keep file-system backups of:

/etc
/var/lib/mysql
/var/log/mysql
/opt/psa
/var/www
/var/named
/var/qmail
/var/spool/cron

2. Along with file-system backups, make sure to have database dumps.
3. Keep your cool.

Comment