Device Busy? –WTF!–

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.[1][2][3] 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.[4] 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.[5] 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.

7 Responses to “Device Busy? –WTF!–”

  1. nls1729 says:

    Black listing is accomplished in the configuration file. You can ask the google, “redhat multipath”. The following titles should put you on the right track.

    Red Hat Enterprise Linux 5 DM Multipath (PDF)
    Red Hat Enterprise Linux 6 DM Multipath (PDF)

  2. nls1729 says:

    I should have read all your posts before I commented. How in the world did you end up with multipath installed on a laptop? You don’t need it.

  3. Glyn says:

    Fedora based distros install it by default. And yes, I said the same thing. Both Fedora and Centos have this problem. However, OpenSuse did not. I actually struggled with that for the longest, which is why I made this post here

  4. old486whizz says:

    I had to register to reply.
    I’ve been using Fedora since around FC4 sometime, and have been a unix admin for around 7 years.

    I’ve reinstalled Fedora countless times. I’ve tested just several minutes ago on my home PC which has a motherboard sata raid0 under LVM setup – so I would expect multipath to be running.

    In fact, running ‘multipath -l’ returns:
    … kernel driver not loaded …
    with several messages about config files not existing, and so all devices are blacklisted.

    Could you check to see if /etc/multipath.conf, /usr/share/doc/device-mapper-multi*/multipath.conf exists?

    From my experience you need to specifically configure multipath in order to use it.
    Perhaps you used an odd setup whilst installing Fedora (during the partitioning setup)?

  5. Glyn says:

    I know for a fact that is what it was, at least for my current CentOs set-up. When I ran the multipath -l command, it showed my hardware. Obviously, I don’t have the Fedora install to try it again. There is always the possiblility that I selected something and forgot about it, btu I don’t think so. At most, I may have used a custom layout so that I could preserve my /home partition.

    As for the .conf files, yes, yes they do. Multipath is definitely installed and running. Why? Don’t ask me. Something I noted a while back is that Fedora tends to use LVM even when there is no point. is single HD installs. I’m guessing that multipath went with it.

    Now, your test rig… the more I think about it, the more I wonder if it might have been the custom set up I performed, but I never installed any raid tools or multipath explicitely. Why would I? I didn’t even know what it did at the time, and now I know for sure that I never needed it.

    There is one other thing, though. I’m running all this on a Sony Vaio, and, for some reason, Linux behaves strangely on Sony’s.I actually despise this laptop and can’t wait to get a new one in another year or so. Maybe udev picked up something that made it think this was some kind of complicated rig? I dunno.


  6. GrueMaster says:

    This issue is not restricted to Redhat based OS’s. I have been running Ubuntu on my desktop since 2009, and recently upgraded it to 12.04 LTS. When I added a 500G drive that used to host XP on a different system, I couldn’t format it. I could change the partitions without problem, but as soon as I tried to format it, it was “in use”. It wsn’t until I ran “sudo fuser /dev/sdb” that I found out multipath was the culprit.

Leave a Reply

You must be logged in to post a comment.