Search This Blog

Tuesday, September 21, 2010

E-sata and Solid



Some days ago a guy asked in the kde-hardware-devel mailing list how to make disks connected to an e-sata port to behave like removable disk in KDE. I have a notebook (Sager np7652) with one e-sata port and had this problem too, but have never tried to fix that, until now. I think what I have found can help other people too so I am writing this post.

After some tries I found a way to tell hald that my disks' partitions come from a removable disk. That works but have an inconvinience, I needed to create one configuration file per partition. Some more tries and finally I got to configure hald to treat all disks connected to my e-sata controller as removable:

  1. Add this file to your system:

    File /etc/hal/fdi/policy/40-e-sata.fdi
    <?xml version="1.0" encoding="ISO-8859-1"?> <!-- -*- SGML -*- -->
    
    <deviceinfo version="0.2">
      <device>
        <match key="linux.sysfs_path" contains="/sys/devices/pci0000:00/0000:00:1f.2/host4/">
          <merge key="volume.ignore" type="bool">false</merge>
          <merge key="@block.storage_device:storage.removable" type="bool">true</merge>
        </match>
      </device>
    </deviceinfo>
    
  2. Change the contains part to match your e-sata controller's. 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
    
  3. Restart hald: /etc/init.d/hald restart
  4. That's it :-)

The strange thing is that the file /sys/class/block/sdb/removable contains 0, it should contains 1 since the disk is removable. Maybe it is a kernel bug.

Hal is deprecated for some years now, KDE SC, more precisely Solid, is the only desktop/library that uses it extensively. When we, Solid metal-workers, finish Solid transition to udisk and upower probably hal is gonna vanish for ever.

In less than two weeks there will a Solid Sprint in Madri (Spain), I will be there :-), and we are going to discuss how far we are from the end of this transition. Honestly I like hal, it is flexible from users point of view. I have never used udisk and I do not know if it possible to workaround a problem in the kernel such as this one about disks connected to a e-sata controller using udisk. I hope it is.

6 comments:

gondsman said...

Great job! I have (almost) the same problem: I have Linux installed on a fakeRAID (dmraid) array, together with Windows. While Linux works perfectly and mounts automatically its own partitions, the NTFS partition(s) are not recognized by KDE as disks, so they don't appear in Dolphin, device manager and so on as it would be with a single HD. Is there a way to get the standard behavior with fakeRAID? Thanks so much!

Lamarque said...

Hi, probably this will work with fakeRAID too. If lshal can display your fake disk you can use its udi instead of linux.sysfs_path, which was my first try when I attempt to solve this problem. You can use any attribute returned by lshal in the .fdi file.

Dakon said...

It's a common bug of many (e)SATA controllers not to mark the eSATA ports (or any port) as hotpluggable. So maybe the kernel just doesn't know because he can't find out.

Unknown said...

So if HAL is being relaced by udisk, how can you do the same thing with udisk ? :)

Lamarque said...

@Dakon, I've researched a little and it seems the only e-sata driver that supports reporting that one of its ports is e-sata is ahci.ko, which is my controller's driver, so it should work here but it doesn't.

@Fabrice, I do not know, that is why I said "I hope it is" in the end of the post :-) I still need to find out how, but since udisk solid backend will only arrive in KDE SC 4.6 (with lucky) or 4.7 I guess there is at least one more year of hal support in KDE. Unless the Solid::Control free plan really succeeds, which would change solid's API so deeply that hal backend would not work anymore and hal support would be automatically dropped in KDE SC 4.6 early next year. The Solid::Control free plan is gonna affect all Solid's backend, it is a big change and maybe it will not be ready by KDE SC 4.6, so I think KDE SC 4.6 is gonna supports hal too.

Anonymous said...

Thanks for posting these very helpful instructions. Removable media are so much easier to use when they are treated as, well, removable.

For some reason, I had to reboot before KDE would show me my partitions as removable storage. (Admittedly, I did not first try just logging out and back in.) Perhaps on openSUSE 11.3 there is something different from or more than /etc/init.d/haldaemon that needs to be restarted.

I really hope that the devs will keep little problems like this in mind as they continue to build important infrastructure. Sometimes it seems like even root is losing control over how the computer works, which is worrying. Here's hoping that udisk (a) has a real fix for eSATA and/or (b) gives us users a way to hammer in a workaround when things break. The problem may be, as Dakon suggests, at a far lower level than what HAL or Solid deal with, but until it's fixed we still need a way to work around the issue.