USB mount points change?

I’m seeing an odd problem with my new desktop machine. I’ve been using only laptop machines for years, and have always mounted my USB flash drive at /media/FlashDisk, with the fstab line

/dev/sdb1 /media/FlashDisk vfat users,noauto,sync…

On the desktop, though, when I insert the stick, it seems to get detected at a different point every time. If I look at /var/log/messages, I might see it at /dev/sdc1 one time, and at /dev/sdf1 the next. The only way I’ve found to mount it is to insert the drive, look at messages to find out where it is this time, edit /etc/fstab to reflect that, and then do the mount, which is quite a pain.

Is there any way to automate this process, so that a memory stick would always be mounted at the same path in the filesystem, and other USB devices (camera, media player, etc) would have their own locations? Is there some sort of manual or HowTo I can read?

I’m running OpenSuSE 11.0 on all my systems, using FVWM2 window manager, so the Windoze-like “solutions” of having a bunch of file icons pop up on a “desktop” aren’t relevant. I work from the command line, and would do e.g. “copy /media/FlashDisk/file.tgz .” to copy a file, rather than drag-and-drop manipulation.

Thanks,
James

jamesqf wrote:
> I’m seeing an odd problem with my new desktop machine. I’ve been using
> only laptop machines for years, and have always mounted my USB flash
> drive at /media/FlashDisk, with the fstab line
>
> /dev/sdb1 /media/FlashDisk vfat users,noauto,sync…
>
> On the desktop, though, when I insert the stick, it seems to get
> detected at a different point every time. If I look at
> /var/log/messages, I might see it at /dev/sdc1 one time, and at
> /dev/sdf1 the next. The only way I’ve found to mount it is to insert
> the drive, look at messages to find out where it is this time, edit
> /etc/fstab to reflect that, and then do the mount, which is quite a
> pain.
> Is there any way to automate this process, so that a memory stick would
> always be mounted at the same path in the filesystem, and other USB
> devices (camera, media player, etc) would have their own locations? Is
> there some sort of manual or HowTo I can read?

You can use e.g. mount by id
In /dev/disk/by-id/ you can find the disks Linux has found. Use an id in
fstab instead of the disk name.

On 2008-09-21, jamesqf <jamesqf@no-mx.forums.opensuse.org> wrote:

> I’m seeing an odd problem with my new desktop machine. I’ve been using
> only laptop machines for years, and have always mounted my USB flash
> drive at /media/FlashDisk, with the fstab line
>
> /dev/sdb1 /media/FlashDisk vfat users,noauto,sync…
>
> On the desktop, though, when I insert the stick, it seems to get
> detected at a different point every time. If I look at
> /var/log/messages, I might see it at /dev/sdc1 one time, and at
> /dev/sdf1 the next. The only way I’ve found to mount it is to insert
> the drive, look at messages to find out where it is this time, edit
> /etc/fstab to reflect that, and then do the mount, which is quite a
> pain.
>
> Is there any way to automate this process, so that a memory stick would
> always be mounted at the same path in the filesystem, and other USB
> devices (camera, media player, etc) would have their own locations? Is
> there some sort of manual or HowTo I can read?
>
> I’m running OpenSuSE 11.0 on all my systems, using FVWM2 window
> manager, so the Windoze-like “solutions” of having a bunch of file icons
> pop up on a “desktop” aren’t relevant. I work from the command line,
> and would do e.g. “copy /media/FlashDisk/file.tgz .” to copy a file,
> rather than drag-and-drop manipulation.

For a while now, I’ve been using a method that orks OK:

  • don’t use fstab to’fix’ any parameters of the drive
  • give the drive a label
  • for fat, give it a disk label on a Windows machine
  • for ext2/3, use e2label

After that, the drive should come up under /media/LABEL.

Of course, you should give each drive a unique name.


Elevators smell different to midgets