unable to mkfs.btrfs ERROR: unable to open /dev/sdc: Device or resource busy
A possibility, that happened to me, is that the hard drive was at some point a component of a software RAID. In such case, even if "deleting" its partition table, and rebooting, there will be some persistent data in the superblock that causes the OS (CentOS 7 in my case) to recognize that and to create an entry such as /dev/md127 in the /dev directory.
Now that I want disk this just to work stand-alone, no more RAID association to it, you'll need to tell the system, such as:
# mdadm --stop /dev/md127
(You may use mdadm --detail /dev/md127 to see metadata beforehand).
After the stop, that metadata is gone, and the disk can be reused.
Related videos on Youtube
Tim
Updated on September 18, 2022Comments
-
Tim almost 2 years
I have an old Dell PowerEdge 1950 with a LSA SAS card connecting three hard drives. I am running Ubuntu 16.04 server. When I run the following command:
sudo mkfs.btrfs -d raid6 -f /dev/sdc /dev/sdd /dev/sde
I get
btrfs-progs v4.4 See http://btrfs.wiki.kernel.org for more information. ERROR: unable to open /dev/sdc: Device or resource busy
Drives are not mounted yet:
mount | grep /dev/sd /dev/sda1 on / type btrfs (rw,relatime,space_cache,subvolid=257,subvol=/@) /dev/sda1 on /home type btrfs (rw,relatime,space_cache,subvolid=258,subvol=/@home)
I have also noticed these devices don't list the file for the first partition, example /dev/sdd1, but I have partitioned successfully
sudo fdisk -l Disk /dev/sdc: 279.4 GiB, 300000000000 bytes, 585937500 sectors 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: 0x000b958a Device Boot Start End Sectors Size Id Type /dev/sdc1 2048 585937499 585935452 279.4G 83 Linux Disk /dev/sdd: 279.4 GiB, 300000000000 bytes, 585937500 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk /dev/sdb: 279.4 GiB, 300000000000 bytes, 585937500 sectors 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: 0x23bde1bc Device Boot Start End Sectors Size Id Type /dev/sdb1 2048 585937499 585935452 279.4G 83 Linux
Any suggestions?
Thanks, Tim
-
Tim about 8 yearsI still haven't been able to determine why this disk is busy. lsof has no mention of the disk, I am able to change the partition table without a problem. These are old disks, so I had to remove a raid magic code(?) or super block. still having no luck mkfs of any fs type on that disk. I even wiped the disk with dd if=/dev/null of=/dev/sdc block=512.
-
Tim about 8 yearsI have been able to mkfs by first running the command mdadm --zero-superblock -f then rebooting. Having to reboot is less than ideal though. I'm still trying to find out what is using the disk.
-
Dunatotatos over 4 yearsThis can help : superuser.com/questions/447462/…
-
-
Caleb about 3 yearsWow this got me out of a bind I couldn't understand. I nuked and paved over a service provider's machine (Hetzer dedicated host) and couldn't figure out why I couldn't format. Yes the default factor config had been a software RAID setup.