How to Restore off a mounted slave disk (crash/hack/bad kern
I. Mount the backup Drive
First check to see if there are any drives mounted.
HTML Code:
[root@localhost root]# df -h
You should get something simular to this if it isent mounted yet:
HTML Code:
[root@localhost root]# df -h Filesystem Size Used Avail Use% Mounted on /dev/hda2 37G 1.4G 33G 4% / /dev/hda1 101M 7.7M 88M 9% /boot none 125M 0 125M 0% /dev/shm [root@localhost root]#
if it is mounted you will see something like this:
HTML Code:
[root@localhost root]# df -h Filesystem Size Used Avail Use% Mounted on /dev/hda3 53G 31G 20G 62% / /dev/hda1 99M 14M 80M 15% /boot none 248M 0 248M 0% /dev/shm /dev/hdc3 53G 31G 20G 61% /mnt/old [root@localhost root]#
As you can see hdc3 is the old drive, and it is mounted as /mnt/old. Yours will be diffent possibly. But keep in mind you need to know the mount point for the backup drive for the following steps.
Lets mount if not already mounted.
HTML Code:
[root@localhost root]# fdisk -l
Check for additional drives, in this tutorial we will use /dev/hdc3.
HTML Code:
[root@localhost root]# mount /dev/hdb3 /mnt/old
Now that the drive is mounted you can browse files like:
HTML Code:
[root@localhost root]# ls /mnt/old/home
II. Rsync the files
Do these commands one by one,
HTML Code:
[root@localhost root]# rsync -vrplogDtH /mnt/old/usr/local/apache/conf /usr/local/apache
[root@localhost root]# rsync -vrplogDtH /mnt/old/var/named /var
[root@localhost root]# rsync -vrplogDtH /mnt/old/home/* /home
[root@localhost root]# rsync -vrplogDtH /mnt/old/usr/local/cpanel /usr/local
[root@localhost root]# rsync -vrplogDtH /mnt/old/var/lib/mysql /var/lib
[root@localhost root]# rsync -vrplogDtH /mnt/old/var/cpanel /var
[root@localhost root]# rsync -vrplogDtH /mnt/old/usr/share/ssl /usr/share
[root@localhost root]# rsync -vrplogDtH /mnt/old/var/ssl /var
[root@localhost root]# rsync -vrplogDtH /mnt/old/usr/local/cpanel/3rdparty/mailman /usr/local/cpanel/3rdparty
[root@localhost root]# rsync -vrplogDtH /mnt/old/var/log/bandwidth /var/log
[root@localhost root]# rsync -vrplogDtH /mnt/old/usr/local/frontpage /usr/local
[root@localhost root]# rsync -vrplogDtH /mnt/old/var/spool/cron /var/spool
Next Step - Get some important files from etc:
HTML Code:
[root@localhost root]# cd /mnt/old/etc
[root@localhost root]# 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 /etc
III. Updating software and restarting services
HTML Code:
[root@localhost root]# /scripts/upcp
[root@localhost root]# /scripts/updatenow
[root@localhost root]# /scripts/sysup
[root@localhost root]# /scripts/fixeverything
[root@localhost root]# /scripts/exim4
[root@localhost root]# /scripts/easyapache
[root@localhost root]# /scripts/securetmp
This is needed to update cpanel information. Please note, sshd might fail and not start after running fixeverything. You have to login to whm, and go to the rpm installer and "FORCE" install opensshd-server, opensshd, opensshd-client and then restart sshd from whm.
IV. Restarting services
HTML Code:
[root@localhost root]# /scripts/restartsrv httpd
[root@localhost root]# /scripts/restartsrv cpanel
[root@localhost root]# /scripts/restartsrv mysql
[root@localhost root]# /scripts/restartsrv named
[root@localhost root]# /scripts/restartsrv exim
After you are pleased that everything is working fine, restart the entire server.
This tutorial works 100% on redhat, 7.3, 8.0, 9.0 and fedora. it has been tested on those boxes. But remember, if you dont know what your doing them hire someone to check your server out.
|