Search This Blog

Wednesday, March 30, 2011

E-sata, solid, and udisks


Last year I wrote about how to hack hal to recognise disks attached to an e-sata port as removable. Now that udisks is the default disk manager in Solid I will explain how to hack udisks to do the same:

  1. The hal hack is just a xml file that overrides disk's removable flag. With udisks things are a bit more complicated. I had to apply this patch to udisks and recompile it. The patch adds the flag UDISKS_FORCE_SYSTEM_INTERNAL, which lets us mark the disk as internal or external (AKA removable).
  2. Restart udisks. Just kill it and it will restart automatically: killall udisks-daemon # as root
  3. After that we need to add an udev rule which will actually mark the disk as removable:
  4. File /etc/udev/rules.d/99-esata.rules
    DEVPATH=="/devices/pci0000:00/0000:00:1f.2/host4/*", ENV{UDISKS_FORCE_SYSTEM_INTERNAL}="0"
    Change the DEVPATH to match your e-sata port. You can find it using the command:
    Code
    evolucao ~ # find /sys/devices/ -name sdb
    /sys/devices/pci0000:00/0000:00:1f.2/host4/target4:0:0/4:0:0:0/block/sdb
  5. Reload udev rules: udevadm control --reload-rules
That is it :-)

There is already a bug entry about the e-sata problem in udisks' bugzilla. In fact, I found the UDISKS_FORCE_SYSTEM_INTERNAL patch in that bug entry.

8 comments:

cyberbeat said...

I suffer so long from this problem. Always have to give root password in kde to mount my esata drive. I'll try your patch. Is there possibility to get it officially into udisks?

I also found another bug report/possible solution about this. What do you think about that:

https://bugzilla.kernel.org/show_bug.cgi?id=12898

Unknown said...

Good catch, not having such a disk myself, I wouldn't know how to even reproduce it :)

Lamarque said...

@cyberbeat, maybe, the patch is already in udisks' bugzilla for some time. There is another patch in the bug entry to solve it. The oldest patch is there since 2009 so I am not that confident someone will commit either of them.

cyberbeat said...

can you give me the link to the bug report?

Petr Mrázek said...

It would be very cool if it was possible to recognize esata devices reliably. Too bad 'esata' is just a generic sata cable running to an esata connector in my machine. (a desktop box I built myself)
Industry fail?

Anyway, this is a nice solution :)

Lamarque said...

http://bugs.freedesktop.org/show_bug.cgi?id=22879

cyberbeat said...

petr: I think this is a linux fail..under windows it works out of the box, so there are flags, which are not accessible in linux..

Anonymous said...

its a huge fail still existing in suse 12.2...