[nflug] Mounting USB Disk Drives

Joe josephj at main.nc.us
Mon Nov 24 15:21:39 EST 2008


System: kubuntu hardy on a Centrino Duo notebook.

I'm having some difficulty mounting my USB disk drive as a user.  It has
a Windoze partition and a Linux partition on it (/dev/sdb1, /dev/sdb2 is
how it usually shows up, but I use UUIDs in fstab in case  that changes).

So far, what I am doing is mounting the drives manually and that's what
the rest of this post is about.

But, what I'd really like is to have the drives auto mount whenever
they're plugged in.  I can't just set them to auto in fstab because
then, Linux would jump up and down during boot up if they're not plugged
in.  I also have another usb disk drive that I want to have work the
same way (with different mount points) once I get this to work.

Almost everything is right except what appears to be a permissions problem.

As illustrated below, mount and pmount work when issued by my user.

What doesn't work is using the icons that appear on my desktop when the
drive is plugged in or another drive like a thumbdrive is plugged in
(the icons don't show up if the drive was already plugged in at boot time).

To debug this, I tried using mount specifying the device as well as the
mount point (from konsole) and that fails as well.  Maybe it has
something to do with /dev/sdb1 and sdb2 belonging to the "disk" group.
Or maybe it is a conflict between using UUIDs in fstab and using the
device name in the mount command - which is what it looks like the
desktop icons may be doing.

The following (from konsole) illustrates what's wrong:

bigbird at sananda:/media$ pmount /media/joelinusb2
bigbird at sananda:/media$ pumount /media/joelinusb2
bigbird at sananda:/media$ mount /media/joelinusb2
bigbird at sananda:/media$ umount /media/joelinusb2
bigbird at sananda:/media$ mount /dev/sdb2 /media/joelinusb2
mount: only root can do that
bigbird at sananda:/media$ mount /dev/sdb1 /media/joewinusb
mount: only root can do that
bigbird at sananda:/media$ ls -l /dev/sdb1
brw-rw---- 1 root disk 8, 17 2008-11-24 13:26 /dev/sdb1
bigbird at sananda:/media$ ls -l /dev/sdb2
brw-rw---- 1 root disk 8, 18 2008-11-24 13:26 /dev/sdb2
bigbird at sananda:/media$

The mount points are in /media
drwxr-xr-x 2 root usbdrives  4096 2008-11-24 02:50 joelinusb2
drwxr-xr-x 2 root usbdrives  4096 2008-04-18 02:21 joewinusb

My user is a member of the usbdrives group (gid=1002).

The entries in /etc/fstab (that I manually added) are

#Entry for /dev/sdb2 - joelinusb2 usb Linux partition
UUID=290fdbe2-4535-4b43-a035-7805062cb069 /media/joelinusb2 ext3
user,async,atime,noauto,rw,dev,exec,suid 0 0
# Entry for /dev/sdb1 - joewinusb usb drive Windows partition
UUID=0BDD76C77F0F8CEE /media/joewinusb ntfs-3g
user,noauto,rw,gid=1002,umask=0002,locale=en_US.utf8 0 0

I have verified the UUIDs.  I guess they have to be right or pmount
wouldn't work.

Any ideas on how to fix this or do it right would be appreciated.

Joe




More information about the nflug mailing list