One of my first impressions with RedHat based Distros was that I couldn’t just plug in a thumb drive and mess with the partitions from the installed OS. Why? Because I got this “Device or resource Busy” error, in other words: someone else was using that drive already, and to please stop them and Linux would be glad to do that thing for me.
Fast forward about a year and some searching dug up the lsof command. Lovely, lovely command. It helped me find the enemy, and the enemy was me? Yup. root was the, erm, root of the problem. But it didn’t help me figure it out. It wasn’t until today, when I was researching raid levels and set up, that I discovered the issue: multipath. Here is what it does in a nutshell:
DM-Multipathing (DM-MPIO) provides I/O failover and load-balancing within Linux for block devices. By utilizing device-mapper, multipathd provides the host-side logic to use multiple paths of a redundant network to provide continuous availability and higher bandwidth connectivity between the host server and the block-level device. DM-MPIO handles the rerouting of block I/O to an alternate path in the event of a path failure. DM-MPIO can also balance the I/O load across all of the available paths that are typically Fibre Channel (FC) or iSCSI SAN environments. DM-MPIO is based on the Device mapper which provides the basic framework that maps one block device onto another. (from Wikipedia)
So… why does a USB device need failover support? It also speeds things up a bit(Always good, right?) and is part of the reason why Linux can attach devices that other OS’s can’t. Because it will hunt down the way to finding that data.
Oh, and it ties up the device when you’re trying to, say, install a live image to it. So here’s Glyn’s super fast guide on finding out if this is the problem.
First, the set up: you are trying to install a live CD to a disk using the livecd tools. It tells you that the drive is busy. here is the quick way to find out if it is multipath:
>>sudo multipath -l
Just so you know, if there are no entries, it ignores you. Instead, however, it will probably say this:
>>$ sudo multipath -l
[sudo] password for user:
1JMicron_USB_to_ATA_ATAPI_bridge dm-3 FUJITSU,MHT2040AH
size=37G features=’0′ hwhandler=’0′ wp=rw
`-+- policy=’round-robin 0′ prio=0 status=active
`- 6:0:0:0 sdb 8:16 active undef running
There it is! That’s how root is using the device. Not to kill it:
>>sudo multipath -F
Again, it will say nothing, so a quick:
>>sudo multipath -l
to check and there you go! Now, there is a way to blacklist the device, but I don’t know the syntax right now, as it is almost midnight. If you know, please leave it in the comments.
And there you have it! That wasn’t so hard, now was it? Good luck finding that on the net, though. Till now.