DD

How to clone an entire hard disk

dd if=/dev/sdc of=/dev/sdd bs=64K conv=noerror,sync

How to clone a partition

dd if=/dev/sdc1 of=/dev/sdd1 bs=128K conv=noerror,sync

make disk image

dd if=/dev/da0 conv=sync,noerror bs=128K | gzip -c > centos-core-7.gz

restore system

gunzip -c centos-core-7.gz | dd of=/dev/da0

Use remote storage

dd if=/dev/da0 conv=sync,noerror bs=128K | gzip -c | ssh user@server dd of=centos-core-7.gz

See progress while making an image with dd (dd with coreutils)

dd if=/dev/sdc1 of=/dev/sdd1 bs=128K conv=noerror,sync status=progress

copy MBR

dd if=/dev/sda of=/dev/sdb bs=512 count=1

Backup MBR and Extended Partitions Schema

dd if=/dev/sda of=/tmp/backup-sda.mbr bs=512 count=1
sfdisk -d /dev/sda > /tmp/backup-sda.sfdisk

Restore the MBR and the extended partitions

dd if=backup-sda.mbr of=/dev/sda
sfdisk /dev/sda < backup-sda.sfdisk
  • system/linux/dd.txt
  • Dernière modification: 2020/06/19 20:55
  • (modification externe)