Linux

無法清除驅動器上的超級塊

  • February 17, 2020

我有一個 USB 拇指驅動器,我曾在 raid 1 陣列中短暫使用過。我不再需要它在那個數組中(但需要將它添加到不同的數組中),因此想擺脫舊的超級塊,但我不能。我試過:

$ sudo mdadm --zero-superblock /dev/sdb
mdadm: Couldn't open /dev/sdb for write - not zeroing
$ sudo mdadm --zero-superblock /dev/sdb1
mdadm: Couldn't open /dev/sdb1 for write - not zeroing

我刪除了分區並將設備插入 Windows 機器以從那里格式化,但超級塊仍然存在:

$lsblk
...
...
sdb           8:16   1 119.3G  0 disk  
└─md127       9:127  0 119.2G  0 raid1 

磁碟:

$ sudo fdisk /dev/sdb

Welcome to fdisk (util-linux 2.33.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): p
Disk /dev/sdb: 119.3 GiB, 128038469632 bytes, 250075136 sectors
Disk model: USB Flash Drive 
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xeb49580b

Device     Boot Start       End   Sectors   Size Id Type
/dev/sdb1        2048 250075135 250073088 119.3G  7 HPFS/NTFS/exFAT

如何擦除驅動器的超級塊?

更新

我也試過:

$ sudo wipefs --all --backup /dev/sdb
wipefs: error: /dev/sdb: probing initialization failed: Device or resource busy

這是在沒有/dev/sdb安裝任何分區的情況下,lsblk顯示:

...
sdb           8:16   1 119.3G  0 disk  
├─sdb1        8:17   1 119.3G  0 part  
└─md127       9:127  0 119.2G  0 raid1 
...

設備啟動時,您必須先將其md127停止,然後執行 wipefs:

mdadm --stop /dev/md127
wipefs -a /dev/sdb

也許你可以試試這個:

wipefs --all --backup /dev/sdb

警告:預計會失去數據

引用自:https://serverfault.com/questions/1003316