# HAL wont mount external UDB hard drives [solved]

## bejayel

Hi there. Seems like this latest hal wont mount external hard drives of any kind for me. USB keys are absolutely fine. Anything i am missing? It used to work when i allowed fixed drives, but in my latest install, i havent enabled that. I have been told i shouldnt.Last edited by bejayel on Sun Dec 06, 2009 8:25 am; edited 1 time in total

----------

## bejayel

Also doesnt mount CD drives. I Can try without the fixed drive policy i guess?

----------

## d2_racing

Hi, can you post this :

```

$ groups

# fdisk -l

```

----------

## luispa

I moved to halevt some time ago and it helps a lot with mount/umount. 

Luis

----------

## bejayel

```

wheel floppy audio cdrom video games usb users plugdev <myUser>

```

```

Disk /dev/sda: 120.0 GB, 120034123776 bytes

255 heads, 63 sectors/track, 14593 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk identifier: 0x08530852

   Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *           1          34      273073+  83  Linux

/dev/sda2              35         557     4200997+  82  Linux swap / Solaris

/dev/sda3             558       14593   112744170   83  Linux

Disk /dev/sdc: 750.2 GB, 750156374016 bytes

255 heads, 63 sectors/track, 91201 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk identifier: 0x2f327c89

   Device Boot      Start         End      Blocks   Id  System

/dev/sdc1               1       91201   732572001   83  Linux

Disk /dev/sdd: 160.0 GB, 160041885696 bytes

64 heads, 4 sectors/track, 1221022 cylinders

Units = cylinders of 256 * 512 = 131072 bytes

Disk identifier: 0xc463a224

   Device Boot      Start         End      Blocks   Id  System

/dev/sdd1               1     1221022   156290814   83  Linux

Disk /dev/sdb: 320.1 GB, 320072933376 bytes

255 heads, 63 sectors/track, 38913 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk identifier: 0x164e164d

   Device Boot      Start         End      Blocks   Id  System

/dev/sdb1               1       38913   312568641   83  Linux

```

----------

## bejayel

would this be the type of action if the fs was not recognizable?

Definitely a bad FS type. I cant get it to mount though. It is a weird kind of fat filesystem that is available in windows 7. Seems like linux just wont read it.

----------

## lyallp

I use halevt

```

[I] sys-apps/halevt

     Available versions:  (~)0.1.4-r1[1] 0.1.4-r2 (~)0.1.5 {nls rpath}

     Installed versions:  0.1.5(18:53:40 06/10/09)(nls -rpath)

     Homepage:            http://www.environnement.ens.fr/perso/dumas/halevt.html

     Description:         A daemon built on ivman that executes arbitrary commands on HAL events

[1] /portage/Repository/local

```

I have found that I prefer to use pmount

```
 [I] sys-apps/pmount

     Available versions:  0.9.19 ~0.9.20 {crypt hal}

     Installed versions:  0.9.19(18:25:57 26/09/09)(crypt hal)

     Homepage:            http://pmount.alioth.debian.org/

     Description:         Policy based mounter that gives the ability to mount removable devices as a user

```

rather than halevt-mount as halevt-mount does not mount with userid/group/permissions that I wanted.

What I end up with is that USB disks/keys mount under /media with their disk label as the directory name.

So, if I have a disk labelled 'backups', it mounts under '/media/backups'.

Additionally, the files are owned by root but are also writable by plugdev group.

My user is a member of plugdev group so I can write to the device.

Finally, pumount disk-label, enables me to unmount the device. 

```
pumount backups
```

If I want to re-mount it later, without unplugging/plugging, I simply

```
pmount /dev/disk/by-label/backups backups
```

This also works for devices formatted with NTFS and using ntfs-3g with FUSE enabled in the kernel.

```
[I] sys-fs/ntfs3g

     Available versions:  2009.3.8 (~)2009.4.4 (~)2009.4.4-r1 (~)2009.11.14 {acl debug external-fuse hal suid}

     Installed versions:  2009.11.14(13:39:28 21/11/09)(acl external-fuse hal -debug -suid)

     Homepage:            http://www.ntfs-3g.org

     Description:         Open source read-write NTFS driver that runs under FUSE

```

I had to alter the halevt.config a touch, here is my config.

