2

I have a USB thumb drive that I briefly used in a raid 1 array. I don't need it in that array anymore (but need to add it to a different array) and hence would like to get rid of the old superblock but I can't. I tried:

$ 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

I deleted the partition and pluged the device into a Windows machine to format it from there, but the super block still sticks around:

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

Fdisk:

$ 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

How do I wipe the drive's superblock?

UPDATE

I also tried:

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

this is while none of the partitions on /dev/sdb are mounted, lsblk shows:

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

2 Answers2

5

As the md127 device is started, you must first stop it, then run wipefs:

mdadm --stop /dev/md127
wipefs -a /dev/sdb
wazoox
  • 6,918
  • 4
  • 31
  • 63
  • Don't forget to accept the answer to show that it solves the problem :) – wazoox Feb 17 '20 at 16:39
  • I won't - jus first had to confirm that it actually solved the problem - and yes it did & I accepted your answer! Thanks sir! – stdcerr Feb 17 '20 at 16:56
  • @stdcerr you're welcome :) accepting answers is important on stackoverflow to guide people coming later with the same problem as you had. – wazoox Feb 17 '20 at 16:59
1

Maybe you could try this :

wipefs --all --backup /dev/sdb

Warning : data loss expected

Chaoxiang N
  • 1,283
  • 5
  • 11
  • 1
    that gives me: `wipefs: error: /dev/sdb: probing initialization failed: Device or resource busy` - while the drive or any partition on it isn't mounted – stdcerr Feb 17 '20 at 16:06