Under windows system I'm used to create an image of HD with driveImageXML.

What's the best approach to have an Image of the hard-drive containing the OS, with Ubuntu Server?

I'd like to have a snapshot of the current configuration so If ever happens that the primary disk will fail I could simply restore this image on a new HD, unplug the broken one, plug the newly created. Saving me days on setting up and reconfigure the whole Unix server.

edit:
I've found also this on ubuntu forums, taking SU privileges you can just launch the following command:

3 Answers
3

If you simply want a pure one time snapshot (cloned image) of your drive you can use the dd utility. This utility takes an image of the entire drive. Thus if your drive (partition) is 500mb then your snapshot will also be 500mb.

However if you want to keep an ongoing backup of all the data on the drive you could use a utility like rsync (or rsnapshot).

dd utility could be fine for my case. But I'm kind of worried about the restore part. If I'll execute again the dd command from the backup image file as input and the newly installed and formatted Disk as output: will my system boot again from this new disk? Or I'll need to do something more to make it boot?
–
kanteApr 10 '13 at 16:06

If you use dd, it can create an image of the entire drive. Thus, if you restore that image to a new drive it will wipe the new drive and replace it with the contents of the dd image. Thus, the new drive will be an exact duplicate of the image. This means that if the drive was bootable, it should still be bootable. However, if there are other drives/partitions that this drive relies on for booting it would still require those to exist.
–
SunSparcApr 10 '13 at 16:13

Might I also suggest that if you are worried about losing data you should also consider keeping an online backup of your data. There are many online backup services (eg CrashPlan, Mozy, Carbonite, etc). These will not restore a drive image but they will allow you to restore your data.
–
SunSparcApr 12 '13 at 16:07

If you want to protect against data corruption, you need a regular backup system; taking disk images is most likely not the best way to achieve this. There are a hundred and one "network backup systems", and in the Linux world a dozen that use rsync; dirvish is my current personal favourite but has its limitations.

If you want to protect against other hardware failure or have some sort of disaster recovery path, a disk image might be the right option; note that reinstalling GRUB is really not that hard.

Many thanks, to answer you: once it happened that the Mobo of this server stop functioning, and I got scared because differently from the data that is located on a RAID1 configuration inside the server, the system is on a third single HD. I got scared the disk was broken. That would have been a bad situation because i don't have any backup of it. So just in case... I'd like to have a backup image of this disk to copy in a new one, unplug the broken, plug the new turn the server on as nothing happened...
–
kanteApr 11 '13 at 7:22