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

Re: fstab entries for two different pendrives?



On Mon, Aug 28, 2006 at 10:46:01 -0700, Marc Wilson wrote:
> On Sat, Aug 26, 2006 at 02:28:56PM +0200, Florian Kulzer wrote:
> > Devices will be mounted at the correct mount point
> > automatically.
> 
> Don't they get mounted at some random point in /media?

OK, my statement is somewhat misleading. I was assuming, maybe
mistakenly, that the OP needed a way to make sure that he could always
address each of his two USB sticks in a deterministic way, regardless of
the order in which they were plugged in. To my knowledge the easiest way
to achieve this is to either use pmount-hal (if you are scripting
yourself) or to rely on the built-in functionality of (some) modern
desktop environments. If you have to bring both worlds together you can
always use "lshal" and a bit of awk/grep/sed to find a specific device.

> (/me stabs repeatedly whatever fool decided the world needed two places to
> mount things...)

Well, somebody probably thought "media" is easier to understand than
"mnt". I am not sure if it matters so much; the people who write their
own scripts can (p)mount where they please and the other ones just click
on the icon and often do not really have to know the mount point at all.

> > Even better, if you use the "pmount-hal" command then the
> > devices will be mounted by their volume label so that you can address
> > each medium unambiguously and independent of the order in which you
> > attached them.
> 
> Pre-supposing that the device *has* a volume label, and that you *know*
> what it is, so that you can find it in /media.

You can set the volume label yourself to provide unique identifiers for
your stuff. (At least for USB sticks; I have never tried this with a
camera.) If this is not feasible then you can normally use the uuid
(universally unique identifier). For example, if I run "lshal --monitor"
and plug in my USB stick, I see this:

Start monitoring devicelist:
-------------------------------------------------
usb_device_67b_2515_noserial added
usb_device_67b_2515_noserial_if0 added
usb_device_67b_2515_noserial_usbraw added
usb_device_67b_2517_noserial added
usb_device_67b_2517_noserial_if0 added
usb_device_67b_2517_noserial_usbraw added
usb_device_67b_2517_noserial_if0_scsi_host added
usb_device_67b_2517_noserial_if0_scsi_host_scsi_device_lun0 added
usb_device_67b_2517_noserial_if0_scsi_host_scsi_device_lun0 property info.linux.driver = 'sd' (new)
storage_serial_Prolific_Technology_Inc__USB_Mass_Storage_Device added
volume_uuid_44E1_54A2 added

I can specify the desired mount point by generating a file named
/usr/share/hal/fdi/policy/custom.fdi (or whatever.fdi) with the
following contents:

<?xml version="1.0" encoding="UTF-8"?> <!-- -*- SGML -*- -->
<deviceinfo version="0.2">

  <device>
    <match key="block.is_volume" bool="true">
      <match key="volume.fsusage" string="filesystem">
        <match key="volume.uuid" string="44E1-54A2">
          <merge key="volume.policy.desired_mount_point" type="string">usbstick-flo1</merge>
        </match>
      </match>
    </match>
  </device>

</deviceinfo>

This device should now be mounted at /media/usbstick-flo1 by every DE,
daemon, etc. that uses the hardware abstraction layer to handle
devices.

> > This is also fulls integrated in e.g. KDE and Gnome.
> 
> Fortunately, everyone does not use KDE or Gnome.

I did not mean to imply that everyone should. I know that the
"automatic" mechanism which uses pmount and hal works for these two DEs,
therefore I mentioned them; I would assume that it works on others, too,
if they follow the freedesktop.org specifications.

If you write your own (auto)mounting scripts then you probably only need
to use a udev rule to make sure a unique device symlink is created;
see Alan Chandler's nice summary earlier in this thread.

-- 
Regards,
          Florian



Reply to: