Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a linux box having RHEL. Its disk (hda1) is having free space of about 25GB.

I have an another disk (hda2) which is of 250GB having another RHEL instance, it's partitioned for 200GB. Data on the disk occupies about 21GB of data.

The image of hda2 needs to be taken and restored on other disk of same specs. What is the best way to make image file of the hda2?

Ideally the images size should be around 25GBs as the actual data on the disk is just 21GB.

I am aware about the following two methods.

Method 1 : Raw Image

dd if=/dev/hda2 of=/path/to/image
dd if=/path/to/image of=/dev/hda3

Question 1 : Will the above method make a gigantic image of 250GBs? Is it efficient?

Method 2 : Compressed Image.

dd if=/dev/hda2 | gzip > /path/to/image.gz
gzip -dc /path/to/image.gz | dd of=/dev/hda2

Question 2 : I tried the method 2, its taking too long. What are the pit falls of this methods?

Which of the above method id efficient and why? Is there any other Linux utility which can do the job? Third party tools are no no.

share|improve this question
Sounds like you could use some lot better method if you 1) told us what you are actually trying to achieve and 2) tell us what is 'a third party tool' in your case. Is it OK for you to install something from RHEL repos? Would CloneZilla do? – Janne Pikkarainen Sep 25 '12 at 8:34
I need to make copy of our server and restore the image each time we buy a new server of same specs. We do that about 5 times a week. CloneZilla will not do :( I know about Norton Ghost, but that wont do either. – TheProfoundGeek Sep 25 '12 at 8:37
And this is a live server you are going to dd? Did you know that your method does NOT guarantee you consistent, usable disk images? – Janne Pikkarainen Sep 25 '12 at 8:44
No Man, as you can see, the hda2 is extracted from a master server once its setuped. And then the hda2 is attached to another box (the box with hda1) and then the image of hda2 is saved on hda1. Hope it solves the confusion. – TheProfoundGeek Sep 25 '12 at 8:51
To make it clear, hda1 and hda2 are the same (IDE) disk. hda1 is the first partition, hda2 the second. Do you mean hdb1 (first partition of second disk)? – Norky Oct 31 '12 at 11:31

Both methods are inefficient - RAW Disk image will have same size. Compressed RAW image will compress unused disk blocks too, these blocks will contain random data, thus increasing compression time and resources, still size can be larger than real usage, especially in environments, where disk usage is heavy. Of course, you can use some utilities and clear unused blocks with zeros, but still, you will need to recheck whole disk during this and again, you still need to read it completely - even if you are using 1 GB of 250 GB - you are about to read all 250 GB.

There are good things (tm) called file copying, tar and gzip :) Just preserve attributes, time etc during this. The only difference can be with MBR and boot. If you are doing this with regular partition - no problem, just preserve and copy/targz. Time/resource efficient compression methods are gzip and xz.

For 3rd party cloning utilities I can recommend CloneZilla, which does everything you need, just check limitations, for manipulating - PartedMagic suite, for recovery - RIPLinux suite.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.