specifying mount options and mount points

Dan Lipsitt danlipsitt at gmail.com
Tue Jun 27 14:39:26 PDT 2006


I am running RHEL 4.2 with hal version 0.4.2 (hal-0.4.2-3.EL4 rpm).

I have an old IDE disk in an external USB enclosure. I want the system
to recognize the disk and mount some of its partitions read-only in a
specific place. I want the old root partition to be mounted at
/media/oldsys/, the old /boot partition at /media/oldsys/boot, etc.
Here are the current contents of my configuration file, which I have
put in  /usr/share/hal/fdi/95userpolicy/ :

<?xml version="1.0" encoding="ISO-8859-1"?>
<deviceinfo>

<device>
  <match key="block.is_volume" bool="true">
    <match key="volume.fsusage" string="filesystem">
      <match key="volume.uuid" string="d84860c5-bc67-42c0-849b-287238aca7a5">
	<merge key="storage.policy.default.mount_root" type="string">/media</merge>
        <merge key="volume.policy.desired_mount_point"
type="string">oldsys</merge>
	<merge key="storage.policy.mount_option.ro" type="bool">true</merge>
      </match>
    </match>
  </match>
</device>

<device>
  <match key="block.is_volume" bool="true">
    <match key="volume.fsusage" string="filesystem">
      <match key="volume.uuid" string="37de66a1-d856-40bd-94bf-de19d147ac70">
	<merge key="storage.policy.default.mount_root"
type="string">/media/oldsys</merge>
        <merge key="volume.policy.desired_mount_point"
type="string">boot</merge>
	<merge key="storage.policy.mount_option.ro" type="bool">true</merge>
      </match>
    </match>
  </match>
</device>

<device>
  <match key="block.is_volume" bool="true">
    <match key="volume.fsusage" string="filesystem">
      <match key="volume.uuid" string="d5265e46-6571-4416-a43f-a5e89d7b61ab">
	<merge key="storage.policy.default.mount_root"
type="string">/media/oldsys</merge>
        <merge key="volume.policy.desired_mount_point" type="string">var</merge>
	<merge key="storage.policy.mount_option.ro" type="bool">true</merge>
      </match>
    </match>
  </match>
</device>

</deviceinfo>

Here are the resulting relevant lines in /etc/mtab :

/dev/sda1 /media/boot ext3 rw,nosuid,nodev,sync,noatime,user=dan 0 0
/dev/sda2 /media/oldsys ext3 rw,nosuid,nodev,user=dan 0 0
/dev/sda5 /media/var ext3 rw,nosuid,nodev,sync,noatime,user=dan 0 0

The match rules work and the filesystems are mounted. However, there
are several problems:
1) The partitions are mounted read-write.
2) The partitions which are intended to be submounts of /media/oldsys
(var, boot) are mounted in /media .
3) The flag user=dan has been added.

I have tried the following variations in my config file:

A)
<merge key="storage.policy.default.mount_option.ro" type="bool">true</merge>
instead of
<merge key="storage.policy.mount_option.ro" type="bool">true</merge>

B)
<merge key="storage.policy.default.mount_root" type="string">/media</merge>
<merge key="volume.policy.desired_mount_point" type="string">oldsys/var</merge>
instead of
<merge key="storage.policy.default.mount_root"
type="string">/media/oldsys</merge>
<merge key="volume.policy.desired_mount_point" type="string">var</merge>

When I do B, var is mounted as /media/oldsys-var .

Any suggestions?

Also, while I've been testing various configurations, I've been
unmounting the disks and unplugging/replugging the usb cable to get
hal to re-scan the bus. Is there a better way to do this?

Thanks,
Dan


More information about the hal mailing list