Disk cloning
Disk cloning is the process of making an image of a partition or of an entire hard drive. This can be useful for copying the drive to other computers and for
backup and
recovery purposes.
https://wiki.archlinux.org/index.php/Disk_cloning
dd if=/dev/sda1 of=/dev/sdb1 bs=512 conv=noerror,sync
Cloning a partition
From physical disk /dev/sda
, partition 1, to physical disk /dev/sdb
, partition 1.
# dd if=/dev/sda1 of=/dev/sdb1 bs=512 conv=noerror,sync
Warning: If output file of=
(sdb1
in the example) does not exist, dd will create a file with this name and will start filling up your root file system!
Cloning an entire hard disk
From physical disk /dev/sdX
to physical disk /dev/sdY
# dd if=/dev/sdX of=/dev/sdY bs=512 conv=noerror,sync
This will clone the entire drive, including the MBR (and therefore bootloader), all partitions, UUIDs, and data.
noerror
instructs dd to continue operation, ignoring all read errors. Default behavior for dd is to halt at any error.
sync
fills input blocks with zeroes if there were any read errors, so data offsets stay in sync.
bs=512
sets the block size to 512 bytes, the "classic" block size for hard drives. If and only if your hard drives have a 4 Kib block size, you may use "4096" instead of "512". Also, please read the warning below, because there is more to this than just "block sizes" -it also influences how read errors propagate.
Warning: The block size you specify influences how read errors are handled. Read below.
沒有留言:
張貼留言