[ltp] handling UltraBay with hard disk

Peter F. Patel-Schneider linux-thinkpad@linux-thinkpad.org
Tue, 05 May 2009 07:17:29 -0400 (EDT)


From: Simon Williams <simon@systemparadox.co.uk>
Subject: Re: [ltp] handling UltraBay with hard disk
Date: Mon, 04 May 2009 18:46:57 +0100

> Peter F. Patel-Schneider wrote:
>> Hi:
>> There are various how-to's to handle UltraBay HDD holders, but I can't
>> seem to find one that should work in Fedora 10/11.  Does anyone know of
>> a solution to link the pre-eject udev signal to a
>> script that will unmount the disk in an UltraBay HDD holder that works
>> in a modern fashion?  If not, does someone know how the physical removal
>> of an UltraBay HDD holder is handled?
> 
> Same as a CD drive. It's an IDE dev. It's possible to do it with hdparm
> manually, but it's a bit unsafe. Better to get hold of the hotswap
> package (sometimes referred to as debian hotswap) and use that. That
> will allow you to register/unregister the IDE device, but
> mounting/unmounting you'll need to deal with yourself. Also, after
> unregistering you should power down the ultrabay by:
> "echo 1 > /sys/devices/platform/bay.0/eject"
> (requires the IBM-ACPI kernel module).

I don't have the thinkpad bay module, but there is the modern dock/bay
driver which has an undock action (on
/sys/devices/platform/dock.2/undock), which should do the trick (but I'm
not currently doing it).

> And then you'll need to link that script to the ACPI events somehow. I
> never got round to this- it just run the script manually each time.

I followed the advice in ThinkWiki and linked a script to the udev
event, which works.

> I would show you my script, but it's frankly disgusting, and hotswap
> handles all the hard stuff anyway - my script just does (un)mounting,
> etc for me.

Lay it on me.  What I have is a modified version of the hotswap stuff
from ThinkWiki and *it* is a crazy combination of a shell script and
perl.  The ThinkWiki script unmounts, powers off the device, deletes the
device, and then powers off the UltraBay itself, but unfortunately
doesn't quite work in F11.  What I do have working is unmounting and
then deleting the SCSI device.

What I would like to have would be a general script that in a safe and
sane and *general* fashion does everything needed, for any dock/bay
device that has a disk in it (maybe even including a CD).  However, I
don't see how to really correctly do that in a udev rule, particularly
coordinating the actions on the device (unmount, ...) and the bay (power
down).

Perhaps I'm just stuck with my 90% solution (upgraded to a 95%
solution).

I would also like to update the ThinkWiki page
http://www.thinkwiki.org/wiki/How_to_hotswap_UltraBay_devices
but I don't know what can safely be removed.  Perhaps I'll just clean
out anything that looks too old to me and see if anyone screams.

peter