Re: How to mount USB drive at boot time [ Still not working ]

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

 



On Wed, 2007-07-25 at 20:31 +0200, Adalbert Prokop wrote: 
> Jonathan Ryshpan wrote on Wednesday 25 July 2007:
> 
> > If it is connected to the system at boot time, the device path should
> > be created and the drive should be mounted immediately, i.e. BEFORE any
> > user logs in.
> 
> What you want is to make HAL mount your device for you. I'm not an expert 
> for HAL but I use it for some purposes. Consider this mail as a 
> suggestion and improve it. :) You should have at least basic knowlege of 
> XML and shell scripts.
> 
> Place the following file into /usr/share/hal/fdi/policy/20thirdparty. 
> Replace volume-id-here with the volume uuid of your partition. You can 
> get it for partition sdd3 as follows
> 
> hal-get-property --key volume.uuid --udi $(hal-find-by-property --key 
> block.device --string /dev/sdd3)
> 
> --- 8< --- 8< --- 8< --- 8< --- 8< --- 8< --- 8< --- 8< --- 8< ---
> <?xml version="1.0" encoding="UTF-8"?> <!-- -*- SGML -*- -->
> 
> <deviceinfo version="0.2">
> 
>   <device>
>     <match key="volume.uuid" string="volume-id-here">
>         <append key="info.callouts.add" type="strlist">mountscript</append>
>     </match>
>   </device>
> 
> </deviceinfo>
> --- 8< --- 8< --- 8< --- 8< --- 8< --- 8< --- 8< --- 8< --- 8< ---
> 
> In /usr/lib/hal/scripts you have to place the script "mountscript" used 
> above.
> 
> --- 8< --- 8< --- 8< --- 8< --- 8< --- 8< --- 8< --- 8< --- 8< ---
> #!/bin/sh
> gnome-mount -h $HAL_PROP_INFO_UDI
> --- 8< --- 8< --- 8< --- 8< --- 8< --- 8< --- 8< --- 8< --- 8< ---
> 
> This SHOULD mount your partition as soon as hal sees it. Maybe it is 
> possible to call HALs mount-method from the XML script directly. This 
> would make the shell script obsolete.

I've been looking into XML, etc. and thought that I knew enough to be
able to understand what's going on.  Apparently not.  The drive is not
being mounted.  Most likely the script isn't being called at all.

Some questions:

What does the environment variable $HAL_PROP_INFO_UDI do?  It looks like
it has the value of the hal property "volume.uuid"; is this true?  What
other environment variables are set when the script is called?  

Is there any convenient way to get hal to log its activity at boot time,
similar to invoking it (as described in the man page) as
	# /usr/sbin/hald --daemon=no --verbose=yes  ?

Why isn't my setup working?  The needed info is (hopefully) below:

The XML control file:

        $ cat 95-mount-usb-drive.fdi
        <?xml version="1.0" encoding="UTF-8"?>
        
        <deviceinfo version="0.2">
          <device>
            <!-- Mount (usb) drive with label usb-disk -->
              <match key="volume.uuid"="9dd976ce-a988-42a2-857d-06c3079675e7">
                 <append key="info.callouts.add" type="strlist">hal-mountscript-jon</append>
             </match>
          </device>
        </deviceinfo>
        
        
The mount script:

        $ cat /usr/lib64/hal/scripts/hal-mountscript-jon
        #!/bin/sh
        gnome-mount -h $HAL_PROP_INFO_UDI
        
The relevant portion of:

        $ lshal
        ...
        udi = '/org/freedesktop/Hal/devices/volume_uuid_9dd976ce_a988_42a2_857d_06c3079675e7'
          block.device = '/dev/sdb1'  (string)
          block.is_volume = true  (bool)
          block.major = 8  (0x8)  (int)
          block.minor = 17  (0x11)  (int)
          block.storage_device = '/org/freedesktop/Hal/devices/storage_serial_Maxtor_3200_UA00H79C'  (string)
          info.capabilities = {'volume', 'block'} (string list)
          info.category = 'volume'  (string)
          info.interfaces = {'org.freedesktop.Hal.Device.Volume'} (string list)
          info.parent = '/org/freedesktop/Hal/devices/storage_serial_Maxtor_3200_UA00H79C'  (string)
          info.product = 'usb-disk'  (string)
          info.udi = '/org/freedesktop/Hal/devices/volume_uuid_9dd976ce_a988_42a2_857d_06c3079675e7'  (string)
          linux.hotplug_type = 3  (0x3)  (int)
          linux.sysfs_path = '/sys/block/sdb/sdb1'  (string)
          org.freedesktop.Hal.Device.Volume.method_argnames = {'mount_point fstype extra_options', 'extra_options', 'extra_options'} (string list)
          org.freedesktop.Hal.Device.Volume.method_execpaths = {'hal-storage-mount', 'hal-storage-unmount', 'hal-storage-eject'} (string list)
          org.freedesktop.Hal.Device.Volume.method_names = {'Mount', 'Unmount', 'Eject'} (string list)
          org.freedesktop.Hal.Device.Volume.method_signatures = {'ssas', 'as', 'as'} (string list)
          storage.model = ''  (string)
          volume.block_size = 512  (0x200)  (int)
          volume.fstype = 'ext3'  (string)
          volume.fsusage = 'filesystem'  (string)
          volume.fsversion = '1.0'  (string)
          volume.ignore = false  (bool)
          volume.is_disc = false  (bool)
          volume.is_mounted = true  (bool)
          volume.is_mounted_read_only = false  (bool)
          volume.is_partition = true  (bool)
          volume.label = 'usb-disk'  (string)
          volume.linux.is_device_mapper = false  (bool)
          volume.mount.valid_options = {'ro', 'sync', 'dirsync', 'noatime', 'nodiratime', 'noexec', 'quiet', 'remount', 'exec', 'acl', 'user_xattr', 'data='} (string list)
          volume.mount_point = '/media/usb-disk'  (string)
          volume.num_blocks = 586099332  (0x22ef2a84)  (int)
          volume.partition.flags = {} (string list)
          volume.partition.label = ''  (string)
          volume.partition.media_size = 300090728448  (0x45decd2000)  (uint64)
          volume.partition.number = 1  (0x1)  (int)
          volume.partition.scheme = 'mbr'  (string)
          volume.partition.start = 32256  (0x7e00)  (uint64)
          volume.partition.type = '0x83'  (string)
          volume.partition.uuid = ''  (string)
          volume.size = 300082857984  (0x45de550800)  (uint64)
          volume.unmount.valid_options = {'lazy'} (string list)
          volume.uuid = '9dd976ce-a988-42a2-857d-06c3079675e7'  (string)
        ...
        
Thanks - jon



[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux