Praji’s Weblog

Welcome to praji’s world

Data Restoration

leave a comment »

Data Restoration
---------------------------
I. Mount the backup Drive

First check to see if there are any drives mounted.
	df -h

You should get something simular to this if it isent mounted yet:

	[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:

	-bash-2.05b# 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
	-bash-2.05b#

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.

	fdisk -l

check for additional drives, in this tutorial we will use /dev/hdc3.

	mount /dev/hdc3 /mnt/old

now that the drive is mounted you can browse files like:

	ls /mnt/old/home

II. Check the Apache, PHP and MySQL version in the old disk.

Apache : /mnt/old/usr/local/apache/bin/httpd -v
PHP    : cat /mnt/old/usr/local/apache/conf/php*.version
MySQL  : /mnt/old/usr/sbin/mysqld --version

*** Recompile Apache-PHP through WHM *** to tally the versions.

III. Rsync the files

Do these commands one by one,

	rsync -vrplogDtH /mnt/old/usr/local/apache/conf /usr/local/apache
	rsync -vrplogDtH /mnt/old/var/named /var
	rsync -vrplogDtH /mnt/old/usr/local/cpanel /usr/local
	rsync -vrplogDtH /mnt/old/var/lib/mysql /var/lib
	rsync -vrplogDtH /mnt/old/var/cpanel /var
	rsync -vrplogDtH /mnt/old/usr/share/ssl /usr/share
	rsync -vrplogDtH /mnt/old/var/ssl /var
	rsync -vrplogDtH /mnt/old/usr/local/cpanel/3rdparty/mailman /usr/local/cpanel/3rdparty
	rsync -vrplogDtH /mnt/old/var/log/bandwidth /var/log
	rsync -vrplogDtH /mnt/old/usr/local/frontpage /usr/local
	rsync -vrplogDtH /mnt/old/var/spool/cron /var/spool
	rsync -vrplogDtH /mnt/old/home/* /home

Next Step - Get some important files from etc:

	cd /mnt/old/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 /etc

Now would be a good time to change your password for root:

	passwd

IV. Updating software and restarting services

*** Recompile Apache-PHP through WHM ***
	/scripts/upcp --force
	/scripts/sysup
	/scripts/fixeverything
	/scripts/eximup --force
	/scripts/mysqlup --force

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.

V. Restarting services

	/scripts/restartsrv_httpd
	/scripts/restartsrv_mysql
	/scripts/restartsrv_named
	/scripts/restartsrv_exim

PLEASE CHECK IF ALL THE SITES ARE WORKING FINE. ALSO MAKE SURE THAT THE FOLLOWING ARE WORKING FINE>

1. DNS
2. MAIL/WEBMAIL
3. DATABASE/PHPMYADMIN
4. FTP
5. APACHE/PHP

Advertisements

Written by praji

June 28, 2008 at 4:32 am

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: