How are external USB drives processed? TFM wanted

Mikkel L. Ellertson mikkel at infinity-ltd.com
Mon Jun 12 13:51:29 UTC 2006


ed.temp.01 at gmail.com wrote:
> Hi,
> 
> I have an external USB drive with a number of partitions on it. When I
> switch it on then a number of mount points appear under /media of the
> form /media/label where label is the partition label.
> 
> I'd like to control this process, i.e. decide which partitions are
> mounted, which are mounted readonly and which are not mounted. I'd
> also like to change the mount point names to be more user friendly
> e.g. 'backup'
> 
> I am guessing that udev is used to recognise the new devices and
> create the /dev entries. What decides to create the mount points and
> to mount the partitions?
> 
> Ed
> 
HAL decides the mount points used. There are a set of rules it
follows to decide what the mount points are called. If you have
partition labels, it will use them as mount point names. It is
possible to write your own rules for specific devices, and have HAL
use them instead. This tends to get interesting. Here is one I did
for a PEN drive on a Mandriva system:

<?xml version="1.0" encoding="ISO-8859-1"?> <!-- -*- SGML -*- -->

<deviceinfo version="0.2">
  <device>
    <match key="info.bus" string="usb">
      <match key="usb.vendor_id" int="0x0d7d">
        <match key="usb.product_id" int="0x1300">
          <append key="volume.policy.desired_mount_point"
type="string">PENdrive</append>
        </match>
      </match>
    </match>
  </device>
</deviceinfo>

If you look in the /usr/share/hal directory tree, you will find the
default rules, as well as the scripts that HAL runs to handle things
like mounting and unmounting drives, CDs, etc. You do not want to
modify the default rules. Instead, you want to create a file with
your own rules. Because the rules are processed in directory/file
name order, if your rules comes first, it will get processed instead
of the default rules. I have not really found any good HOWTO on
writing HAL rules. There some examples in the HAL documentation, but
they are somewhat out of date.

Mikkel
-- 

  Do not meddle in the affairs of dragons,
for thou art crunchy and taste good with Ketchup!




More information about the fedora-list mailing list