[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: "drive already mounted or busy" ... dmsetup routine



Thanks for the reply.

* Camaleón <noelamac@gmail.com> [120711 16:09]:
> On Tue, 10 Jul 2012 23:09:59 -0700, John Magolske wrote:
> 
> > I've been having issues with a particular hard drive, where after a
> > suspend-resume cycle with s2ram, it won't mount:
> > 
> >     # mount /dev/sdb1 /media
> >     mount: /dev/sdb1 already mounted or /media busy 
> >     # umount /media
> >     umount: /media: not mounted
> 
> I wouldn't use "/media" as mount point but an isolate mount point and 
> better yet "static" if the hard drive is to be used every day.

Just did a bit of searching, not sure what isolate(d) or static mount
points might be... Reading the Filesystem Hierarchy Standard I see
that /media should be a mount point for removeable media, containing
"subdirectories used as mount points for removeable media such as
floppy disks, cdroms and zip disks". I just grabbed /media here as an
example, simplifying what I typically use, which involves entries in
/etc/fstab like this:

    /dev/disk/by-id/*hd1-id**-part1 /hd/e1 auto defaults,user,noauto 0 0
    /dev/disk/by-id/*hd2-id**-part1 /hd/e2 auto defaults,user,noauto 0 0

an alias:

    mnt () {
        mount /$1/$2 && cd /$1/$2 && ls -ohF --color=auto
    }

and directory structures like so:

    % tree /hd
    /hd
    |-- e1
    |-- e2
    |-- e3
    `-- h1

    % tree /fd
    /fd
    |-- e1
    |-- e2
    `-- e3

Then, `mnt hd e1` will mount one hard drive, `mnt hd e2` will mount
another hard drive, `mnt fd e2` will mount a particular flash drive,
etc. Maybe there's a simpler/smarter way to handle mounting drives,
but I set this up a while back in the interest of being able to
tell by glancing at a short absolute file path exactly what drive
is mounted, and it seems to be working well enough. In any case, my
"already mounted or ..." & "dmsetup remove ..." routine is the same
whether I use `mnt hd e1` or just do a `mount /dev/sdb1 /mountpoint`.

> > So I end up doing the following routine:
> > 
> >     # dmsetup ls
> > 
> > (observe the device uuid's and input those to the remove below)
> > 
> >     # dmsetup remove
> >     *********************************************************-part1 #
> >     dmsetup remove
> >     *********************************************************
> > 
> > After this I can mount/umount multiple times no problem. But after every
> > suspend-resume cycle I have to do that dmsetup routine again.
> 
> Is the hard drive partition being used/recognized as as device mapper 
> volume? :-?

I did not set up such a thing with this drive. I do have another script
that uses cryptsetup like:

    cryptsetup create cryptodrive /dev/disk/by-id/usb-***-0:0-part1

but that explicitly calls out a different disk by id, so I don't see
how that would be contributing to this behaviour.

> > Could this be a hard-drive hardware issue? Or maybe something is
> > mis-configured? Seems to have started after a dist-upgrade a while back.
> > I'm able to mount other flash-drives fine without the dmsetup routine.
> 
> These errors are commom when resuming from suspension or even 
> hibernation. What you can do is unmounting the USB devices before 
> entering into suspension mode and mount them again after system comes to 
> life.

I try to always unmount external drives & USB devices prior to a
suspend/resume. It's possible I accidentally forgot to do so once
with this drive (though I don't recall doing so). And I keep getting
the described behaviour *every* time I try to mount that drive after
a suspend/resume. It's also possible this drive was mounted during a
dist-upgrade...not sure if that could've scrambled things up a bit.

John

-- 
John Magolske
http://B79.net/contact


Reply to: