I have a USB drive that is usually, though not always, connected to my desktop system.
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.
If it is not connected at boot time, there should be no serious problem.
If the drive is connected to a running system (on which it had not been previously connected), the device path should be created, and it should be mounted by root.
Root should be able to unmount the drive, when it is mounted.
I assume this should be done by either udev or hal -- HOW?
Thanks - jon
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.
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
Jonathan Ryshpan wrote:
I have a USB drive that is usually, though not always, connected to my desktop system.
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.
If it is not connected at boot time, there should be no serious problem.
If the drive is connected to a running system (on which it had not been previously connected), the device path should be created, and it should be mounted by root.
Root should be able to unmount the drive, when it is mounted.
I assume this should be done by either udev or hal -- HOW?
You may be able to do this just by putting the entry in /etc/fstab, using the UUID of the filesystem to eliminate any dependency on device name. I /think/ the hotplug will check, I can't easily go thru it myself at this moment.
On Thu, 2007-07-26 at 17:36 -0400, Bill Davidsen wrote:
Jonathan Ryshpan wrote:
I have a USB drive that is usually, though not always, connected to my desktop system.
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.
If it is not connected at boot time, there should be no serious problem.
If the drive is connected to a running system (on which it had not been previously connected), the device path should be created, and it should be mounted by root.
Root should be able to unmount the drive, when it is mounted.
I assume this should be done by either udev or hal -- HOW?
You may be able to do this just by putting the entry in /etc/fstab, using the UUID of the filesystem to eliminate any dependency on device name. I /think/ the hotplug will check, I can't easily go thru it myself at this moment.
I don't think so. Here's my /etc/fstab:
LABEL=/ / ext3 defaults 1 1 ... UUID=9dd976ce-a988-42a2-857d-06c3079675e7 /media/usb-disk ext3 defaults 1 2
During boot I see these messages:
Mounting local filesystems [FAILED] ... Mounting other filesystems: mountpoint /media/usb-disk does not exist.
And, in fact, the drive is not mounted.
BTW: Why is this so hard? Am I the only person who wants to do it?
BTW: I thought that the messages that appear on the monitor during boot were saved in /var/log/messages . Apparently not. Are they saved anywhere?
Thanks - jon
On Thu, 2007-07-26 at 22:35 -0700, Jonathan Ryshpan wrote:
Here's my /etc/fstab:
LABEL=/ / ext3 defaults 1 1 UUID=9dd976ce-a988-42a2-857d-06c3079675e7 /media/usb-disk ext3 defaults 1 2
During boot I see these messages:
Mounting local filesystems [FAILED] ... Mounting other filesystems: mountpoint /media/usb-disk does not exist.
If you're manually mounting things via fstab, you need to make sure that the mount point is already created (your /media/usb-disk). It won't create them for you.
However, since /media is used by the auto-mount system, you might want to make your mountpoint somewhere else where it can't clash (like in /mnt), or turn off the auto-mounting services.
As far as looging-boot messages is concerned:
i also thought, that they are kept in /var/log/boot.log or /var/log/boot.msg. but as i googled aroud, i read that from fedora core 6 and fedora 7 on it is no longer so.
Boot messages are maintained in /var/log/dmesg i learned, but this is only about hardware and not about started services.
suomi
Jonathan Ryshpan wrote:
On Thu, 2007-07-26 at 17:36 -0400, Bill Davidsen wrote:
Jonathan Ryshpan wrote:
I have a USB drive that is usually, though not always, connected to my desktop system.
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.
If it is not connected at boot time, there should be no serious problem.
If the drive is connected to a running system (on which it had not been previously connected), the device path should be created, and it should be mounted by root.
Root should be able to unmount the drive, when it is mounted.
I assume this should be done by either udev or hal -- HOW?
You may be able to do this just by putting the entry in /etc/fstab, using the UUID of the filesystem to eliminate any dependency on device name. I /think/ the hotplug will check, I can't easily go thru it myself at this moment.
I don't think so. Here's my /etc/fstab:
LABEL=/ / ext3 defaults 1 1 ... UUID=9dd976ce-a988-42a2-857d-06c3079675e7 /media/usb-disk ext3 defaults 1 2
During boot I see these messages:
Mounting local filesystems [FAILED] ... Mounting other filesystems: mountpoint /media/usb-disk does not exist.
And, in fact, the drive is not mounted.
BTW: Why is this so hard? Am I the only person who wants to do it?
BTW: I thought that the messages that appear on the monitor during boot were saved in /var/log/messages . Apparently not. Are they saved anywhere?
Thanks - jon
Is this worth a bug report?
jon
On Fri, 2007-07-27 at 12:27 +0200, fedora wrote:
As far as logging-boot messages is concerned:
i also thought, that they are kept in /var/log/boot.log or /var/log/boot.msg. but as i googled aroud, i read that from fedora core 6 and fedora 7 on it is no longer so.
Boot messages are maintained in /var/log/dmesg i learned, but this is only about hardware and not about started services.
BTW: I thought that the messages that appear on the monitor during boot were saved in /var/log/messages . Apparently not. Are they saved anywhere?
Jonathan Ryshpan wrote:
On Thu, 2007-07-26 at 17:36 -0400, Bill Davidsen wrote:
Jonathan Ryshpan wrote:
I have a USB drive that is usually, though not always, connected to my desktop system.
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.
If it is not connected at boot time, there should be no serious problem.
If the drive is connected to a running system (on which it had not been previously connected), the device path should be created, and it should be mounted by root.
Root should be able to unmount the drive, when it is mounted.
I assume this should be done by either udev or hal -- HOW?
You may be able to do this just by putting the entry in /etc/fstab, using the UUID of the filesystem to eliminate any dependency on device name. I /think/ the hotplug will check, I can't easily go thru it myself at this moment.
I don't think so. Here's my /etc/fstab:
LABEL=/ / ext3 defaults 1 1 ... UUID=9dd976ce-a988-42a2-857d-06c3079675e7 /media/usb-disk ext3 defaults 1 2
During boot I see these messages:
Mounting local filesystems [FAILED]
... Mounting other filesystems: mountpoint /media/usb-disk does not exist.
And, in fact, the drive is not mounted.
BTW: Why is this so hard? Am I the only person who wants to do it?
BTW: I thought that the messages that appear on the monitor during boot were saved in /var/log/messages . Apparently not. Are they saved anywhere?
Thanks - jon
I suspect the problem is that there is no directory called "/media/usb-disk" as those mount points in /media are generally created at run time, and these mounts happen early. I use directories in /mnt and descriptive names, so maybe create a directory called something like /mnt/usb1, change fstab, and then reboot or just try "mount -a" first.