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

Re: How to mount USB drive at boot time



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 heard a lot about ivman, which unfortunately is not a part of fedora 
distribution. Ivman is a deamon which listens on the D-BUS. I can be run 
system wide or per-user. It also can mount your partition and makes the 
HAL XML script and the shell script obsolete, since it only needs its own 
config file (also XML).

> Root should be able to unmount the drive, when it is mounted.

That is always the case. :)

> I assume this should be done by either udev or hal -- HOW?

UDEV is responsible for creating device nodes after the kernel modules 
have been loaded by the autoloader.

-- 
Bye,
Adalbert

I don't care where I sit as long as I get fed. -- Calvin Trillin


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