I have a disc with several partitions on, each of which has a different kind of file system (ext3, ext4, and, let's say, NTFS). I want to know if I can copy the whole disc to a new one (which is of larger capacity) using dd
, preferably in a single operation.
To forestall unnecessary effort, let me clarify a few things. I'm not interested in other ways to do it (I know the right way, and third-party software is not desirable). I'm not all that interested in theoretical answers ("it ought to work"). I'm extremely interested in anyone else's experiences trying to do such a thing.
I know the real right answer is "try it and see", but I'm 250 miles from the disc in question.
If you have to do this, and you have to be in a really bad place to even think about doing this...
It's safest to copy the partitions individually. For instance:
Wait a few minutes or hours for the copy to complete, and then begin your recovery from the disk images. For instance, on a new disk you may create a new partition table with partitions of the correct size to hold the disk images, and then
dd
the images back out to the new partitions.Copying the entire disk (e.g.
dd if=/dev/sdb
) makes things more complicated, since you then have a full disk image you will probably have to split out into partitions somehow anyway. And if you're thinking ofdd
ing the entire drive directly to another physical disk, think again: sometimes you'll just lose when the system refuses to acknowledge that the partition table and the new hard drive have anything to do with each other.If you must copy the entire disk in one shot (you likely don't have to, so don't think about this) then copy it to an image file and use
kpartx
to work with the partitions. For instance:If the physical disk is having physical trouble, consider using
dd_rescue
instead (though you didn't really ask about that).