Does dd copy everything, including all metadata and all “empty” blocks

block-devicedd

Suddenly something was messed up with my partitions, or just one partition. I have a default Ubuntu installation, on a Kingston SSD, with the root file system encrypted with LUKS, (using AES I think). Now I'm trying to mount the partition from a live cd, but without luck.

I am so afraid of doing some additional harm that can not be undone. So I would like to make an exact copy of the drive. That means all partiton tables, whatever kind of metadata for the LUKS partition, and well any other kind of metadata that I don't know of. I guess I want all the empty blocks too, to feel absolutely safe.

I know about dd if=/dev/sda of=/dev/sdb, but I don't know if it will include all the data described.

Perhaps I need to specify block size with -b, but I don't understand how that works and why it is necessary (if it is). And I also don't know how to find the block size of the partition.

Please tell me if it does copy all data, and if not, if there is another way.

Best Answer

Yes it does, even the blocks that would not (officially) contain data and also all information regarding partitions, UUIDs, etc..

E.g. recovery of data (i.e. after deleting files) from the dd-copied drive would be possible.

You may want to read this regarding the noerror and sync options.

Block size (bs=) doesn't affect the result unless there are read errors, but you should set it to "1M" (or at least "4k") or it will take longer for no good reason.

Related Question