Link to home
Start Free TrialLog in
Avatar of Thyagaraj03
Thyagaraj03

asked on

Clone ubuntu system and auto replicate the changes

Is it possible to clone a ubuntu server and if any changes made to original system must be replicated to the one cloned?. This I need to have backup support if original one gets down. In my point the ubuntu is a cloud server.

I tried "ddrescue /dev/sda /dev/sdb" on my vbox and it worked fine. The confusion is that from which disk it boots and will I have multiple boot entries at the startup?. Is it possible to use ddrescue to clone the remote hard disk?.

I want to replicate the changes made on orginal hard disk to the duplicate and so I thought of scheduling a cron job using "rsync" but after system restart the devices /dev/sda and /dev/sdb might be interchanged and it may cause problem.

For cloning, taking the server off for few minutes/hrs is mandatory?. Can't I accomplish this without taking the server off?. It should not cause any problem to the orginal disk
 plz guide me step by step.
ASKER CERTIFIED SOLUTION
Avatar of jonmchan
jonmchan
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Thyagaraj03
Thyagaraj03

ASKER

It seems a bit difficult to understand DRBD. If possible could you guide me step by step.
DRBD is not a simple system. If you do not fully understand how it works, when or if something breaks, you will be in serious trouble. The only thing  can recommend is for you to read the manual:

http://www.drbd.org/docs/about/

and to read tutorials how to setup drbd such as this one:

http://thnetos.wordpress.com/2007/06/18/drbd-and-heartbeat-for-high-availability-on-linux/
Ok it will take some time to read and I'll try to understand DRBD. It's good.

 Again what happens if I use 'ddrescue' without taking the server offline?. I did like this on my vbox virtual machine and I've my virtual hard disk cloned. Would it cause any problem to orginal disk?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
@Thyagaraj03:  Again what happens if I use 'ddrescue' without taking the server offline?. I did like this on my vbox virtual machine and I've my virtual hard disk cloned. Would it cause any problem to orginal disk?

The original disk will not be damaged, but your backup will have a high probability of not being usable.

Consider this:

Server1Online - you start dd_rescue, dd_rescue starts copying the contents of your mysql database files;
mysql writes to the database
Backup has half the unmodified database and then half of the new database <- in this case, mysql will not start anymore.

This is a relatively good case, what is worse is the filesystem makes changes... the file system will be corrupt and unbootable.

Use the partimage software from http://www.partimage.org to clone the other server and then use rsync to update using cron...
I think DRBD would suit well for my requirement as suggested by 'johnmchan' here. I'm trying this on my virtual machines and I'm getting some errors while making primary. I hope DRBD will not harm file system, is it?.
I have a bit idea of DRBD but do not understand what is 'heartbeat' and what's the difference between DRBD and heartbeat
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I think I'll have to add a separate partition/hard disk to promote DRBD on each system. I didn't understand, won't I have complete / directory replicated between 2 servers. I followed the links:

https://wiki.ubuntu.com/Testing/Cases/UbuntuServer-drbd
https://help.ubuntu.com/9.04/serverguide/C/drbd.html
If all the systems have same configuration, clone the disk and apply it to all of them, try it on one system , if it works do it for all, it might save u a lot of time.
Avatar of madunix
1- use Mondo Rescue to clone linux systems: http://www.mondorescue.org
in order to image your system and create bootable CD/DVD download mondo for your distro
ftp://ftp.mondorescue.org  more info read this manual
http://www.mondorescue.org/docs/mondorescue-howto.pdf

2- You can use dd also. dd if=/dev/somedisk of=/dev/somedestination

3- rsync scripting

4- netcat
On the source server: (cd / && tar -cvf - ) | nc 192.168.1.2 2000
On the destination:: nc -l -p 2000 | tar -xvf -
You can also use partimage http://www.partimage.org this is similar to ghost but has more intelligence as follows

Fast. Since file fragments are not "hunted down" head movement is minimized allowing optimal use of the disk's cache.

Fast. Since only allocation clusters which are in use is read and saved.

Read only. None of the data being backed up is modified. This includes meta-data like last-access date. Preserves integrity of source partition.

Multi file synchronization. If there are multiple files that make up a fileSet, no file in the set will be out of sync with the other files.

Destination flexibility. Backup media can be a file on another partition on the same disk, another local disk or a network attached file.

Fast Restore. Data is simply flowed onto the disk optimizing the disk cache and minimizing disk seek time.

Simple restore. There is only one media to restore. No decision regarding order of restoring multiple back media.

No recover of deleted files. Files that were deleted at the time of the backup are not on another media that needs to be restored causing deleted files be resurrected

"Accounting is unaffected".

recovery to alternate partition Excellent choice for mirroring the file system on another disk or at another location.

regards
I'll try this.
This question has been classified as abandoned and is being closed as part of the Cleanup Program. See my comment at the end of the question for more details.