How to , and other stuff about linux, photo, php … Another blog just like others on internet

July 9, 2015

How To Restore a cPanel Server from old hard drive

Filed under: Linux — Tags: , , — admin @ 11:52 am

First of all this is a tutorial that you run it on your risk . Any way if you are in this situation a reinstall was done, and you have a snapshot mounted or old hard drive .
Also this is in case that you don’t have backup from whm and you can’t import them .

We are assuming that your old hard drive is mounted as ‘old-drive’

We sync important configuration from etc . Please after this don’t log out and try to log on your server . Here we re sync also the shadow this mean you will log using old password
cd /old-drive/etc/
rsync -avHz user* trueuser* domainips secondarymx domainalias valiases vfiltersexim* backupmxhosts proftpd* pure-ftpd* logrotate.conf passwd* group* *domain* *named* wwwacct.conf cpbackup.conf cpupdate.conf quota.conf shadow* *rndc* ips* ipaddrpool* ssl hosts spammer* skipsmtpcheckhosts relay* localdomains remotedomains my.cnf /etc

Next is apache configuration
rsync -avHz /old-drive/usr/local/apache/conf /usr/local/apache
rsync -avHz /old-drive/usr/local/apache/modules /usr/local/apache
rsync -avHz /old-drive/usr/local/apache/domlogs /usr/local/apache

Dns configuration
rsync -avHz /old-drive/var/named /var

Cpanel restore
rsync -avHz /old-drive/usr/local/cpanel /usr/local

Mysql restoration
rsync -avHz /old-drive/var/lib/mysql /var/lib

cPanel files and templates
rsync -avHz /old-drive/var/cpanel /var

SSl certificates
rsync -avHz /old-drive/usr/share/ssl /usr/share

User bandwidth
rsync -avHz /old-drive/var/log/bandwidth /var/log

Mail queue
rsync -avHz /old-drive/var/spool/cron /var/spool

Mysql root password
rsync -avHz /old-drive/root/.my.cnf /root

Home user information ( this will take some time if you have huge websites )
rsync -avHz --exclude=virtfs/ /old-drive/home/* /home

We need to recompile and rebuild some files after copy this

/scripts/upcp --force
/scripts/easyapache
/scripts/initquotas
/scripts/eximup --force
/scripts/mysqlup --force
/etc/init.d/cpanel restart
/scripts/restartsrv_apache
/scripts/restartsrv_exim
/scripts/restartsrv_named

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress