6

I have two non-networked servers, each with 1.2TB of storage in a RAID5 config on an LSI MegaRaid 9240-8i controller. I have been trying without success to get Symantec Ghost to image one machine to the other due to driver issues, and so I was wondering if it wouldn't be easier to boot from a Linux LiveCD, plug in an external hard disk and dd the RAID partition to the external disk.

The 1.2TB partition only has around 10GB of data on it, so I hope to generate a sparse image file (to avoid having to find a 1.2TB USB disk!). I have seen people use the seek parameter of dd to achieve this - is that an appropriate way to create an image of around 10GB size in this situation?

Even if this is a sensible way to generate a sparse image, is this a sensible way to mirror one RAID to another of identical configuration, or do the commercial utilities such as Ghost and Acronis do some 'magic' that dd does not?

1

3 Answers 3

12

Sounds like the device is remote. Assuming linux...

ssh remote_host 'dd if=/dev/sdb1' | cp --sparse=always /proc/self/fd/0 new-sparse-file

If local...

dd if=/dev/sdb1 | cp --sparse=always /proc/self/fd/0 new-sparse-file

This gives you an image that is mountable. However, if you pulled it across the network then you had 1.2 TB of network traffic (usually a bottleneck) and the CPU load of ssh and sshd.

If you are pulling that much across a network and network traffic costs you money...

ssh remote_host 'dd if=/dev/sdb1 | gzip ' | gunzip | cp --sparse=always /proc/self/fd/0 new-sparse-file
1
  • 6
    Really good answer (and should be marked as the answer, as well). I'd suggest using shell's <() instead of /proc/…, though, like: cp --sparse=always <(ssh remote_host dd if=/dev/sdb1) destfile. And if there're lots of zeroes inside, ssh -C can be handy.
    – poige
    Oct 10, 2012 at 22:15
1

dd can create a sparse file, but you would have to manually tell it to copy every extent of used sectors in the filesystem, and you aren't going to do that.

What you are looking for is either Ghost4Linux, or clonezilla, both of which can be found on the Parted Magic live cd. They are smart enough to create an image file that only contains the used data, similar to Norton Ghost.

I still suggest that you use a proper backup tool like tar or dump instead of trying to image the drive. The down sides to image backup include:

  1. Can't selectively backup certain files
  2. Can't selectively restore certain files
  3. Can't restore to a smaller drive, even if it is large enough to contain the used data
  4. Can't do incremental backups
2
  • Thanks - none of those down-sides are an issue with this specific job, but the Parted Magic CD certainly looks like a handy thing to have around, so I'll give G4L and Clonezilla a try.
    – Ian Renton
    Nov 28, 2011 at 21:56
  • I can accept, I can't upvote until I have 15 rep :)
    – Ian Renton
    Nov 29, 2011 at 6:14
0

If it is 10GB of data and because of that mostly 0x00s, you could do:

cat /dev/mydevice | gzip > /media/myusbdevice/image.dmp.gz

Add -1 to gzip to speed things up a little.

1
  • 2
    Unused sectors don't necessarily contain all zeroes. You could dd /dev/zero to a file until it uses up all free space on the disk, then delete it, and that would leave most of it filled with zeros, but when you try to restore this image, a lot of time will be wasted writing out all of those zeroes.
    – psusi
    Nov 28, 2011 at 15:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .