Clonar HD com Linux DD

Simple copying one SSD to another one. Make sure about the sda and the sdb for not clone on oposite way, somentimes the sdb is the main one:

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

Some blogs says to add status=progress for see the progress but I never tested.

==========================================

Skipping the erros:

dd if=/dev/sda of=/dev/sdb bs=4096 conv=sync,noerror

This will copy the disk, and skip blocks with errors, which is very important.
These are the basic and essential options for using dd to clone or rescue a disk.

=========================================
Export and after import:

To save space, you can compress data produced by dd with gzip, e.g.:

dd if=/dev/hdb | gzip -c  > /image.img.gz

You can restore your disk with:

gunzip -c /image.img.gz | dd of=/dev/hdb

To save even more space, defragment the drive/partition you wish to clone beforehand (if appropriate), then zero-out all the remaining unused space, making it easier for gzip to compress:

mkdir /mnt/hdb
mount /dev/hdb /mnt/hdb
dd if=/dev/zero of=/mnt/hdb/zero

Wait a bit, dd will eventually fail with a “disk full” message, then:

rm /mnt/hdb/zero
umount /mnt/hdb
dd if=/dev/hdb | gzip -c  > /image.img.gz

Also, you can get a dd process running in the background to report status by sending it a signal with the kill command, e.g.:

dd if=/dev/hdb of=/image.img &
kill -SIGUSR1 1234

Deixe um comentário