We have 2 server one is old server like 4 year old other one is just brought both the hardware is similar, on the old server we using centos 4.5 last 1900days old server is not rebooted.
Now we want to make clone without reboot old server (oldserver = serverone)all production data is there on serverone with that we wanted to clone.
We had work around like as follow:-
SERVERONE as root
tar cfl /boot /tmp/boot.tar
tar cfl /(root) /tmp/root.tar
tar cfl /data /tmp/data.tar
SERVERTWO as rescue mode using 1st cd of centos
fdisk -l /dev/sda
creating new partition
/dev/sda1 * /boot 300MB (same as serverone)
/dev/sda2 <swap> 2G
/dev/sda3 /
fdisk -l /dev/sdb
creating new paration
/dev/sdb1 /data
mkfs.ext3 /dev/sda1
mkfs.ext3 /dev/sda3
mksf.ext3 /dev/sdb1
mkswap /dev/sdb2
From SERVERTWO
cd /dev/sda1
scp root@serverone:/tmp/boot.tar .
cd /dev/sda3
scp root@serverone:/tmp/root.tar .
cd /dev/sdb1
scp root@serverone:/tmp/data.tar .
cd /dev/sda1
tar xf boot.tar
cd /dev/sda3
tar xf root.tar
cd /dev/sdb1
tar xf data.tar
chroot /mnt/root
grub-install
please help me if you any suggestion for above work around or any tools which make .iso of live and we can use on servertwo.
Best Answer
If you back up your data like this and processes are still writing to disk files, you'll risk inconsistencies (files not archived since they were written/changed after the tar run has already completed the directory).
To avoid this, you should make sure that nothing is writing to your disks. To do that in turn, you would need to end all processes having open write handles on your filesystems (
lsof /mountpoint | egrep '[0-9]+[wu]'
will be of help here) and remount the filesystems read-only (mount -o remount,rw /mountpoint
). At this occasion, you might want to runfsck /mountpoint
to check fpr filesystem errors. After that, you could simply usedd
to make a byte-for-byte clone.This way you would avoid a reboot, but nontheless you would have downtime for all meaningful services on that server.