1
I have a Linux box with RHEL. Its disk (hda1
) is has about 25GB of free space.
I have an another disk (hda2
) which is 250GB and contains another RHEL instance, partitioned for 200GB. Data on the disk occupies about 21GB.
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 image's size should be around 25GB 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
Will the above method make a gigantic image of 250GB? 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
I tried the second method; it's taking too long. What are the pitfalls of this method?
Which of the above method is more efficient and why? Is there any other Linux utility which can do the job? Third party tools are not an option.