Today I got another issue of crashed hard-disk. The clients data center installed cPanel on new hard disk and attached the old hard disk as secondary device. Unfortunately if it happens on your server you can use the below steps to restore the data.
mount the old hard disk
[bash]
mkdir /mnt/oldhd
mkdir /mnt/oldhd/usr
mkdir /mnt/oldhd/var
mount /dev/sdc1 /mnt/oldhd
mount /dev/sdc2 /mnt/oldhd/usr
mount /dev/sdc3 /mnt/oldhd/var
[/bash]
Now copy the configuration files from the crashed harddisk
[bash]
cd /mnt/oldhd/etc
rsync -vrplogDtH secondarymx valiases vfilters /etc
rsync -vrplogDtH exim* proftpd* pure-ftpd* passwd* group* /etc
rsync -vrplogDtH *domain* *named* wwwacct.conf cpupdate.conf /etc
rsync -vrplogDtH quota.conf shadow* *rndc* ips* ipaddrpool* ssl hosts /etc
rsync -vrplogDtH true* userdomains nameserverips demousers localaliases /etc
[/bash]
NOTE: Since we copied the passwd file the root password of the new server will will now be same as that of old server. If you want you can reset it using passwd command
Now copy the data from the old hard disk
[bash]
rsync -vrplogDtH /mnt/oldhd/usr/local/apache/conf /usr/local/apache
rsync -vrplogDtH /mnt/oldhd/root/.my.cnf /root
rsync -vrplogDtH /mnt/oldhd/etc/httpd/conf/httpd.conf /etc/httpd/conf
rsync -vrplogDtH /mnt/oldhd/etc/sysconfig/network /etc/sysconfig
rsync -vrplogDtH /mnt/oldhd/var/log/bandwidth /var/log
rsync -vrplogDtH /mnt/oldhd/usr/local/frontpage /usr/local
rsync -vrplogDtH /mnt/oldhd/var/spool/cron /var/spool
rsync -vrplogDtH /mnt/oldhd/root/.my.cnf /root
rsync -vrplogDtH /mnt/oldhd/etc/httpd/conf/httpd.conf /etc/httpd/conf
rsync -vrplogDtH /mnt/oldhd/etc/sysconfig/network /etc/sysconfig
rsync -vrplogDtH /mnt/oldhd/etc/dovecot /etc
rsync -vrplogDtH /mnt/oldhd/etc/dovecot /etc
rsync -vrplogDtH /mnt/oldhd/var/named /var
rsync -vrplogDtH /mnt/oldhd/home/* /home
rsync -vrplogDtH /mnt/oldhd/usr/local/cpanel /usr/local
rsync -vrplogDtH /mnt/oldhd/var/lib/mysql /var/lib
rsync -vrplogDtH /mnt/oldhd/var/cpanel /var
rsync -vrplogDtH /mnt/oldhd/usr/share/ssl /usr/share
rsync -vrplogDtH /mnt/oldhd/etc/ssl /etc/
rsync -vrplogDtH /mnt/oldhd/var/ssl /var
rsync -vrplogDtH /mnt/oldhd/usr/local/cpanel/3rdparty/mailman /usr/local/cpanel/3rdparty
[/bash]
Now update the cPanel and other softwares and recompile the apache and it’s done.
[bash]
/scripts/upcp
/scripts/updatenow
/scripts/sysup
/scripts/fixeverything
/scripts/eximup –force
/scripts/easyapache
[/bash]
Leave a Reply