# [Solved] Auto mount eSATA drive

## NTICompass

I have an eSATA external HDD.  I have enabled AHCI in my BIOS.  When I turn the drive on, how can I make it automount, like if I were to have plugged in a USB drive?Last edited by NTICompass on Sat Jul 25, 2009 11:54 pm; edited 1 time in total

----------

## fangorn

The device node is the same if you plug in a second drive via usb or eSATA. If you have udev rules for your usb devices, create one that matches youre eSATA drive. If you don't then automounting of for example /dev/sdb5 should work, regardless if /dev/sdb is plugged in via usb of eSATA.

----------

## d2_racing

Hi, what happen if you plug your Esata drive and then you run this :

```

# dmesg | tail

# fdisk -l

# mount

```

----------

## geraldine

 *NTICompass wrote:*   

> I have an eSATA external HDD.  I have enabled AHCI in my BIOS.  When I turn the drive on, how can I make it automount, like if I were to have plugged in a USB drive?

 

No need to set up to make it automount, that is the default.

----------

## NTICompass

I can correctly plug in and mount the drive, that is not the problem.  I want to make it automount when I plug it in.  I have 2 external hard drives.  One is USB and the other eSATA.  When I plug in the USB one, it automounts and appears on my desktop.  When I plug in the eSATA one, I need to manually mount it,  I want the eSATA drive to automount.

I don't know much about udev, how would I set that up?  Also, my eSATA drive is currently /dev/sdb1, but that will NOT always be the case.  IF I plug in my USB external first, or plug in a flash drive, that will become /dev/sdb1.

So, how do I make my eSATA automount when it's plugged in?

I have gnome-base/gnome-mount installed with the USE flag nautilus, and gnome-base/gnome-volume-manager installed with the USE flag automount.  What if I used a package like net-fs/autofs?

----------

## NTICompass

I followed the instructions located here.  That worked, it make my eSATA mount when I turned it on, and I was able to unmount it from nautilus.  But, this also mounted ALL of my internal hard drives (partitions).  I don't want that.  That's what /etc/fstab is for.

So, how do I make my eSATA drive mount automatically when I turn it on, and be able to unmount it from nautilus (without auto-mounting all other drives, i.e use /etc/fstab correctly)?

----------

## civilian

hal can change settings for a specific devive. Heres how I did it for my touchpad:

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

<deviceinfo version="0.2">

   <device>

      <match key="info.product" string="ETPS/2 Elantech Touchpad">

         <merge key="input.x11_driver" type="string">synaptics</merge>

         <merge key="input.x11_options.SHMConfig" type="string">on</merge>

        ...

      </match>

   </device>

</deviceinfo>
```

You might be able to identify your internal drives by a serial number or bus address, and then disable automounting on a per device basis.

----------

## NTICompass

 *civilian wrote:*   

> hal can change settings for a specific devive. Heres how I did it for my touchpad:
> 
> ```
> <?xml version="1.0" encoding="ISO-8859-1"?>
> 
> ...

 

I don't know anything about HAL policy files.  Anyone got anymore info?

----------

## civilian

lshal will give you device information in the form that hal sees it. You will have to filter through it to find the right device.

My touchpad has a subfield

```
info.product = 'ETPS/2 Elantech Touchpad'   (string)
```

which corresponds with the

```
<match key="info.product" string="ETPS/2 Elantech Touchpad">
```

line in the policy file.

Sadly, I can't give you much more help, since I only learned enough to get my touchpad working.

Btw, I heard somewhere that hal is supposed to be deprecated (not sure about this), so this might just be a temporary solution.

----------

## civilian

The "block.storage_device" subfield gives my sata2 drive's serial at the end.

----------

## NTICompass

 *civilian wrote:*   

> lshal will give you device information in the form that hal sees it. You will have to filter through it to find the right device.
> 
> My touchpad has a subfield
> 
> ```
> ...

 

Thanks.  I'll see what I can figure out.

----------

## NTICompass

civilian, making a HAL file is exactly what I need to do.  Thanks.

After some research, I found instructions here: http://vstone.eu/2009/04/hal-and-auto-mounting-external-e-sata-devices/

----------

## Luud

Thanks for this input all. It works for me now as well. It even works when I create LUKS encrypted volumes on it, super!

I created the file /etc/hal/fdi/policy/50-esata-HDDrive_2_Go-Luud.fdi with the following content for my Medion HDDrive2Go:

```
<?xml version="1.0" encoding="UTF-8"?> <!-- -*- SGML -*- --> 

<deviceinfo version="0.2">

<device>

  <!-- Luud's Medion HDDrive 2 Go 1000 GB -->

  <match key="storage.serial" string="SATA_ST31000333AS_9TE0D1Z2">

    <merge key="storage.is_external" type="bool">true</merge>

  </match>

  <match key="storage.is_external" bool="true">

    <merge key="storage.removable" type="bool">true</merge>

    <merge key="storage.hotpluggable" type="bool">true</merge>

    <merge key="volume.ignore" type="bool">false</merge>

  </match>

  <match key="@block.storage_device:storage.is_external" bool="true">

    <merge key="volume.ignore" type="bool">false</merge>

  </match>

</device>

</deviceinfo>
```

----------

