Ubuntu: /dev/sdb1 is apparently in use by the system; will not make a filesystem here

5,201

Solution 1

The mdadm --zero-superblock looks like it failed because you weren't root.

However this may not be enough, isw_raid_member is probably due to the disk previously being used as an Intel software RAID device. If it still fails, try:

dmraid -rE /dev/sdb

You may need to install the dmraid package first.

Reboot after this and see if you now can use the disk.

Solution 2

sudo dd if=/dev/urandom of=/dev/sdb bs=1M status=progress

This command will delete the metadata and digital signatures which is even caused by Intel VROC (virtual raid on CPU), but takes more time depending on the size of hard disk.

Share:
5,201

Related videos on Youtube

loretoparisi
Author by

loretoparisi

Updated on September 18, 2022

Comments

  • loretoparisi
    loretoparisi over 1 year

    I get this error when I try to format dev/sdb1:

    $ mkfs.ext4 -L data /dev/sdb1
       mke2fs 1.42.13 (17-May-2015)
       /dev/sdb1 is apparently in use by the system; will not make a filesystem here!
    

    where /dev/sdb has a partition that I have created with echo 'type=83' | sudo sfdisk /dev/sdb:

    $ fsdisk -l
    
    Disk /dev/sdb: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 4096 bytes
    I/O size (minimum/optimal): 4096 bytes / 4096 bytes
    Disklabel type: dos
    Disk identifier: 0x1507c58d
    
    Device     Boot Start        End    Sectors  Size Id Type
    /dev/sdb1        2048 3907029167 3907027120  1.8T 83 Linux
    

    and

    $ lsblk
    NAME                    MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
    sda                       8:0    0   477G  0 disk  
    ├─sda1                    8:1    0   487M  0 part  /boot
    ├─sda2                    8:2    0     1K  0 part  
    └─sda5                    8:5    0 476.5G  0 part  
      └─sda5_crypt          252:0    0 476.5G  0 crypt 
        ├─ubuntu--vg-root   252:1    0 460.5G  0 lvm   /
        └─ubuntu--vg-swap_1 252:2    0    16G  0 lvm   [SWAP]
    sdb                       8:16   0   1.8T  0 disk  
    └─sdb1
    

    Conversely, if I try to mount this disk I get a isw_raid_member error:

    $ mount /dev/sdb /mnt/Data
        mount: unknown filesystem type 'isw_raid_member'
    

    So I found md127:

    # cat /proc/mdstat 
    Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10] 
    md127 : inactive sdb[0](S)
          1105 blocks super external:imsm
    
    unused devices: <none>
    

    and then stopped it:

    mdadm --manage --stop /dev/md127
    mdadm: stopped /dev/md127
    # cat /proc/mdstat 
    Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10] 
    unused devices: <none>
    

    I then tried again to mount:

    # mount /dev/sdb /mnt/Data
    mount: unknown filesystem type 'isw_raid_member'
    

    if I try to wipe the superblock of the disk:

    $ mdadm --zero-superblock /dev/sdb
       mdmon: /dev/sdb is not attached to Intel(R) RAID controller.
       mdmon: /dev/sdb is not attached to Intel(R) RAID controller.
    

    When I try testdisk this is what I get

    Disk /dev/sdb - 2000 GB / 1863 GiB - ST2000DM001-1CH164
         CHS 243201 255 63 - sector size=512
    
    No ext2, JFS, Reiser, cramfs or XFS marker
     1 P Linux                    0  32 33 243201  80 63 3907027120
     1 P Linux                    0  32 33 243201  80 63 3907027120
    No partition is bootable
    

    Is it possible that this disk has been marked by another RAID like Intel Rapid Storage RAID or similar?

  • loretoparisi
    loretoparisi over 4 years
    you were right! I did after sudo -i and update the reply here getting now: mdmon: /dev/sdb is not attached to Intel(R) RAID controller.