Fast Disk Cloning [closed] Fast Disk Cloning [closed] linux linux

Fast Disk Cloning [closed]


Commodore Jaeger is right about:

dd if=/dev/sda of=/dev/sdb bs=1M

Also, adjusting "readahead" on the drives usually improves performance. The default may be something like 256, and optimal 1024. Each setup is different, so you would have to run benchmarks to find the best value.

# blockdev --getra /dev/sda256# blockdev --setra 1024 /dev/sda# blockdev --getra /dev/sda1024# blockdev --helpUsage:  blockdev -V  blockdev --report [devices]  blockdev [-v|-q] commands devicesAvailable commands:    --getsz (get size in 512-byte sectors)    --setro (set read-only)    --setrw (set read-write)    --getro (get read-only)    --getss (get sectorsize)    --getbsz    (get blocksize)    --setbsz BLOCKSIZE  (set blocksize)    --getsize   (get 32-bit sector count)    --getsize64 (get size in bytes)    --setra READAHEAD   (set readahead)    --getra (get readahead)    --flushbufs (flush buffers)    --rereadpt  (reread partition table)    --rmpart PARTNO (disable partition)    --rmparts   (disable all partitions)#


You might try increasing the block size using the bs argument; by default, I believe dd uses a block size equal to the disk's preferred block size, which will mean many more reads and writes to copy an entire disk. Linux's dd supports human-readable suffixes:

dd if=/dev/sda of=/dev/sdb bs=1M


The fastest for me:

dd if=/dev/sda bs=1M iflag=direct | dd of=/dev/sdb bs=1M oflag=direct

reaches ~100MiB/s, whereas other options (single process, no direct, default 512b block size, ...) don't even reach 30MiB/s...

To watch the progress, run in another console:

watch -n 60 killall -USR1 dd