Mailinglist Archive: opensuse (4547 mails)

< Previous Next >
Re: [SLE] Why does USB drive mount automagically?
  • From: Sjoerd Hiemstra <penguinista.frisiana144@xxxxxxxxxx>
  • Date: Sat, 22 May 2004 18:52:18 +0200
  • Message-id: <20040522185218.1741d419.penguinista.frisiana144@xxxxxxxxxx>
David Johanson wrote:
> > Please see
> >
http://portal.suse.com/sdb/de/2004/05/hmeyer_91_revert_from_subfs.html,
> > it's available in German only, unfortunately, but I hope it's
> > usable.
>
> Anyone willing to translate this to english. Three install so far and
> none of them see the USB devices at all. All clean installs.

Here's my attempt:

Applies to: SUSE LINUX 9.1

The issue

You do not like the way automatic mounting of removable media (floppy,
cd, dvd) and hotplug devices (such as USB-sticks or -HDs) is done by
default since 9.1, using submount/subfs. You prefer to revert to the
'classic' art of mounting media.

Procedure

For floppy, cd and dvd this is simply accomplished by editing
/etc/fstab. In this example, showing a dvd and floppy, you change these
lines

/dev/dvd /media/dvd subfs
fs=cdfss,ro,procuid,nosuid,nodev,exec,iocharset=utf8 0 0
/dev/fd0 /media/floppy subfs
fs=floppyfss,procuid,nodev,nosuid,sync 0 0

to

/dev/dvd /media/dvd auto
ro,noauto,user,exec,iocharset=utf8 0 0
/dev/fd0 /media/floppy auto
noauto,user,exec,sync 0 0

Important: first make a backup copy of the original /etc/fstab!

For media such as USB-sticks, that are connected through the hotplug
mechanism, the case is somewhat more complicated, because since 9.1, no
entry in /etc/fstab is added for these devices any more. Instead, these
devices are connected through the hotplug scripts. Here, again,
submount/subfs is used. If you would like to avoid this, you could edit
the file /etc/hotplug/hotplug.subfs.functions in such a way that the
hotplug mechanism does not connect these devices via submount/subfs any
more:

linux:/etc/hotplug # diff hotplug.subfs.functions.orig
hotplug.subfs.functions
135,136c135,136
< mount $device $MP -t subfs \
< -o "${fstype}nodev,nosuid,procuid,$fsoptions"
---
> mount $device $MP -t auto \
> -o "nodev,nosuid,procuid,$fsoptions"
166c166
< umount $device -t subfs
---
> umount $device -t auto
188c188
< /bin/grep -v '^#' /etc/fstab | /bin/awk '$3 ~ /subfs/ { print
$1" "$2 }' \
---
> /bin/grep -v '^#' /etc/fstab | /bin/awk '$3 ~ /auto/ { print
$1" "$2 }' \

Instead of making these changes yourself, you could copy this alterated
file from our ftp server:

ftp://ftp.suse.com/pub/people/hvogel/hotplug.subfs.functions

And again, first make a backup copy of the original file.

Please note that these modifications would be overwritten by future
updates of the hotplug package. Hence, after such an update these
modifications have to be applied again. The modifications that are
described here, only apply to the original hotplug package in 9.1.

From this point on, hotplug will create corresponding directories under
/media, when a new device is detected via Hotplug. It remains your
choice to either utilize these automatically created directories, or to
create your own directories. In any case, mounting the device takes
place as before, for example like this:

mount /dev/sda1 /media/usb-storage-4710765066451:0:0:0p1.

< Previous Next >