Monday 3 December 2012

Server Restore from secondary disk


1)After reinstalling cpanel, first confiigure WHM.

2)Mount old drives

3)Take backup of the following.

 /var/cpanel
 /etc/passwd
 /etc/shadow
 /etc/group
 /var/named

4)First restore /var/cpanel
 cp -rpf /oldvar/cpanel/* /var/cpanel

5)Please take little care while doing this step
Take the backup of old /etc/passwd, /etc/shadow, /etc/group
 cp -rp

Edit backup of old etc/passwd.
Remove the Entires which are currentlly present in new /etc/passwd

 Save the file. cat /olddrive/etc/passwd.bkp >>/etc/passwd

 do the same for shadow and group

Note:After doing the above step please make sure that you are able to login to server.

6) run /scripts/updateuserdomains
This will restore /etc/userdomains

7) Named restore
Restore named from the olddrive
 cp -rpf /olddrive/var/named/* /var/named/

 run /scripts/rebuildnamedconf
 /scripts/fixndc

check whether named is running and named.conf is updated.

Cool Apache restore
 /scripts/rebuildhttpdconf >> /root/httpd
 append /root/httpd to httpd.conf
 restart httpd

9)Restore Home
 copy the oldhome to the new home.

At this point domains will start working

10) restore mysql
 copy the /oldvar/lib/mysql to /var/lib/mysql

11) FTP
 copy the old proftpd /old/etc/proftpf

12)Mail
 restore /etc/valiases and /etc/vfiilters

13)Restore the following
 /etc/ips, /etc/quota.conf, /etc/ssl, /etc/domainaliases, /etc/remotedomains /etc/reservedips, /usr/share/ssl, /var/log/bandwidth,
 /var/spool/cron , /usr/local/cpanel/3rdparty/mailman.

Thats it……..

If the mysql does not start then check the error log at
 tail -100 /var/lib/mysql/servername.com.err

Sometimes the permission of the mysql directories and files will not be correct. Correct that and everything will work fine.