Recover cPanel from crashed OS/hard disk

cpanel-crashed-disk-recovery

Sometimes operating system or hard drive crashes and makes your system un-bootable. Don’t panic. There are still chance that you recover all or most of your data. Call you data center and ask them to install OS on a new hard disk and mount your crashed disk as secondary drive. Once your server is up and running on the new operating system. Install cPanel on it and mount the old hard disk.

mkdir /mnt/OldDisk
mount /dev/sdb1 /mnt/OldDisk
mount /dev/sdb2 /mnt/OldDisk/home
mount /dev/sdb3 /mnt/OldDisk/var

Now rsync all the data from crashed disk to new disk.

rsync -vrplogDtH /mnt/OldDisk/usr/local/apache/conf /usr/local/apache
rsync -vrplogDtH /mnt/OldDisk/var/named /var
rsync -vrplogDtH /mnt/OldDisk/home/* /home
rsync -vrplogDtH /mnt/OldDisk/usr/local/cpanel /usr/local
rsync -vrplogDtH /mnt/OldDisk/var/lib/mysql /var/lib
rsync -vrplogDtH /mnt/OldDisk/var/cpanel /var
rsync -vrplogDtH /mnt/OldDisk/usr/share/ssl /usr/share
rsync -vrplogDtH /mnt/OldDisk/var/ssl /var
rsync -vrplogDtH /mnt/OldDisk/usr/local/cpanel/3rdparty/mailman /usr/local/cpanel/3rdparty
rsync -vrplogDtH /mnt/OldDisk/var/log/bandwidth /var/log
rsync -vrplogDtH /mnt/OldDisk/usr/local/frontpage /usr/local
rsync -vrplogDtH /mnt/OldDisk/var/spool/cron /var/spool
rsync -vrplogDtH /mnt/OldDisk/root/.my.cnf /root
rsync -vrplogDtH /mnt/OldDisk/etc/httpd/conf/httpd.conf /etc/httpd/conf

Now rsync the configuration files.

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

Now change the root password again as you have now replaced the passwd file

#passwd
Changing password for user root.
New password:

Force update the cpanel and run easyapache

/scripts/upcp --force
/scrtips/easyapache --force

Restart all the services

#/scripts/restartsrv httpd
#/scripts/restartsrv cpanel
#/scripts/restartsrv mysql
#/scripts/restartsrv named
#/scripts/restartsrv exim
Show 1 Comment

1 Comment

  1. Here the recovery of the cPanel is very informative. In the server cPanel is a very important tool web site. Here command is very precise and informative. Very knowledgeable.

Comments are closed