如何使用wipefs命令擦除磁盘上的元数据/签名

每个磁盘和分区上都有某种签名和元数据。

你可以使用wipefs命令查看分区表签名/元数据,wipefs命令可以擦除文件系统,RAID或分区表签名/元数据。

显示磁盘当前签名。

[root@]# wipefs /dev/sda
DEVICE OFFSET TYPE UUID LABEL
sda 0x1fe dos
[root@]# wipefs /dev/sdc
DEVICE OFFSET TYPE UUID LABEL
sdc 0x2baa1474000 linux_raid_member f90b664f-0f49-a4f6-9350-216a04988a72 r51:0
[root@]# wipefs /dev/sdd
DEVICE OFFSET TYPE UUID LABEL
sdd 0x2baa1474000 linux_raid_member f90b664f-0f49-a4f6-9350-216a04988a72 r51:0

 

 

如何使用wipefs删除磁盘的签名

[root@]# wipefs -a -f /dev/sdc
/dev/sdc: 4 bytes were erased at offset 0x2baa1474000 (linux_raid_member): fc 4e 2b a9


[root@]# wipefs -a -f /dev/sdd
/dev/sdd: 4 bytes were erased at offset 0x2baa1474000 (linux_raid_member): fc 4e 2b a9

也可以备份一个签名到$HOME目录下,并清空磁盘的签名:

[root@]# wipefs -a -f -b /dev/sda

/dev/sda: 2 bytes were erased at offset 0x000001fe (dos): 55 aa

如何恢复签名信息:

[root@]# dd if=~/wipefs-sda-0x000001fe.bak of=/dev/sda seek=$((0x000001fe)) bs=1 conv=notrunc

2+0 records in

2+0 records out

2 bytes copied, 0.0007176 s, 2.8 kB/s

 

如果有raid信息,先把raid停用,然后在使用wipefs删除

[root@]# wipefs /dev/sdc
DEVICE OFFSET TYPE UUID LABEL
sdc 0x2baa1474000 linux_raid_member f90b664f-0f49-a4f6-9350-216a04988a72 r51:0
[root@]# wipefs /dev/sdd
DEVICE OFFSET TYPE UUID LABEL
sdd 0x2baa1474000 linux_raid_member f90b664f-0f49-a4f6-9350-216a04988a72 r51:0

删除数据

[root@]# wipefs -a -f /dev/sdc
/dev/sdc: 4 bytes were erased at offset 0x2baa1474000 (linux_raid_member): fc 4e 2b a9

[root@]# wipefs -a -f /dev/sdd
/dev/sdd: 4 bytes were erased at offset 0x2baa1474000 (linux_raid_member): fc 4e 2b a9

 

posted @ 2023-04-19 16:06  祝福满地  阅读(331)  评论(0编辑  收藏  举报