```

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE halevt:Configuration [

<!-- this entity corresponds with mountable devices, which have 

 volume.policy.should_mount true or don't have 

 volume.policy.should_mount false and are block devices hotpluggable or

 removable.

-->

<!ENTITY MOUNTABLE "hal.block.device &amp; hal.block.is_volume = true &amp; (hal.volume.policy.should_mount = true | ((! hal.volume.policy.should_mount = false) &amp; (hal.block.storage_device.hal.storage.policy.should_mount = true | ((! hal.block.storage_device.hal.storage.policy.should_mount = false)  &amp; (hal.block.storage_device.hal.storage.hotpluggable = true | hal.block.storage_device.hal.storage.removable = true)))))">

<!ENTITY MOUNT_COMMAND "pmount --umask 002 --dmask 002 --read-write --noatime --type $hal.volume.fstype$ $hal.block.device$ '$hal.volume.label$'">

]>

<halevt:Configuration version="0.1" xmlns:halevt="http://www.environnement.ens.fr/perso/dumas/halevt.html">

<!--

Remember to use &amp; and &quot; for & and " in xml attributes.

In a match attribute, hal.* is special since it matches any device.

In a match attribute property it is possible to refer to other

device properties. For example 

hal.block.storage_device.hal.storage.policy.should_mount

refers to the storage.policy.should_mount property of the block.storage_device

device associated with a given device.

In an exec attribute, $hal.udi$ is special since it is replaced by

the device udi. $hal.some.property$ is replaced by the value

of the property some.property.

!-->

<!--

Removable devices support

!-->

<!--

This rule matches removable devices which have volume.policy.should_mount true

or don't have volume.policy.should_mount false.

Upon insertion, they are mounted and recorded by halevt-mount. 

-m 002 sets the umask of mount to 002 when pmount is used system-wide

to mount the device. This allows regular users to read the device.

!-->

<halevt:Device match="&MOUNTABLE;">

   <!-- <halevt:Insertion exec="halevt-mount -u $hal.udi$ -o sync -m 002"/> -->

   <halevt:Insertion exec="&MOUNT_COMMAND;"/>

   <!-- <halevt:Insertion exec="halevt-mount -u $hal.udi$ -d /dev/disk/by-uuid/$hal.volume.uuid$ -m 002"/> -->

</halevt:Device>

<!-- if didn't mount using uuid, try mounting by label -->

<!--

<halevt:Device match="&MOUNTABLE; &amp; ! hal.volume.is_mounted;">

   <halevt:Insertion exec="halevt-mount /mnt/$hal.volume.label$"/>

</halevt:Device>

-->

<!--

When a device get a mount point, it is passed to halevt-mount which can 

record it. The property that changes is volume.is_mounted, and the action is

executed when the value of volume.is_mounted becomes true.

!-->

<halevt:Device match="hal.block.device &amp; hal.block.is_volume = true &amp; hal.volume.mount_point">

   <halevt:Property name="hal.volume.is_mounted">

      <halevt:Action value="true" exec="halevt-mount -s"/>

   </halevt:Property>

</halevt:Device>

<!--

When a device is unmounted, it is recorded by halevt-mount.

!-->

<halevt:Device match="hal.block.device &amp; hal.block.is_volume = true">

    <halevt:Property name="hal.volume.is_mounted">

        <halevt:Action value="false" exec="halevt-mount -s"/>

    </halevt:Property>

</halevt:Device>

<!--

When a device is removed, it is recorded by halevt-mount.

Note that at that point the device is already out of hal, so we use

* which matches any device in the match attribute, and only pass the

udi to the command.

!-->

<halevt:Device match="hal.*">

     <halevt:Removal exec="halevt-umount -u $hal.udi$ -d /dev/disk/by-uuid/$hal.volume.uuid$; halevt-umount -s"/>

     <!-- <halevt:Removal exec="halevt-umount -u $hal.udi$; halevt-umount -s"/> -->

</halevt:Device>

<!-- 

Example of a use of OnInit. At startup all the devices are matched and the exec

comand is run for those that match. Here we match all the removable devices

that aren't already mounted and mount and register them.

!-->

<halevt:Device match="&MOUNTABLE;">

   <halevt:OnInit exec="&MOUNT_COMMAND;"/>

   <!-- <halevt:OnInit exec="halevt-mount -u $hal.udi$ -o sync -m 002"/> -->

</halevt:Device>

<!-- if didn't mount using uuid, try mounting by label -->

<!--

<halevt:Device match="&MOUNTABLE; &amp; ! hal.volume.is_mounted;">

   <halevt:OnInit exec="halevt-mount /mnt/$hal.volume.label$"/>

</halevt:Device>

-->

<!-- 

Example of a use of Condition. When a device matches and the condition has become

true for that device, the corresponding exec command is launched.

-->

<halevt:Device match="hal.info.udi = /org/freedesktop/Hal/devices/acpi_PWRF">

    <halevt:Condition name="ButtonPressed" exec="/usr/bin/sudo /sbin/shutdown"/>

</halevt:Device>

<!-- 

Example of a use of Condition with detail value attribute. This condition

differentiates between three different hotkeys for a ButtonPressed event

and performs the appropriate action for each.

-->

<halevt:Device match="hal.input.originating_device.hal.info.linux.driver = atkbd">

    <halevt:Condition name="ButtonPressed" value="mute"        exec="amixer -q set Master toggle"/>

    <halevt:Condition name="ButtonPressed" value="volume-down" exec="amixer -q set Master 1-"/>

    <halevt:Condition name="ButtonPressed" value="volume-up"   exec="amixer -q set Master 1+"/>

</halevt:Device>

<!-- 

Example of a use of OnInit. At startup all the devices are matched and the exec

comand is run for those that match.

<halevt:Device match="hal.info.category = battery">

    <halevt:OnInit exec="hvbattery -u $hal.udi$ -l $hal.battery.charge_level.percentage$ -s $hal.battery.rechargeable.is_discharging"/>

</halevt:Device>

!-->

</halevt:Configuration>

```

----------

