Dump all disk (include vd[a-z]) on Linux (work for mbr and gpt disk)

This commit is contained in:
Victor LABORIE 2017-03-27 11:33:58 +02:00
parent 8c4be9fc0d
commit d8b6fe9d87

View file

@ -135,8 +135,12 @@ mkdir -p -m 700 /home/backup
## Dump MBR / table partitions with dd and sfdisk
## Linux
# dd if=/dev/sda of=/home/backup/MBR bs=512 count=1 2>&1 | egrep -v "(records in|records out|512 bytes)"
# sfdisk -d /dev/sda > /home/backup/partitions 2>&1 | egrep -v "(Warning: extended partition does not start at a cylinder boundary|DOS and Linux will interpret the contents differently)"
#for disk in $(ls /dev/{s,v}d[a-z] 2>/dev/null); do
# name=$(basename $disk)
# dd if=$disk of=/home/backup/MBR-$name bs=512 count=1 2>&1 | egrep -v "(records in|records out|512 bytes)"
# fdisk -l $disk > /home/backup/partitions-$name
#done
#cat /home/backup/partitions-* > /home/backup/partitions
## OpenBSD
# disklabel sd0 > /home/backup/partitions