Friday, October 1, 2010

Recovering files/settings from a cPanel server from a Harddisk failure/Crash


Bad things happen...Same is the case with a server, Suppose you have a cPanel server and one fine morning, you get this alert.. Site DOWN!!!

oops your hdd crashed? well dont panick... contact your datacentre and get the same OS installed on a new hdd, lets do the data recovery real fast!


Once the server is UP with new OS, install cPanel and connect your old hdd as slave and mount it to /oldHD





# mount /dev/sdb1 /oldHD

Run these rsync commands to move everything over;


# rsync -vrplogDtH /oldHD/usr/local/apache/conf /usr/local/apache
# rsync -vrplogDtH /oldHD/var/named /var
# rsync -vrplogDtH /oldHD/home/* /home
# rsync -vrplogDtH /oldHD/usr/local/cpanel /usr/local
# rsync -vrplogDtH /oldHD/var/lib/mysql /var/lib
# rsync -vrplogDtH /oldHD/var/cpanel /var
# rsync -vrplogDtH /oldHD/usr/local/cpanel/3rdparty/mailman /usr/local/cpanel/3rdparty
# rsync -vrplogDtH /oldHD/var/log/bandwidth /var/log
# rsync -vrplogDtH /oldHD/usr/local/frontpage /usr/local
# rsync -vrplogDtH /oldHD/var/spool/cron /var/spool
# rsync -vrplogDtH /oldHD/root/.my.cnf /root
# rsync -vrplogDtH /oldHD/etc/httpd/conf/httpd.conf /etc/httpd/conf
# rsync -vrplogDtH /oldHD/etc/sysconfig/network /etc/sysconfig



almost done.. now some configuration files need to be copied.

go to the old etc directory


# cd /oldHD/etc
# rsync -vrplogDtH secondarymx domainalias valiases vfilters exim* proftpd* pure-ftpd* passwd* group* *domain* *named* wwwacct.conf cpupdate.conf quota.conf shadow* *rndc* ips* ipaddrpool* ssl hosts /etc

Once this is complete run



# /scripts/fixeverything
# /scripts/upcp –force
# /scripts/easyapache
everything should be working fine now :) 

1 comment:

  1. please note that the root password will be reset back to the old one..

    ReplyDelete