Friday 8 March 2019

Clone multiple-partition SD card with dd

List the disks and partitions
fdisk -l

Assuming that the sdcard is /dev/sdb with partitions /dev/sdb1 and /dev/sdb2

Unmount the partitions
umount /dev/sdb1
umount /dev/sdb2

Backup the partition table & MBR
dd if=/dev/sdb of=partitiontable.img bs=512 count=1

Backup the partitions
dd if=/dev/sdb1 of=partition1.img
dd if=/dev/sdb2 of=partition2.img

Restore the partition & MBR

Restore the partitions
sudo dd if=partitiontable.img of=/dev/sdb
sudo dd if=partition1.img of=/dev/sdb1
sudo dd if=partition2.img of=/dev/sdb2

Attempt 2
umount /dev/sdb1
umount /dev/sdb2
dd if=/dev/sdb of=sdb.img bs=4M conv=noerror,notrunc status=progress

No comments:

Post a Comment