1. Attach the crashed hard drive as the secondary in the server and mount to /old directory
2. Important: This step is only possible if version of MySQL server on both original and new servers match.
Start MySQL server with datadir parameter in /etc/my.cnf pointing to MySQL database location on old drive (/old/var/lib/mysql) and dump databases:
# mysql -uadmin -p`cat /old/etc/psa/.psa.shadow` -Dpsa -Ns -e"select name from data_bases where type = 'mysql'" | while read dbname ; do mysqldump -uadmin -p`cat /etc/psa/.psa.shadow` --databases $dbname > $dbname.sql ; done
Then stop MySQL, revert datadir parameter in /etc/my.cnf to its original value, start MySQL and restore databases:
# for f in *.sql ; do mysql -uadmin -p`cat /etc/psa/.psa.shadow` < $f ; done
3. Restore the Parallels Plesk Panel database from the available dump:
a) Stop Plesk service:
# /etc/init.d/psa stopall
b) Start MySQL server:
# /etc/init.d/mysqld start
c) Import the database dump:
zcat /old/var/lib/psa/dumps/mysql.daily.dump.0.gz | mysql -uadmin -p`cat /etc/psa/.psa.shadow`
4. Copy Plesk database password file:
# cp -rpf /old/etc/psa/.psa.shadow /etc/psa/.psa.shadow
5. (For Plesk 11.x) Copy encryption key to new server:
# cp /etc/psa/private/secret_key /etc/psa/private/secret_key.save
# cp -rpf /old/etc/psa/private/secret_key /etc/psa/private/secret_key
6.Alter table IP_Addresses if the set of IP addresses assigned to the new server has changed.
7. Restore domain content:
# rsync -av /old/var/www/vhosts/ /var/www/vhosts/
8. Restore Parallels Plesk Panel system users:
# mysql -uadmin -p`cat /etc/psa/.psa.shadow` -Dpsa -Ns -e"select s.login, a.password, s.home, s.shell from sys_users s, accounts a where a.id = s.account_id" | awk '{ print "PSA_PASSWD=\x27" $2 "\x27 /usr/local/psa/admin/sbin/usermng --add-user --user=" $1 " --homedir=" $3 " --shell=" ($4?$4:"/bin/false")}' | sh -x
For Plesk 10.x and later additionally following command should be executed:
# mysql -uadmin -p`cat /etc/psa/.psa.shadow` -Dpsa -Ns -e"select s1.login, s2.login from sys_users s1 left join sys_users s2 on s2.id = s1.mapped_to where s2.login is not null" | awk '{print "/usr/local/psa/admin/sbin/usermng --map-user --user=" $1 " --mapped-to=" $2}' | sh -x
9. Repair ownership on virtual hosts' content to fix files/directories owned by non-existing users:
For Plesk 10.x and 11.x:
# mysql -uadmin -p`cat /etc/psa/.psa.shadow` -Dpsa -Ns -e"SELECT s.home, h.www_root, s.login FROM hosting h, sys_users s WHERE s.id = h.sys_user_id" | while read home www_root login ; do content_uid=`stat --format=%u "$www_root"` ; find $home -uid $content_uid -exec chown $login '{}' + ; done
For Plesk 9.x and earlier:
# mysql -uadmin -p`cat /etc/psa/.psa.shadow` -Dpsa -Ns -e"SELECT home, login FROM sys_users" | while read home login ; do content_uid=`stat --format=%u "$home/httpdocs"` ; find $home -uid $content_uid -exec chown $login '{}' + ; done
10. Restore SSL certificates:
# cp -p /old/usr/local/psa/var/certificates/* /usr/local/psa/var/certificates/
11. Regenerate webserver configuration:
For Plesk 8.x and 9.x:
# /usr/local/psa/admin/sbin/websrvmng –a -v
For Plesk 10.x:
# /usr/local/psa/admin/sbin/httpdmng --reconfigure-all
12. Restore mailnames content:
# rsync -av /old/var/qmail/mailnames/ /var/qmail/mailnames/
# chown -R popuser:popuser /var/qmail/mailnames/*
13. Repair mail configuration:
# /usr/local/psa/admin/sbin/mchk –-with-spam
14. Restore DNS zones:
For Plesk 9.x and earlier:
# mysql -uadmin -p`cat /etc/psa/.psa.shadow` psa -Ns -e "select name from dns_zone" | awk '{ print "/usr/local/psa/admin/sbin/dnsmng update " $1 }' | sh -x
For Plesk 10.x and newer:
# mysql -uadmin -p`cat /etc/psa/.psa.shadow` psa -Ns -e "select name from dns_zone" | awk '{ print "/usr/local/psa/admin/sbin/dnsmng --update " $1 }' | sh -x
15. Start Parallels Plesk Panel service:
# /etc/init.d/psa start
2. Important: This step is only possible if version of MySQL server on both original and new servers match.
Start MySQL server with datadir parameter in /etc/my.cnf pointing to MySQL database location on old drive (/old/var/lib/mysql) and dump databases:
# mysql -uadmin -p`cat /old/etc/psa/.psa.shadow` -Dpsa -Ns -e"select name from data_bases where type = 'mysql'" | while read dbname ; do mysqldump -uadmin -p`cat /etc/psa/.psa.shadow` --databases $dbname > $dbname.sql ; done
Then stop MySQL, revert datadir parameter in /etc/my.cnf to its original value, start MySQL and restore databases:
# for f in *.sql ; do mysql -uadmin -p`cat /etc/psa/.psa.shadow` < $f ; done
3. Restore the Parallels Plesk Panel database from the available dump:
a) Stop Plesk service:
# /etc/init.d/psa stopall
b) Start MySQL server:
# /etc/init.d/mysqld start
c) Import the database dump:
zcat /old/var/lib/psa/dumps/mysql.daily.dump.0.gz | mysql -uadmin -p`cat /etc/psa/.psa.shadow`
4. Copy Plesk database password file:
# cp -rpf /old/etc/psa/.psa.shadow /etc/psa/.psa.shadow
5. (For Plesk 11.x) Copy encryption key to new server:
# cp /etc/psa/private/secret_key /etc/psa/private/secret_key.save
# cp -rpf /old/etc/psa/private/secret_key /etc/psa/private/secret_key
6.Alter table IP_Addresses if the set of IP addresses assigned to the new server has changed.
7. Restore domain content:
# rsync -av /old/var/www/vhosts/ /var/www/vhosts/
8. Restore Parallels Plesk Panel system users:
# mysql -uadmin -p`cat /etc/psa/.psa.shadow` -Dpsa -Ns -e"select s.login, a.password, s.home, s.shell from sys_users s, accounts a where a.id = s.account_id" | awk '{ print "PSA_PASSWD=\x27" $2 "\x27 /usr/local/psa/admin/sbin/usermng --add-user --user=" $1 " --homedir=" $3 " --shell=" ($4?$4:"/bin/false")}' | sh -x
For Plesk 10.x and later additionally following command should be executed:
# mysql -uadmin -p`cat /etc/psa/.psa.shadow` -Dpsa -Ns -e"select s1.login, s2.login from sys_users s1 left join sys_users s2 on s2.id = s1.mapped_to where s2.login is not null" | awk '{print "/usr/local/psa/admin/sbin/usermng --map-user --user=" $1 " --mapped-to=" $2}' | sh -x
9. Repair ownership on virtual hosts' content to fix files/directories owned by non-existing users:
For Plesk 10.x and 11.x:
# mysql -uadmin -p`cat /etc/psa/.psa.shadow` -Dpsa -Ns -e"SELECT s.home, h.www_root, s.login FROM hosting h, sys_users s WHERE s.id = h.sys_user_id" | while read home www_root login ; do content_uid=`stat --format=%u "$www_root"` ; find $home -uid $content_uid -exec chown $login '{}' + ; done
For Plesk 9.x and earlier:
# mysql -uadmin -p`cat /etc/psa/.psa.shadow` -Dpsa -Ns -e"SELECT home, login FROM sys_users" | while read home login ; do content_uid=`stat --format=%u "$home/httpdocs"` ; find $home -uid $content_uid -exec chown $login '{}' + ; done
10. Restore SSL certificates:
# cp -p /old/usr/local/psa/var/certificates/* /usr/local/psa/var/certificates/
11. Regenerate webserver configuration:
For Plesk 8.x and 9.x:
# /usr/local/psa/admin/sbin/websrvmng –a -v
For Plesk 10.x:
# /usr/local/psa/admin/sbin/httpdmng --reconfigure-all
12. Restore mailnames content:
# rsync -av /old/var/qmail/mailnames/ /var/qmail/mailnames/
# chown -R popuser:popuser /var/qmail/mailnames/*
13. Repair mail configuration:
# /usr/local/psa/admin/sbin/mchk –-with-spam
14. Restore DNS zones:
For Plesk 9.x and earlier:
# mysql -uadmin -p`cat /etc/psa/.psa.shadow` psa -Ns -e "select name from dns_zone" | awk '{ print "/usr/local/psa/admin/sbin/dnsmng update " $1 }' | sh -x
For Plesk 10.x and newer:
# mysql -uadmin -p`cat /etc/psa/.psa.shadow` psa -Ns -e "select name from dns_zone" | awk '{ print "/usr/local/psa/admin/sbin/dnsmng --update " $1 }' | sh -x
15. Start Parallels Plesk Panel service:
# /etc/init.d/psa start