55AA 表明一個16進制數,55是2個十六進制數,一個十六進制數佔4個二進制數,2個十六進制數佔8個二進制數,就是一個字節,AA又是一個字節,因此就是2個字節。centos
備份分區表bash
dd if=/dev/sda of=/data/dpt bs=1 count=66 skip=446
查看備份文件ui
od /data/dpt od -c /data/dpt od -a /data/dpt od -t c /data/dpt od -t x /data/dpt xxd /data/dpt hexdump -C /data/dpt
模擬分區表被破壞centos7
dd if=/dev/zero of=/dev/sda bs=1 count=2 seek=510
fdisk -l /dev/sda //看不到磁盤上的分區
lsblk //看到的是內存中的分區
注:分區表在內存中有一份,在磁盤上也有一份spa
恢復分區表.net
dd if=/data/dpt of=/dev/sda bs=1 count=2 skip=64 seek=510
備份分區表,將備份拷貝到另外一臺機器上3d
[root@Centos7 ~]# hostname -I 192.168.209.10 [root@Centos7 ~]# dd if=/dev/sda of=/data/dpt bs=1 count=66 skip=446 66+0 records in 66+0 records out 66 bytes (66 B) copied, 0.00114663 s, 57.6 kB/s [root@Centos7 ~]# scp /data/dpt 192.168.209.20:/data The authenticity of host '192.168.209.20 (192.168.209.20)' can't be established. RSA key fingerprint is SHA256:Qy4uErPG18xoJjdqFN4ARaVHJK7RrynZpgNMmTRg0Io. RSA key fingerprint is MD5:de:4b:ba:ac:0e:aa:3f:18:5d:fc:19:67:f3:5c:37:5c. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '192.168.209.20' (RSA) to the list of known hosts. root@192.168.209.20's password: dpt 100% 66 43.3KB/s 00:00
模擬分區表被破壞code
[root@Centos7 ~]# dd if=/dev/zero of=/dev/sda bs=1 count=64 seek=446 64+0 records in 64+0 records out 64 bytes (64 B) copied, 0.000589541 s, 109 kB/s
重啓,出現如下錯誤blog
從光盤啓動進入救援模式,還原分區表,將分區表同步到硬盤上,退出便可ip
多執行幾回 sync 命令,ctrl+d
[root@Centos7 ~]# uuidgen cdf4fd60-cdc1-4fa8-b7b2-18949dd05b92
parted /dev/sdb mklabel gpt
hexdump -C -n 512 -v /dev/sdb
[root@Centos7 ~]# parted /dev/sdb print
[root@Centos7 ~]# parted /dev/sdb mkpart primary 1 1000
[root@Centos7 ~]# parted /dev/sdb mkpart primary 1000 2000