<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.thinkwiki.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Xkahn</id>
	<title>ThinkWiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://www.thinkwiki.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Xkahn"/>
	<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/wiki/Special:Contributions/Xkahn"/>
	<updated>2026-05-03T06:18:48Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.31.12</generator>
	<entry>
		<id>https://www.thinkwiki.org/w/index.php?title=How_to_hotswap_Ultrabay_devices&amp;diff=43424</id>
		<title>How to hotswap Ultrabay devices</title>
		<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/w/index.php?title=How_to_hotswap_Ultrabay_devices&amp;diff=43424"/>
		<updated>2009-06-09T17:33:53Z</updated>

		<summary type="html">&lt;p&gt;Xkahn: /* HAL support */ suffix_outof doesn't exist in the FDI grammar, switching to contains_outof&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The following discusses hotswap (AKA &amp;quot;hotplug&amp;quot;) of devices in the [[Ultrabay]].&lt;br /&gt;
&lt;br /&gt;
This page has a lot of old information.  Some cleanup might be useful.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Which driver?==&lt;br /&gt;
This may be confusing, so first a quick history lesson.&lt;br /&gt;
&lt;br /&gt;
Older ThinkPads (up to the R51, T42p and X40) where fully IDE (PATA) for both the internal HDD and Ultrabay. For this there are two drivers, the modern libata based {{path|ata_piix}} and the old legacy {{path|piix}}/{{path|ide-disk}} combo. Most modern distributions will default to the {{path|ata_piix}} driver, which is really what you want anyway.&lt;br /&gt;
&lt;br /&gt;
ThinkPads like the R52, T43, T43p, X41 and X41 Tablet are strange hybrids, they have a Serial-ATA (SATA) chipset for the internal disk controller, but through a separate SATA-PATA bridge chip the actual disk is still legacy IDE. The Ultrabay though is still connected to the legacy IDE host controller. This results in a setup where the internal disk is handled by a SATA driver and the Ultrabay is handled by either {{path|ata_piix}} or {{path|ide-disk}}.&lt;br /&gt;
&lt;br /&gt;
ThinkPads like the R60, T60 and Z60 series are also hybrids, but they use a native SATA HDD internal. Just like with the previous models though you end up with two separate drivers for the internal HDD and the Ultrabay.&lt;br /&gt;
&lt;br /&gt;
The latest generation ThinkPads like the R400, R500, T400, T500, W500, W700, X200, and X300 are all fully SATA for both the internal HDD and the Ultrabay device, so both are handled by the same SATA driver.&lt;br /&gt;
{{Todo|Figure out in which category the X60 series ThinkPads truly belong. Some of these machines might have been shipped with a 1.8&amp;quot; HDD which is likely to be PATA, in fact the HMM even states so. But tabook and ltwbook only lists SATA models, so the 1.8&amp;quot; model might never have shipped. But even if it did there will be a SATA-PATA bridge chip, so from the OS it will look like SATA.}}&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
|+Overview of disk interface types&lt;br /&gt;
! width=140px|Thinkpad !! internal HDD !! Ultrabay !! Modern Driver !! Old Driver&lt;br /&gt;
|-&lt;br /&gt;
| {{R30}}, {{R31}}, {{R32}}, {{R40}}, {{R50}}, {{R50e}}, {{R50p}}, {{R51}} || Legacy 2.5&amp;quot; IDE (PATA) || Legacy IDE (PATA) || ata_piix || piix + ide-disk&lt;br /&gt;
|-&lt;br /&gt;
| {{R52}} || Legacy 2.5&amp;quot; PATA HDD with conversion to SATA || Legacy IDE (PATA) || ahci + ata_piix || -&lt;br /&gt;
|-&lt;br /&gt;
| {{R60}}, {{R61}} || 2.5&amp;quot; SATA || Legacy IDE (PATA)  || ahci + ata_piix || -&lt;br /&gt;
|-&lt;br /&gt;
| {{R400}}, {{R500}} ||2.5&amp;quot; SATA || SATA || ahci || -&lt;br /&gt;
|-&lt;br /&gt;
| {{T20}}, {{T21}}, {{T22}}, {{T23}}, {{T30}}, {{T40}}, {{T40p}}, {{T41}}, {{T41p}}, {{T42}}, {{T42p}} || Legacy 2.5&amp;quot; IDE (PATA) || Legacy IDE (PATA) || ata_piix || piix + ide-disk&lt;br /&gt;
|-&lt;br /&gt;
| {{T43}}, {{T43p}} || Legacy 2.5&amp;quot; PATA HDD with conversion to SATA || Legacy IDE (PATA) || ahci + ata_piix || -&lt;br /&gt;
|-&lt;br /&gt;
| {{T60}}, {{T60p}}, {{T61}}, {{T61p}} || 2.5&amp;quot; SATA || Legacy IDE (PATA)  || ahci + ata_piix || -&lt;br /&gt;
|-&lt;br /&gt;
| {{T400}}, {{T500}} ||2.5&amp;quot; SATA || SATA || ahci || -&lt;br /&gt;
|-&lt;br /&gt;
| {{X20}}, {{X21}}, {{X22}}, {{X23}}, {{X24}}, {{X30}}, {{X31}}, {{X32}} || Legacy 2.5&amp;quot; IDE (PATA) || Legacy IDE (PATA) || ata_piix || piix + ide-disk&lt;br /&gt;
|-&lt;br /&gt;
| {{X40}} || Legacy 1.8&amp;quot; IDE (PATA) || Legacy IDE (PATA) || ata_piix || piix + ide-disk&lt;br /&gt;
|-&lt;br /&gt;
| {{X41}}, {{X41t}} || Legacy 1.8&amp;quot; PATA HDD with conversion to SATA || Legacy IDE (PATA) || ahci + ata_piix || -&lt;br /&gt;
|-&lt;br /&gt;
| {{X60}}, {{X60s}}, {{x60t}}, {{x61}}, {{x61s}}, {{x61t}} || 2.5&amp;quot; HDD is SATA, 1.8&amp;quot; HDD is PATA with SATA conversion || Legacy IDE (PATA) || ahci + ata_piix || -&lt;br /&gt;
|-&lt;br /&gt;
| {{X200}}, {{X200 Tablet}}, {{X300}}, {{X301}} ||2.5&amp;quot; SATA || SATA || ahci || -&lt;br /&gt;
|-&lt;br /&gt;
| {{W500}}, {{W700}} ||2.5&amp;quot; SATA || SATA || ahci || -&lt;br /&gt;
|-&lt;br /&gt;
| {{Z60m}}, {{Z60t}}, {{Z61e}}, {{Z61m}}, {{Z61p}}, {{Z61t}} || 2.5&amp;quot; SATA || Legacy IDE (PATA) || ahci + ata_piix || -&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{NOTE|Debian users: at least up the the kernel released with Lenny, Debian applies a patch in the Debian kernel sources which prevents the use of &amp;lt;tt&amp;gt;ata_piix&amp;lt;/tt&amp;gt; with PATA devices (like the IDE bus for the Ultrabay). You will have to either use an upstream kernel or (re)patch the Debian kernel sources. &lt;br /&gt;
You may want to have a look at the following Debian bug reports as well: [http://bugs.debian.org/444182 #444182], [http://bugs.debian.org/463833 #463833].}}&lt;br /&gt;
&lt;br /&gt;
==When using the &amp;lt;tt&amp;gt;ata_piix&amp;lt;/tt&amp;gt; driver==&lt;br /&gt;
The following applies when using the &amp;lt;tt&amp;gt;ata_piix&amp;lt;/tt&amp;gt; driver, which is really the driver you should be using if your Ultrabay is legacy IDE (PATA).&lt;br /&gt;
&lt;br /&gt;
You should at least be using a distribution with kernel 2.6.23. If you have a distribution with an older kernel, please update your distribution, as in addition to a newer kernel, you will need some of the newer userland tools.&lt;br /&gt;
&lt;br /&gt;
===Using libata-acpi and udev===&lt;br /&gt;
&lt;br /&gt;
Starting from kernel 2.6.26-rc5, it's possible to use &amp;lt;tt&amp;gt;libata-acpi&amp;lt;/tt&amp;gt; in combination with udev to hotswap. Please check if CONFIG_ATA_ACPI is enabled in your kernel configuration.&lt;br /&gt;
&lt;br /&gt;
For 2.6.25, you need two patches which can be easily backported ([http://article.gmane.org/gmane.linux.acpi.devel/31159],[http://article.gmane.org/gmane.linux.acpi.devel/31369]).&lt;br /&gt;
&lt;br /&gt;
Create a file {{path|/etc/udev/rules.d/50-thinkpad-ultrabay.rules}} with the following contents:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENV{BAY_EVENT}==&amp;quot;3&amp;quot;, ACTION==&amp;quot;change&amp;quot;, SUBSYSTEM==&amp;quot;scsi&amp;quot;, RUN+=&amp;quot;/usr/local/sbin/ultrabay_eject&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Then ensure it has the right permissions&lt;br /&gt;
 chown root:root /etc/udev/rules.d/50-thinkpad-ultrabay.rules&lt;br /&gt;
 chmod 644 /etc/udev/rules.d/50-thinkpad-ultrabay.rules&lt;br /&gt;
For Red Hat/Fedora and other systems with selinux, you also need to set the security context:&lt;br /&gt;
 chcon system_u:object_r:etc_runtime_t:s0 /etc/udev/rules.d/50-thinkpad-ultrabay.rules&lt;br /&gt;
&lt;br /&gt;
Now create the below ultrabay-eject script&lt;br /&gt;
&lt;br /&gt;
===Script for Ultrabay eject===&lt;br /&gt;
&lt;br /&gt;
The following script does the following:&lt;br /&gt;
* Automatically unmounts the relevant filesystems and power off the Ultrabay when the Ultrabay eject lever is released. Screams if some filesystem can't be unmounted.&lt;br /&gt;
&lt;br /&gt;
create a executable file {{path|/usr/local/sbin/ultrabay_eject}} with the following content&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
ULTRABAY_SYSDIR=/sys$DEVPATH&lt;br /&gt;
shopt -s nullglob&lt;br /&gt;
logger ultrabay_eject storage device $DEVPATH&lt;br /&gt;
export DISPLAY=:0.0 # required for notify-send&lt;br /&gt;
&lt;br /&gt;
# Umount the filesystem(s) backed by the given major:minor device(s)&lt;br /&gt;
unmount_rdev() { perl - &amp;quot;$@&amp;quot; &amp;lt;&amp;lt;'EOPERL'  # let's do it in Perl&lt;br /&gt;
        for $major_minor (@ARGV) {&lt;br /&gt;
                $major_minor =~ m/^(\d+):(\d+)$/ or die;&lt;br /&gt;
                push(@tgt_rdevs, ($1&amp;lt;&amp;lt;8)|$2);&lt;br /&gt;
        }&lt;br /&gt;
        # Sort by reverse length of mount point, to unmount sub-directories first&lt;br /&gt;
        open MOUNTS,&amp;quot;&amp;lt;/proc/mounts&amp;quot; or die &amp;quot;$!&amp;quot;;&lt;br /&gt;
        @mounts=sort { length($b-&amp;gt;[1]) &amp;lt;=&amp;gt; length($a-&amp;gt;[1]) } map { [ split ] } &amp;lt;MOUNTS&amp;gt;;&lt;br /&gt;
        close MOUNTS;&lt;br /&gt;
        foreach $m (@mounts) {&lt;br /&gt;
                ($dev,$dir)=@$m;&lt;br /&gt;
                next unless -b $dev;  $rdev=(stat($dev))[6];&lt;br /&gt;
                next unless grep($_==$rdev, @tgt_rdevs);&lt;br /&gt;
                system(&amp;quot;umount&amp;quot;,&amp;quot;-v&amp;quot;,&amp;quot;$dir&amp;quot;)==0  or  $bad=1;&lt;br /&gt;
                if ($bad == 1) {&lt;br /&gt;
                        system(&amp;quot;logger&amp;quot;,&amp;quot;ultrabay_eject&amp;quot;,&amp;quot;ERROR unmounting&amp;quot;,$dev,$dir);&lt;br /&gt;
                        system(&amp;quot;notify-send -u critical -t 300000 \&amp;quot;Error unmounting $dir\&amp;quot; \&amp;quot;Unmounting of $dir on $dev failed!\&amp;quot;&amp;quot;);&lt;br /&gt;
                } else {&lt;br /&gt;
                        system(&amp;quot;logger&amp;quot;,&amp;quot;ultrabay_eject&amp;quot;,&amp;quot;unmounted&amp;quot;,$dev,$dir);&lt;br /&gt;
                        system(&amp;quot;notify-send -u normal -t 300000 \&amp;quot;Unmounted $dir\&amp;quot;&amp;quot;);&lt;br /&gt;
                };&lt;br /&gt;
        }&lt;br /&gt;
        exit 1 if $bad;&lt;br /&gt;
EOPERL&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
# Get the UltraBay's /dev/foo block device node&lt;br /&gt;
ultrabay_dev_node() {&lt;br /&gt;
        UDEV_PATH=&amp;quot;`readlink -e &amp;quot;$ULTRABAY_SYSDIR/block/&amp;quot;*`&amp;quot; || return 1&lt;br /&gt;
        UDEV_NAME=&amp;quot;`udevadm info --query=name --path=$UDEV_PATH`&amp;quot; || return 1&lt;br /&gt;
        echo /dev/$UDEV_NAME&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
if [ -d $ULTRABAY_SYSDIR ]; then&lt;br /&gt;
        sync&lt;br /&gt;
        # Unmount filesystems backed by this device&lt;br /&gt;
        ## This seems to be very inelegant and prone to failure&lt;br /&gt;
        unmount_rdev `cat $ULTRABAY_SYSDIR/block/*/dev     \&lt;br /&gt;
                          $ULTRABAY_SYSDIR/block/*/*/dev`  \&lt;br /&gt;
        || {&lt;br /&gt;
                logger ultrabay_eject umounting failed&lt;br /&gt;
                echo 2 &amp;gt; /proc/acpi/ibm/beep  # triple error tone&lt;br /&gt;
                notify-send -u critical -t 300000 &amp;quot;ThinkPad Ultrabay eject failed&amp;quot; &amp;quot;Please do not pull the device, doing so could cause file corruption and possibly hang the system. Unmounting of the filesystem on the ThinkPad Ultrabay device failed. Please put the eject leaver back in place, and try to unmount the filesystem manually. If this succeeds you can try the eject again&amp;quot;&lt;br /&gt;
                exit 1;&lt;br /&gt;
        }&lt;br /&gt;
        sync&lt;br /&gt;
        # Nicely power off the device&lt;br /&gt;
        DEVNODE=`ultrabay_dev_node` &amp;amp;&amp;amp; hdparm -Y $DEVNODE&lt;br /&gt;
        # Let HAL+KDE notice the unmount and let the disk spin down&lt;br /&gt;
        sleep 0.5&lt;br /&gt;
        # Unregister this SCSI device:&lt;br /&gt;
        sync&lt;br /&gt;
        echo 1 &amp;gt; $ULTRABAY_SYSDIR/delete&lt;br /&gt;
else&lt;br /&gt;
        logger ultrabay_eject no ultrabay device directory&lt;br /&gt;
        echo 2 &amp;gt; /proc/acpi/ibm/beep  # triple error tone&lt;br /&gt;
        exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# We need sleep here so someone can disconnect the bay and the drive&lt;br /&gt;
sleep 1&lt;br /&gt;
&lt;br /&gt;
# Turn off power to the UltraBay&lt;br /&gt;
dock=$( /bin/grep ata_bay /sys/devices/platform/dock.?/type )&lt;br /&gt;
dock=${dock%%/type:ata_bay} # needed for 2.6.27 and later&lt;br /&gt;
if [ -n &amp;quot;$dock&amp;quot; -a -d &amp;quot;$dock&amp;quot; ]; then&lt;br /&gt;
        logger ultrabay_eject undocking $dock&lt;br /&gt;
        echo 1 &amp;gt; $dock/undock&lt;br /&gt;
fi&lt;br /&gt;
# Tell the user we're OK&lt;br /&gt;
logger ultrabay_eject done&lt;br /&gt;
echo 12 &amp;gt; /proc/acpi/ibm/beep&lt;br /&gt;
notify-send -u normal -t 300000 &amp;quot;Safe to remove&amp;quot; &amp;quot;The ThinkPad Ultrabay device can now safely be removed&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Then make sure ownership and permissions are set correct&lt;br /&gt;
 chown root:root /usr/local/sbin/ultrabay_eject&lt;br /&gt;
 chmod 555 /usr/local/sbin/ultrabay_eject&lt;br /&gt;
&lt;br /&gt;
If the &amp;lt;tt&amp;gt;ata_piix&amp;lt;/tt&amp;gt; driver is built in the kernel, it will catch bay events and you will see the&lt;br /&gt;
following message in your system log:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
thinkpad_acpi: another device driver is already handling bay events&lt;br /&gt;
thinkpad_acpi: disabling subdriver bay&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You should load &amp;lt;tt&amp;gt;thinkpad_acpi&amp;lt;/tt&amp;gt; before &amp;lt;tt&amp;gt;ata_piix&amp;lt;/tt&amp;gt; if you want it to handle bay events.&lt;br /&gt;
&lt;br /&gt;
===Script for Ultrabay insert===&lt;br /&gt;
{{WARN|Only needed for kernels prior to 2.6.26}}&lt;br /&gt;
Create {{path|/usr/local/sbin/ultrabay_insert}} with the following content:&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 echo 12 &amp;gt; /proc/acpi/ibm/beep&lt;br /&gt;
 sync&lt;br /&gt;
 echo 0 0 0 &amp;gt; /sys/class/scsi_host/host1/scan&lt;br /&gt;
&lt;br /&gt;
and set the right permissions&lt;br /&gt;
 chown root:root /usr/local/sbin/ultrabay_insert&lt;br /&gt;
 chmod 555 /usr/local/sbin/ultrabay_insert&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Using the generic bay driver and udev===&lt;br /&gt;
{{WARN|If you have kernel 2.6.26 or newer, please use the above [[#Using libata-acpi and udev]] method instead}}&lt;br /&gt;
Starting from kernel 2.6.23-rc3, it's possible to use the generic &amp;lt;tt&amp;gt;bay&amp;lt;/tt&amp;gt; driver in combination with udev to hotswap. Please check if CONFIG_ACPI_BAY is enabled (module or built-in) in your kernel configuration.&lt;br /&gt;
&lt;br /&gt;
Create {{path|/etc/udev/rules.d/ibm-ultrabay.rules}}:&lt;br /&gt;
 ENV{BAY_EVENT}==&amp;quot;3&amp;quot;, KERNEL==&amp;quot;bay.0&amp;quot;, ACTION==&amp;quot;change&amp;quot;, SUBSYSTEM==&amp;quot;platform&amp;quot;, RUN+=&amp;quot;/usr/local/sbin/ultrabay_eject&amp;quot;&lt;br /&gt;
 ENV{BAY_EVENT}==&amp;quot;1&amp;quot;, KERNEL==&amp;quot;bay.0&amp;quot;, ACTION==&amp;quot;change&amp;quot;, SUBSYSTEM==&amp;quot;platform&amp;quot;, RUN+=&amp;quot;/usr/local/sbin/ultrabay_insert&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Starting with kernel 2.6.28, the &amp;lt;tt&amp;gt;bay&amp;lt;/tt&amp;gt; driver was removed from the mainline kernel. The &amp;lt;tt&amp;gt;dock&amp;lt;/tt&amp;gt; driver replaced it completely. Make sure CONFIG_ACPI_DOCK is enabled in the kernel, and use the following udev rules:&lt;br /&gt;
&lt;br /&gt;
 ENV{EVENT}==&amp;quot;undock&amp;quot;, KERNEL==&amp;quot;dock.2&amp;quot;, ACTION==&amp;quot;change&amp;quot;, SUBSYSTEM==&amp;quot;platform&amp;quot;, RUN+=&amp;quot;/usr/local/sbin/ultrabay_eject&amp;quot;&lt;br /&gt;
 ENV{EVENT}==&amp;quot;dock&amp;quot;, KERNEL==&amp;quot;dock.2&amp;quot;, ACTION==&amp;quot;change&amp;quot;, SUBSYSTEM==&amp;quot;platform&amp;quot;, RUN+=&amp;quot;/usr/local/sbin/ultrabay_insert&amp;quot;&lt;br /&gt;
&lt;br /&gt;
However, the ultra_eject script needs to be changed, otherwise udev goes into an infinite event loop. It will send undock events every few seconds forever. That means as soon as the ultrabay is plugged in again, it will be immediately ejected. For kernels 2.6.28 and higher, the bay cannot be powered off using this method, so change the end of the script to read:&lt;br /&gt;
 # Turn off power to the UltraBay:&lt;br /&gt;
 if [ -d /sys/devices/platform/bay.0 ]; then&lt;br /&gt;
 	echo 1 &amp;gt; /sys/devices/platform/bay.0/eject&lt;br /&gt;
 elif [ -e /proc/acpi/ibm/bay ]; then&lt;br /&gt;
 	echo eject &amp;gt; /proc/acpi/ibm/bay&lt;br /&gt;
 fi&lt;br /&gt;
 # Tell the user we're OK&lt;br /&gt;
 echo 12 &amp;gt; /proc/acpi/ibm/beep&lt;br /&gt;
&lt;br /&gt;
Alternatively, instead of modifying the script, use the libata-acpi method below.&lt;br /&gt;
This was tested on a T61p running Gentoo with tuxonice 2.6.28-r8 without any issues.&lt;br /&gt;
&lt;br /&gt;
===Model-specific notes===&lt;br /&gt;
See the table above for a list of ata_piix supported laptops and the bus ID to use.&lt;br /&gt;
&lt;br /&gt;
===HAL support===&lt;br /&gt;
{{HELP| If the script below does not work, or you have a A or W-series ThinkPad, please provide your lshal output on the [[Talk:How_to_hotswap_Ultrabay_devices]] page}}&lt;br /&gt;
{{NOTE| If your HAL version is older then 0.5.11, you need to replace &amp;quot;info.parent&amp;quot; with &amp;quot;storage.physical_device&amp;quot;.}}&lt;br /&gt;
&lt;br /&gt;
HAL support is only needed for proper notification to your desktop applications, such as Gnome and KDE. You will still require the udev script to handle the proper removal.&lt;br /&gt;
&lt;br /&gt;
To tell HAL that devices connected to the UltraBay port are hotpluggable, you need to create a file {{path|/etc/hal/fdi/information/10-thinkpad-ultrabay.fdi}} with the following content:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;ISO-8859-1&amp;quot;?&amp;gt; &amp;lt;!-- -*- SGML -*- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
HAL config file to set ThinkPad Ultrabay eject capability flag.&lt;br /&gt;
Note that ThinkPad model matching is done on a partial match, so T40 will also match T40p, which is what we want.&lt;br /&gt;
&lt;br /&gt;
If your ThinkPad model is not listed, please check with lspci what PCI ID your disk controller is&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;deviceinfo version=&amp;quot;0.2&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;device&amp;gt;&lt;br /&gt;
    &amp;lt;match key=&amp;quot;/org/freedesktop/Hal/devices/computer:system.hardware.version&amp;quot; prefix=&amp;quot;ThinkPad&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;match key=&amp;quot;/org/freedesktop/Hal/devices/computer:system.hardware.vendor&amp;quot; string=&amp;quot;IBM&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        &amp;lt;!-- IBM ThinkPad T20, T21, T22, X20 and X21 --&amp;gt;&lt;br /&gt;
        &amp;lt;match key=&amp;quot;/org/freedesktop/Hal/devices/computer:system.hardware.version&amp;quot; contains_outof=&amp;quot;T20;T21;T22;X20;X21&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;match key=&amp;quot;storage.bus&amp;quot; string_outof=&amp;quot;pci;scsi&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;match key=&amp;quot;info.parent&amp;quot; string=&amp;quot;/org/freedesktop/Hal/devices/pci_8086_7111_scsi_host_0_scsi_device_lun0&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;merge key=&amp;quot;storage.hotpluggable&amp;quot; type=&amp;quot;bool&amp;quot;&amp;gt;true&amp;lt;/merge&amp;gt;&lt;br /&gt;
            &amp;lt;/match&amp;gt;&lt;br /&gt;
          &amp;lt;/match&amp;gt;&lt;br /&gt;
        &amp;lt;/match&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        &amp;lt;!-- IBM ThinkPad T23, T30, X22, X23, X24 and X30 --&amp;gt;&lt;br /&gt;
        &amp;lt;match key=&amp;quot;/org/freedesktop/Hal/devices/computer:system.hardware.version&amp;quot; contains_outof=&amp;quot;T23;T30;X22;X23;X24;X30&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;match key=&amp;quot;storage.bus&amp;quot; string_outof=&amp;quot;pci;scsi&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;match key=&amp;quot;info.parent&amp;quot; string=&amp;quot;/org/freedesktop/Hal/devices/pci_8086_248a_scsi_host_0_scsi_device_lun0&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;merge key=&amp;quot;storage.hotpluggable&amp;quot; type=&amp;quot;bool&amp;quot;&amp;gt;true&amp;lt;/merge&amp;gt;&lt;br /&gt;
            &amp;lt;/match&amp;gt;&lt;br /&gt;
          &amp;lt;/match&amp;gt;&lt;br /&gt;
        &amp;lt;/match&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        &amp;lt;!-- IBM ThinkPad R50, R51, T40, T40p, T41, T41p, X31, X32 and X40 --&amp;gt;&lt;br /&gt;
        &amp;lt;match key=&amp;quot;/org/freedesktop/Hal/devices/computer:system.hardware.version&amp;quot; contains_outof=&amp;quot;R50;R51;T40;T41;T42;X31;X32;X40&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;match key=&amp;quot;storage.bus&amp;quot; string_outof=&amp;quot;pci;scsi&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;match key=&amp;quot;info.parent&amp;quot; string=&amp;quot;/org/freedesktop/Hal/devices/pci_8086_24ca_scsi_host_0_scsi_device_lun0&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;merge key=&amp;quot;storage.hotpluggable&amp;quot; type=&amp;quot;bool&amp;quot;&amp;gt;true&amp;lt;/merge&amp;gt;&lt;br /&gt;
            &amp;lt;/match&amp;gt;&lt;br /&gt;
          &amp;lt;/match&amp;gt;&lt;br /&gt;
        &amp;lt;/match&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        &amp;lt;!-- IBM ThinkPad R52, T43, T43p, X41, Z60m and Z60p --&amp;gt;&lt;br /&gt;
        &amp;lt;match key=&amp;quot;/org/freedesktop/Hal/devices/computer:system.hardware.version&amp;quot; contains_outof=&amp;quot;R52;T43;X41;Z60&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;match key=&amp;quot;storage.bus&amp;quot; string_outof=&amp;quot;pci;scsi&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;match key=&amp;quot;info.parent&amp;quot; string=&amp;quot;/org/freedesktop/Hal/devices/pci_8086_2653_scsi_host_scsi_device_lun0&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;merge key=&amp;quot;storage.hotpluggable&amp;quot; type=&amp;quot;bool&amp;quot;&amp;gt;true&amp;lt;/merge&amp;gt;&lt;br /&gt;
            &amp;lt;/match&amp;gt;&lt;br /&gt;
          &amp;lt;/match&amp;gt;&lt;br /&gt;
        &amp;lt;/match&amp;gt;&lt;br /&gt;
&lt;br /&gt;
      &amp;lt;/match&amp;gt;&lt;br /&gt;
      &amp;lt;match key=&amp;quot;/org/freedesktop/Hal/devices/computer:system.hardware.vendor&amp;quot; string=&amp;quot;LENOVO&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        &amp;lt;!-- will match Lenovo ThinkPad T60, T60p, Z61m, Z61t and Z61p --&amp;gt;&lt;br /&gt;
        &amp;lt;match key=&amp;quot;/org/freedesktop/Hal/devices/computer:system.hardware.version&amp;quot; contains_outof=&amp;quot;T60;Z61&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;match key=&amp;quot;storage.bus&amp;quot; string_outof=&amp;quot;pci;scsi&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;match key=&amp;quot;info.parent&amp;quot; string=&amp;quot;/org/freedesktop/Hal/devices/pci_8086_27df_scsi_host_scsi_device_lun0&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;merge key=&amp;quot;storage.hotpluggable&amp;quot; type=&amp;quot;bool&amp;quot;&amp;gt;true&amp;lt;/merge&amp;gt;&lt;br /&gt;
            &amp;lt;/match&amp;gt;&lt;br /&gt;
          &amp;lt;/match&amp;gt;&lt;br /&gt;
        &amp;lt;/match&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        &amp;lt;!-- will match Lenovo ThinkPad R60 and X60 --&amp;gt;&lt;br /&gt;
        &amp;lt;match key=&amp;quot;/org/freedesktop/Hal/devices/computer:system.hardware.version&amp;quot; contains_outof=&amp;quot;R60;X60&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;match key=&amp;quot;storage.bus&amp;quot; string_outof=&amp;quot;pci;scsi&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;match key=&amp;quot;info.parent&amp;quot; string=&amp;quot;/org/freedesktop/Hal/devices/pci_8086_27c4_scsi_host_scsi_device_lun0&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;merge key=&amp;quot;storage.hotpluggable&amp;quot; type=&amp;quot;bool&amp;quot;&amp;gt;true&amp;lt;/merge&amp;gt;&lt;br /&gt;
            &amp;lt;/match&amp;gt;&lt;br /&gt;
          &amp;lt;/match&amp;gt;&lt;br /&gt;
        &amp;lt;/match&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        &amp;lt;!-- will match Lenovo ThinkPad R61, T61, T61p and X300 --&amp;gt;&lt;br /&gt;
        &amp;lt;match key=&amp;quot;/org/freedesktop/Hal/devices/computer:system.hardware.version&amp;quot; contains_outof=&amp;quot;R61;T61;X300&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;match key=&amp;quot;storage.bus&amp;quot; string_outof=&amp;quot;pci;scsi&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;match key=&amp;quot;info.parent&amp;quot; string=&amp;quot;/org/freedesktop/Hal/devices/pci_8086_2850_scsi_host_scsi_device_lun0&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;merge key=&amp;quot;storage.hotpluggable&amp;quot; type=&amp;quot;bool&amp;quot;&amp;gt;true&amp;lt;/merge&amp;gt;&lt;br /&gt;
            &amp;lt;/match&amp;gt;&lt;br /&gt;
          &amp;lt;/match&amp;gt;&lt;br /&gt;
        &amp;lt;/match&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        &amp;lt;!-- will match Lenovo ThinkPad R400, R500, T400, T500, W500, W700, X200 and X301 --&amp;gt;&lt;br /&gt;
        &amp;lt;match key=&amp;quot;/org/freedesktop/Hal/devices/computer:system.hardware.version&amp;quot; contains_outof=&amp;quot;R400;R500;T400;T500;W500;W700;X200;X301&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;match key=&amp;quot;storage.bus&amp;quot; string_outof=&amp;quot;pci;scsi&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;match key=&amp;quot;info.parent&amp;quot; string=&amp;quot;/org/freedesktop/Hal/devices/pci_8086_2929_scsi_host_0_scsi_device_lun0&amp;quot;&amp;gt;&lt;br /&gt;
              &amp;lt;merge key=&amp;quot;storage.hotpluggable&amp;quot; type=&amp;quot;bool&amp;quot;&amp;gt;true&amp;lt;/merge&amp;gt;&lt;br /&gt;
            &amp;lt;/match&amp;gt;&lt;br /&gt;
          &amp;lt;/match&amp;gt;&lt;br /&gt;
        &amp;lt;/match&amp;gt;&lt;br /&gt;
&lt;br /&gt;
      &amp;lt;/match&amp;gt;&lt;br /&gt;
    &amp;lt;/match&amp;gt;&lt;br /&gt;
  &amp;lt;/device&amp;gt;&lt;br /&gt;
&amp;lt;/deviceinfo&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then ensure it has the right permissions&lt;br /&gt;
&lt;br /&gt;
 chown root:root /etc/hal/fdi/information/10-thinkpad-ultrabay.fdi&lt;br /&gt;
 chmod 644 /etc/hal/fdi/information/10-thinkpad-ultrabay.fdi&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To check the effect, look at your lshal output, the section for your optical disk (/dev/sr0 typically) or your 2nd hdd (/dev/sdb typically) should have storage.hotpluggable = true after restarting your hal deamon or rebooting.&lt;br /&gt;
&lt;br /&gt;
==When using the &amp;lt;tt&amp;gt;ide-disk&amp;lt;/tt&amp;gt; driver==&lt;br /&gt;
The following applies if you use the &amp;lt;tt&amp;gt;ide-disk&amp;lt;/tt&amp;gt; driver for the UltraBay device.&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Note that essentially, you shouldn't be using this driver, and use ata_piix instead unless you're running an older kernel where ata_piix won't work for you&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Hotswapping is supposed to be supported as well, using either hdparm/[http://packages.debian.org/unstable/admin/hotswap Debian hotswap] or [[lt_hotswap]] to (un)register IDE devices. The latter is the recommended method with kernels from 2.6, since it will leave DMA working. However, for recent models (R52, T43, X41, Z60 and later) no method is known to work while maintaining DMA support; see [[Problems with SATA and Linux]].&lt;br /&gt;
&lt;br /&gt;
Only IDE devices (HDD's, optical drives, zip drives) require special treatment - batteries, floppies and other devices can just be pulled from the bay, provided they are not mounted or in use at the time. However, you should still power them down first using the [[ibm-acpi]] eject function.&lt;br /&gt;
&lt;br /&gt;
The [[ibm-acpi]] kernel module has an eject function ({{cmdroot|echo eject &amp;gt; /proc/acpi/ibm/bay}}). This only manages the ACPI calls to power down the device and the bay. It does not actually unregister the device from the IDE driver. {{cmdroot|cat /proc/acpi/ibm/bay}} shows &amp;quot;unoccupied&amp;quot; unless an IDE device is present, but the eject function still works and should still be used.&lt;br /&gt;
&lt;br /&gt;
To unregister the device, you can either use the [http://packages.debian.org/unstable/admin/hotswap Debian hotswap] package, or [[lt_hotswap]]. Note that lt_hotswap doesn't seem to even build on recent (at 2.6.22 or newer, although it probably broke before 2.6.22) and on newer kernels, you should not build/load the old IDE PIIX (CONFIG_BLK_DEV_PIIX) and use the natively hotswapping ata_piix (CONFIG_ATA_PIIX) as explained on the top of this page.&lt;br /&gt;
&lt;br /&gt;
[http://packages.debian.org/unstable/admin/hotswap Debian hotswap] also allows the drive to be swapped as a normal user by default, which is useful. You should use &amp;lt;tt&amp;gt;hotswap&amp;lt;/tt&amp;gt; to unregister the device and then {{cmdroot|echo eject &amp;gt; /proc/acpi/ibm/bay}}. However, if you use this method on a 2.6 kernel, you will lose DMA support for the reinserted drive. This is due to kernel issues. This method was reported to work on a ThinkPad {{T23}} (kernels 2.6.8.1, 2.6.14.2 and 2.6.15-arch) and {{T42}} (kernel 2.6.13), but fails on a ThinkPad {{T43}} (kernel 2.6.14.3).&lt;br /&gt;
&lt;br /&gt;
[[lt_hotswap]] is now the recommended method to un- and reregister the IDE device. It installs as a kernel module and has support for automatically unregistering (if loaded with the auto_eject=1 option) the device when the eject event is generated by [[ibm-acpi]]. It will leave DMA support intact. It has supported to work on a ThinkPad {{T22}} and {{T40}} and should work with many other models (but not recent models which require the &amp;lt;tt&amp;gt;ata_piix&amp;lt;/tt&amp;gt; driver for disk DMA support). With the [[lt_hotswap]] kernel module loaded, run: {{cmdroot|modprobe -r ide_cd &amp;amp;&amp;amp; modprobe -r cdrom &amp;amp;&amp;amp; echo &amp;quot;MSTR eject&amp;quot; &amp;gt; /proc/acpi/lths}}&lt;br /&gt;
&lt;br /&gt;
===HAL support===&lt;br /&gt;
&lt;br /&gt;
HAL support also can also be configured To do so, create the file {{path|/etc/hal/fdi/information/10-ultrabay.fdi}} as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt; &amp;lt;!-- -*- SGML -*- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;deviceinfo version=&amp;quot;0.2&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;device&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;!-- UltraBay Devices --&amp;gt;&lt;br /&gt;
    &amp;lt;match key=&amp;quot;storage.bus&amp;quot; string=&amp;quot;ide&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;match key=&amp;quot;storage.physical_device&amp;quot; string=&amp;quot;/org/freedesktop/Hal/devices/pci_8086_24ca_ide_1_0&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;merge key=&amp;quot;storage.hotpluggable&amp;quot; type=&amp;quot;bool&amp;quot;&amp;gt;true&amp;lt;/merge&amp;gt;&lt;br /&gt;
      &amp;lt;/match&amp;gt;&lt;br /&gt;
    &amp;lt;/match&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;/device&amp;gt;&lt;br /&gt;
&amp;lt;/deviceinfo&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For more details see HAL section for ata driver.&lt;br /&gt;
&lt;br /&gt;
==Password protected HDD==&lt;br /&gt;
&lt;br /&gt;
If you are hot-swapping a hard disk on a Ultrabay HDD tray, and the HDD has a password set, you will have to enter the password before it can be used. Example:&lt;br /&gt;
 hdparm /dev/sdb --security-unlock&lt;br /&gt;
&lt;br /&gt;
[[Category:Scripts]]&lt;br /&gt;
[[Category:HOWTOs]]&lt;/div&gt;</summary>
		<author><name>Xkahn</name></author>
		
	</entry>
	<entry>
		<id>https://www.thinkwiki.org/w/index.php?title=How_to_hotswap_Ultrabay_devices&amp;diff=43377</id>
		<title>How to hotswap Ultrabay devices</title>
		<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/w/index.php?title=How_to_hotswap_Ultrabay_devices&amp;diff=43377"/>
		<updated>2009-06-05T15:33:44Z</updated>

		<summary type="html">&lt;p&gt;Xkahn: /* Details */ Add in details for the T400 (at least)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The following discusses hotswap (AKA &amp;quot;hotplug&amp;quot;) of devices in the [[Ultrabay]].&lt;br /&gt;
&lt;br /&gt;
This page has a lot of old information.  Some cleanup might be useful.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Which driver?==&lt;br /&gt;
This may be confusing, so first a quick history lesson.&lt;br /&gt;
&lt;br /&gt;
Older ThinkPads (up to the R51, T42p and X40) where fully IDE (PATA) for both the internal HDD and Ultrabay. For this there are two drivers, the modern libata based {{path|ata_piix}} and the old legacy {{path|piix}}/{{path|ide-disk}} combo. Most modern distributions will default to the {{path|ata_piix}} driver, which is really what you want anyway.&lt;br /&gt;
&lt;br /&gt;
ThinkPads like the R52, T43, T43p, X41 and X41 Tablet are strange hybrids, they have a Serial-ATA (SATA) chipset for the internal disk controller, but through a separate SATA-PATA bridge chip the actual disk is still legacy IDE. The Ultrabay though is still connected to the legacy IDE host controller. This results in a setup where the internal disk is handled by a SATA driver and the Ultrabay is handled by either {{path|ata_piix}} or {{path|ide-disk}}.&lt;br /&gt;
&lt;br /&gt;
ThinkPads like the R60, T60 and Z60 series are also hybrids, but they use a native SATA HDD internal. Just like with the previous models though you end up with two separate drivers for the internal HDD and the Ultrabay.&lt;br /&gt;
&lt;br /&gt;
The latest generation ThinkPads like the R400, R500, T400, T500, W500, W700, X200, and X300 are all fully SATA for both the internal HDD and the Ultrabay device, so both are handled by the same SATA driver.&lt;br /&gt;
{{Todo|Figure out in which category the X60 series ThinkPads truly belong. Some of these machines might have been shipped with a 1.8&amp;quot; HDD which is likely to be PATA, in fact the HMM even states so. But tabook and ltwbook only lists SATA models, so the 1.8&amp;quot; model might never have shipped. But even if it did there will be a SATA-PATA bridge chip, so from the OS it will look like SATA.}}&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
|+Overview of disk interface types&lt;br /&gt;
! width=140px|Thinkpad !! internal HDD !! Ultrabay !! Modern Driver !! Old Driver&lt;br /&gt;
|-&lt;br /&gt;
| {{R30}}, {{R31}}, {{R32}}, {{R40}}, {{R50}}, {{R50e}}, {{R50p}}, {{R51}} || Legacy 2.5&amp;quot; IDE (PATA) || Legacy IDE (PATA) || ata_piix || piix + ide-disk&lt;br /&gt;
|-&lt;br /&gt;
| {{R52}} || Legacy 2.5&amp;quot; PATA HDD with conversion to SATA || Legacy IDE (PATA) || ahci + ata_piix || -&lt;br /&gt;
|-&lt;br /&gt;
| {{R60}}, {{R61}} || 2.5&amp;quot; SATA || Legacy IDE (PATA)  || ahci + ata_piix || -&lt;br /&gt;
|-&lt;br /&gt;
| {{R400}}, {{R500}} ||2.5&amp;quot; SATA || SATA || ahci || -&lt;br /&gt;
|-&lt;br /&gt;
| {{T20}}, {{T21}}, {{T22}}, {{T23}}, {{T30}}, {{T40}}, {{T40p}}, {{T41}}, {{T41p}}, {{T42}}, {{T42p}} || Legacy 2.5&amp;quot; IDE (PATA) || Legacy IDE (PATA) || ata_piix || piix + ide-disk&lt;br /&gt;
|-&lt;br /&gt;
| {{T43}}, {{T43p}} || Legacy 2.5&amp;quot; PATA HDD with conversion to SATA || Legacy IDE (PATA) || ahci + ata_piix || -&lt;br /&gt;
|-&lt;br /&gt;
| {{T60}}, {{T60p}}, {{T61}}, {{T61p}} || 2.5&amp;quot; SATA || Legacy IDE (PATA)  || ahci + ata_piix || -&lt;br /&gt;
|-&lt;br /&gt;
| {{T400}}, {{T500}} ||2.5&amp;quot; SATA || SATA || ahci || -&lt;br /&gt;
|-&lt;br /&gt;
| {{X20}}, {{X21}}, {{X22}}, {{X23}}, {{X24}}, {{X30}}, {{X31}}, {{X32}} || Legacy 2.5&amp;quot; IDE (PATA) || Legacy IDE (PATA) || ata_piix || piix + ide-disk&lt;br /&gt;
|-&lt;br /&gt;
| {{X40}} || Legacy 1.8&amp;quot; IDE (PATA) || Legacy IDE (PATA) || ata_piix || piix + ide-disk&lt;br /&gt;
|-&lt;br /&gt;
| {{X41}}, {{X41t}} || Legacy 1.8&amp;quot; PATA HDD with conversion to SATA || Legacy IDE (PATA) || ahci + ata_piix || -&lt;br /&gt;
|-&lt;br /&gt;
| {{X60}}, {{X60s}}, {{x60t}}, {{x61}}, {{x61s}}, {{x61t}} || 2.5&amp;quot; HDD is SATA, 1.8&amp;quot; HDD is PATA with SATA conversion || Legacy IDE (PATA) || ahci + ata_piix || -&lt;br /&gt;
|-&lt;br /&gt;
| {{X200}}, {{X200 Tablet}}, {{X300}}, {{X301}} ||2.5&amp;quot; SATA || SATA || ahci || -&lt;br /&gt;
|-&lt;br /&gt;
| {{W500}}, {{W700}} ||2.5&amp;quot; SATA || SATA || ahci || -&lt;br /&gt;
|-&lt;br /&gt;
| {{Z60m}}, {{Z60t}}, {{Z61e}}, {{Z61m}}, {{Z61p}}, {{Z61t}} || 2.5&amp;quot; SATA || Legacy IDE (PATA) || ahci + ata_piix || -&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{NOTE|Debian users: at least up the the kernel released with Lenny, Debian applies a patch in the Debian kernel sources which prevents the use of &amp;lt;tt&amp;gt;ata_piix&amp;lt;/tt&amp;gt; with PATA devices (like the IDE bus for the Ultrabay). You will have to either use an upstream kernel or (re)patch the Debian kernel sources. &lt;br /&gt;
You may want to have a look at the following Debian bug reports as well: [http://bugs.debian.org/444182 #444182], [http://bugs.debian.org/463833 #463833].}}&lt;br /&gt;
&lt;br /&gt;
==When using the &amp;lt;tt&amp;gt;ata_piix&amp;lt;/tt&amp;gt; driver==&lt;br /&gt;
The following applies when using the &amp;lt;tt&amp;gt;ata_piix&amp;lt;/tt&amp;gt; driver, which is really the driver you should be using if your Ultrabay is legacy IDE (PATA).&lt;br /&gt;
&lt;br /&gt;
You should at least be using a distribution with kernel 2.6.23. If you have a distribution with an older kernel, please update your distribution, as in addition to a newer kernel, you will need some of the newer userland tools.&lt;br /&gt;
&lt;br /&gt;
===Script for Ultrabay eject===&lt;br /&gt;
&lt;br /&gt;
The following script does the following:&lt;br /&gt;
* Automatically unmounts the relevant filesystems and power off the Ultrabay when the Ultrabay eject lever is released. Screams if some filesystem can't be unmounted.&lt;br /&gt;
&lt;br /&gt;
create a executable file {{path|/usr/local/sbin/ultrabay_eject}} with the following content&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
ULTRABAY_SYSDIR=/sys$DEVPATH&lt;br /&gt;
shopt -s nullglob&lt;br /&gt;
logger ultrabay_eject storage device $DEVPATH&lt;br /&gt;
export DISPLAY=:0.0 # required for notify-send&lt;br /&gt;
&lt;br /&gt;
# Umount the filesystem(s) backed by the given major:minor device(s)&lt;br /&gt;
unmount_rdev() { perl - &amp;quot;$@&amp;quot; &amp;lt;&amp;lt;'EOPERL'  # let's do it in Perl&lt;br /&gt;
        for $major_minor (@ARGV) {&lt;br /&gt;
                $major_minor =~ m/^(\d+):(\d+)$/ or die;&lt;br /&gt;
                push(@tgt_rdevs, ($1&amp;lt;&amp;lt;8)|$2);&lt;br /&gt;
        }&lt;br /&gt;
        # Sort by reverse length of mount point, to unmount sub-directories first&lt;br /&gt;
        open MOUNTS,&amp;quot;&amp;lt;/proc/mounts&amp;quot; or die &amp;quot;$!&amp;quot;;&lt;br /&gt;
        @mounts=sort { length($b-&amp;gt;[1]) &amp;lt;=&amp;gt; length($a-&amp;gt;[1]) } map { [ split ] } &amp;lt;MOUNTS&amp;gt;;&lt;br /&gt;
        close MOUNTS;&lt;br /&gt;
        foreach $m (@mounts) {&lt;br /&gt;
                ($dev,$dir)=@$m;&lt;br /&gt;
                next unless -b $dev;  $rdev=(stat($dev))[6];&lt;br /&gt;
                next unless grep($_==$rdev, @tgt_rdevs);&lt;br /&gt;
                system(&amp;quot;umount&amp;quot;,&amp;quot;-v&amp;quot;,&amp;quot;$dir&amp;quot;)==0  or  $bad=1;&lt;br /&gt;
                if ($bad == 1) {&lt;br /&gt;
                        system(&amp;quot;logger&amp;quot;,&amp;quot;ultrabay_eject&amp;quot;,&amp;quot;ERROR unmounting&amp;quot;,$dev,$dir);&lt;br /&gt;
                        system(&amp;quot;notify-send -u critical -t 300000 \&amp;quot;Error unmounting $dir\&amp;quot; \&amp;quot;Unmounting of $dir on $dev failed!\&amp;quot;&amp;quot;);&lt;br /&gt;
                } else {&lt;br /&gt;
                        system(&amp;quot;logger&amp;quot;,&amp;quot;ultrabay_eject&amp;quot;,&amp;quot;unmounted&amp;quot;,$dev,$dir);&lt;br /&gt;
                        system(&amp;quot;notify-send -u normal -t 300000 \&amp;quot;Unmounted $dir\&amp;quot;&amp;quot;);&lt;br /&gt;
                };&lt;br /&gt;
        }&lt;br /&gt;
        exit 1 if $bad;&lt;br /&gt;
EOPERL&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
# Get the UltraBay's /dev/foo block device node&lt;br /&gt;
ultrabay_dev_node() {&lt;br /&gt;
        UDEV_PATH=&amp;quot;`readlink -e &amp;quot;$ULTRABAY_SYSDIR/block/&amp;quot;*`&amp;quot; || return 1&lt;br /&gt;
        UDEV_NAME=&amp;quot;`udevadm info --query=name --path=$UDEV_PATH`&amp;quot; || return 1&lt;br /&gt;
        echo /dev/$UDEV_NAME&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
if [ -d $ULTRABAY_SYSDIR ]; then&lt;br /&gt;
        sync&lt;br /&gt;
        # Unmount filesystems backed by this device&lt;br /&gt;
        ## This seems to be very inelegant and prone to failure&lt;br /&gt;
        unmount_rdev `cat $ULTRABAY_SYSDIR/block/*/dev     \&lt;br /&gt;
                          $ULTRABAY_SYSDIR/block/*/*/dev`  \&lt;br /&gt;
        || {&lt;br /&gt;
                logger ultrabay_eject umounting failed&lt;br /&gt;
                echo 2 &amp;gt; /proc/acpi/ibm/beep  # triple error tone&lt;br /&gt;
                notify-send -u critical -t 300000 &amp;quot;ThinkPad Ultrabay eject failed&amp;quot; &amp;quot;Please do not pull the device, doing so could cause file corruption and possibly hang the system. Unmounting of the filesystem on the ThinkPad Ultrabay device failed. Please put the eject leaver back in place, and try to unmount the filesystem manually. If this succeeds you can try the eject again&amp;quot;&lt;br /&gt;
                exit 1;&lt;br /&gt;
        }&lt;br /&gt;
        sync&lt;br /&gt;
        # Nicely power off the device&lt;br /&gt;
        DEVNODE=`ultrabay_dev_node` &amp;amp;&amp;amp; hdparm -Y $DEVNODE&lt;br /&gt;
        # Let HAL+KDE notice the unmount and let the disk spin down&lt;br /&gt;
        sleep 0.5&lt;br /&gt;
        # Unregister this SCSI device:&lt;br /&gt;
        sync&lt;br /&gt;
        echo 1 &amp;gt; $ULTRABAY_SYSDIR/delete&lt;br /&gt;
else&lt;br /&gt;
        logger ultrabay_eject no ultrabay device directory&lt;br /&gt;
        echo 2 &amp;gt; /proc/acpi/ibm/beep  # triple error tone&lt;br /&gt;
        exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# We need sleep here so someone can disconnect the bay and the drive&lt;br /&gt;
sleep 1&lt;br /&gt;
&lt;br /&gt;
# Turn off power to the UltraBay&lt;br /&gt;
dock=$( /bin/grep ata_bay /sys/devices/platform/dock.?/type )&lt;br /&gt;
dock=${dock%%/type:ata_bay} # needed for 2.6.27 and later&lt;br /&gt;
if [ -n &amp;quot;$dock&amp;quot; -a -d &amp;quot;$dock&amp;quot; ]; then&lt;br /&gt;
        logger ultrabay_eject undocking $dock&lt;br /&gt;
        echo 1 &amp;gt; $dock/undock&lt;br /&gt;
fi&lt;br /&gt;
# Tell the user we're OK&lt;br /&gt;
logger ultrabay_eject done&lt;br /&gt;
echo 12 &amp;gt; /proc/acpi/ibm/beep&lt;br /&gt;
notify-send -u normal -t 300000 &amp;quot;Safe to remove&amp;quot; &amp;quot;The ThinkPad Ultrabay device can now safely be removed&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Then make sure ownership and permissions are set correct&lt;br /&gt;
 chown root:root /usr/local/sbin/ultrabay_eject&lt;br /&gt;
 chmod 555 /usr/local/sbin/ultrabay_eject&lt;br /&gt;
&lt;br /&gt;
If the &amp;lt;tt&amp;gt;ata_piix&amp;lt;/tt&amp;gt; driver is built in the kernel, it will catch bay events and you will see the&lt;br /&gt;
following message in your system log:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
thinkpad_acpi: another device driver is already handling bay events&lt;br /&gt;
thinkpad_acpi: disabling subdriver bay&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You should load &amp;lt;tt&amp;gt;thinkpad_acpi&amp;lt;/tt&amp;gt; before &amp;lt;tt&amp;gt;ata_piix&amp;lt;/tt&amp;gt; if you want it to handle bay events.&lt;br /&gt;
&lt;br /&gt;
===Script for Ultrabay insert===&lt;br /&gt;
{{WARN|Only needed for kernels prior to 2.6.26}}&lt;br /&gt;
Create {{path|/usr/local/sbin/ultrabay_insert}} with the following content:&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 echo 12 &amp;gt; /proc/acpi/ibm/beep&lt;br /&gt;
 sync&lt;br /&gt;
 echo 0 0 0 &amp;gt; /sys/class/scsi_host/host1/scan&lt;br /&gt;
&lt;br /&gt;
and set the right permissions&lt;br /&gt;
 chown root:root /usr/local/sbin/ultrabay_insert&lt;br /&gt;
 chmod 555 /usr/local/sbin/ultrabay_insert&lt;br /&gt;
&lt;br /&gt;
===Using libata-acpi and udev===&lt;br /&gt;
&lt;br /&gt;
Starting from kernel 2.6.26-rc5, it's possible to use &amp;lt;tt&amp;gt;libata-acpi&amp;lt;/tt&amp;gt; in combination with udev to hotswap. Please check if CONFIG_ATA_ACPI is enabled in your kernel configuration.&lt;br /&gt;
&lt;br /&gt;
You will also need the above ultrabay-eject script&lt;br /&gt;
&lt;br /&gt;
For 2.6.25, you need two patches which can be easily backported ([http://article.gmane.org/gmane.linux.acpi.devel/31159],[http://article.gmane.org/gmane.linux.acpi.devel/31369]).&lt;br /&gt;
&lt;br /&gt;
Create a file {{path|/etc/udev/rules.d/50-thinkpad-ultrabay.rules}} with the following contents:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ENV{BAY_EVENT}==&amp;quot;3&amp;quot;, ACTION==&amp;quot;change&amp;quot;, SUBSYSTEM==&amp;quot;scsi&amp;quot;, RUN+=&amp;quot;/usr/local/sbin/ultrabay_eject&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Then ensure it has the right permissions&lt;br /&gt;
 chown root:root /etc/udev/rules.d/50-thinkpad-ultrabay.rules&lt;br /&gt;
 chmod 644 /etc/udev/rules.d/50-thinkpad-ultrabay.rules&lt;br /&gt;
For Red Hat/Fedora and other systems with selinux, you also need to set the security context:&lt;br /&gt;
 chcon system_u:object_r:etc_runtime_t:s0 /etc/udev/rules.d/50-thinkpad-ultrabay.rules&lt;br /&gt;
&lt;br /&gt;
===Using the generic bay driver and udev===&lt;br /&gt;
{{WARN|If you have kernel 2.6.26 or newer, please use the above [[#Using libata-acpi and udev]] method instead}}&lt;br /&gt;
Starting from kernel 2.6.23-rc3, it's possible to use the generic &amp;lt;tt&amp;gt;bay&amp;lt;/tt&amp;gt; driver in combination with udev to hotswap. Please check if CONFIG_ACPI_BAY is enabled (module or built-in) in your kernel configuration.&lt;br /&gt;
&lt;br /&gt;
Create {{path|/etc/udev/rules.d/ibm-ultrabay.rules}}:&lt;br /&gt;
 ENV{BAY_EVENT}==&amp;quot;3&amp;quot;, KERNEL==&amp;quot;bay.0&amp;quot;, ACTION==&amp;quot;change&amp;quot;, SUBSYSTEM==&amp;quot;platform&amp;quot;, RUN+=&amp;quot;/usr/local/sbin/ultrabay_eject&amp;quot;&lt;br /&gt;
 ENV{BAY_EVENT}==&amp;quot;1&amp;quot;, KERNEL==&amp;quot;bay.0&amp;quot;, ACTION==&amp;quot;change&amp;quot;, SUBSYSTEM==&amp;quot;platform&amp;quot;, RUN+=&amp;quot;/usr/local/sbin/ultrabay_insert&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Starting with kernel 2.6.28, the &amp;lt;tt&amp;gt;bay&amp;lt;/tt&amp;gt; driver was removed from the mainline kernel. The &amp;lt;tt&amp;gt;dock&amp;lt;/tt&amp;gt; driver replaced it completely. Make sure CONFIG_ACPI_DOCK is enabled in the kernel, and use the following udev rules:&lt;br /&gt;
&lt;br /&gt;
 ENV{EVENT}==&amp;quot;undock&amp;quot;, KERNEL==&amp;quot;dock.2&amp;quot;, ACTION==&amp;quot;change&amp;quot;, SUBSYSTEM==&amp;quot;platform&amp;quot;, RUN+=&amp;quot;/usr/local/sbin/ultrabay_eject&amp;quot;&lt;br /&gt;
 ENV{EVENT}==&amp;quot;dock&amp;quot;, KERNEL==&amp;quot;dock.2&amp;quot;, ACTION==&amp;quot;change&amp;quot;, SUBSYSTEM==&amp;quot;platform&amp;quot;, RUN+=&amp;quot;/usr/local/sbin/ultrabay_insert&amp;quot;&lt;br /&gt;
&lt;br /&gt;
However, the ultra_eject script needs to be changed, otherwise udev goes into an infinite event loop. It will send undock events every few seconds forever. That means as soon as the ultrabay is plugged in again, it will be immediately ejected. For kernels 2.6.28 and higher, the bay cannot be powered off using this method, so change the end of the script to read:&lt;br /&gt;
 # Turn off power to the UltraBay:&lt;br /&gt;
 if [ -d /sys/devices/platform/bay.0 ]; then&lt;br /&gt;
 	echo 1 &amp;gt; /sys/devices/platform/bay.0/eject&lt;br /&gt;
 elif [ -e /proc/acpi/ibm/bay ]; then&lt;br /&gt;
 	echo eject &amp;gt; /proc/acpi/ibm/bay&lt;br /&gt;
 fi&lt;br /&gt;
 # Tell the user we're OK&lt;br /&gt;
 echo 12 &amp;gt; /proc/acpi/ibm/beep&lt;br /&gt;
&lt;br /&gt;
Alternatively, instead of modifying the script, use the libata-acpi method below.&lt;br /&gt;
This was tested on a T61p running Gentoo with tuxonice 2.6.28-r8 without any issues.&lt;br /&gt;
&lt;br /&gt;
===Model-specific notes===&lt;br /&gt;
See the table above for a list of ata_piix supported laptops and the bus ID to use.&lt;br /&gt;
&lt;br /&gt;
===HAL support===&lt;br /&gt;
{{HELP| Please try the new HAL script on the [[Talk:How_to_hotswap_Ultrabay_devices]] page and report if it worked}}&lt;br /&gt;
{{NOTE| Starting from HAL 0.5.11, you need to replace &amp;quot;storage.physical_device&amp;quot; with &amp;quot;info.parent&amp;quot;.}}&lt;br /&gt;
&lt;br /&gt;
Many programs, KDE included, rely on [[HAL]] to get notifications and information about device hotplugging. You need to tell HAL that devices connected the UltraBay port are hotpluggable. To do so, create the file {{path|/etc/hal/fdi/information/10-ultrabay.fdi}} as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt; &amp;lt;!-- -*- SGML -*- --&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;deviceinfo version=&amp;quot;0.2&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;device&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;!-- UltraBay Devices --&amp;gt;&lt;br /&gt;
    &amp;lt;match key=&amp;quot;storage.bus&amp;quot; string=&amp;quot;scsi&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;match key=&amp;quot;storage.physical_device&amp;quot; string=&amp;quot;/org/freedesktop/Hal/devices/pci_8086_2653_scsi_host_0_scsi_device_lun0&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;merge key=&amp;quot;storage.hotpluggable&amp;quot; type=&amp;quot;bool&amp;quot;&amp;gt;true&amp;lt;/merge&amp;gt;&lt;br /&gt;
      &amp;lt;/match&amp;gt;&lt;br /&gt;
    &amp;lt;/match&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;/device&amp;gt;&lt;br /&gt;
&amp;lt;/deviceinfo&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The string &amp;quot;8086_2653&amp;quot; may need to be changed to match your ThinkPad model; see below.&lt;br /&gt;
&lt;br /&gt;
====Details====&lt;br /&gt;
&lt;br /&gt;
By default, HAL doesn't know that UltraBay devices are hotpluggable:&lt;br /&gt;
&lt;br /&gt;
 # PHYSDEV=/org/freedesktop/Hal/devices/pci_8086_2653_scsi_host_0_scsi_device_lun0&lt;br /&gt;
 # UDI=`hal-find-by-property --key storage.physical_device --string $PHYSDEV` || echo Failed&lt;br /&gt;
 # hal-get-property --udi $UDI --key block.device&lt;br /&gt;
 /dev/sdb&lt;br /&gt;
 # hal-get-property --udi $UDI --key storage.hotpluggable&lt;br /&gt;
 false&lt;br /&gt;
&lt;br /&gt;
After creating {{path|/etc/hal/fdi/information/10-ultrabay.fdi}} as above and re-plugging the device, it will get marked correctly:&lt;br /&gt;
&lt;br /&gt;
 # PHYSDEV=/org/freedesktop/Hal/devices/pci_8086_2653_scsi_host_0_scsi_device_lun0&lt;br /&gt;
 # UDI=`hal-find-by-property --key storage.physical_device --string $PHYSDEV` || echo Failed&lt;br /&gt;
 # hal-get-property --udi $UDI --key block.device&lt;br /&gt;
 /dev/sdb&lt;br /&gt;
 # hal-get-property --udi $UDI --key storage.hotpluggable&lt;br /&gt;
 true&lt;br /&gt;
&lt;br /&gt;
The string &amp;quot;8086_2653&amp;quot; gives the PCI ID of the [[Intel 82801FBM]] southbridge. If your model has a different southbridge, or the UltraBay is attached to a different port, then you can find the appropriate &amp;lt;tt&amp;gt;storage.physical_device&amp;lt;/tt&amp;gt; value by finding out the block device of the currently running UltraBay device (&amp;lt;tt&amp;gt;/dev/sdb&amp;lt;/tt&amp;gt; in the following example) and then running:&lt;br /&gt;
&lt;br /&gt;
 # DEVICE=/dev/sdb&lt;br /&gt;
 # UDI=`hal-find-by-property --key block.device --string $DEVICE` || echo Failed&lt;br /&gt;
 # hal-get-property --udi $UDI --key storage.physical_device&lt;br /&gt;
 /org/freedesktop/Hal/devices/pci_8086_2653_scsi_host_0_scsi_device_lun0&lt;br /&gt;
&lt;br /&gt;
If you have a different &amp;lt;tt&amp;gt;storage.physical_device&amp;lt;/tt&amp;gt; value, please report your findings.&lt;br /&gt;
&lt;br /&gt;
{| border=1&lt;br /&gt;
|+ Known South Bridge PCI IDs&lt;br /&gt;
! ID !! ThinkPad model !! South Bridge chip (for Ultrabay) !! parent device (host_0, lun0 = 2nd IDE controller, master device)&lt;br /&gt;
|-&lt;br /&gt;
| 8086_7111 || T20, T21, T22, X20, X21 || Intel 82371AB/EB/MB PIIX4 IDE || /org/freedesktop/Hal/devices/pci_8086_7111_scsi_host_0_scsi_device_lun0&lt;br /&gt;
|-&lt;br /&gt;
| 8086_248a || T23, T30, X22, X23, X24, X30|| Intel 82801CAM IDE U100 (rev 2) || /org/freedesktop/Hal/devices/pci_8086_248a_scsi_host_0_scsi_device_lun0&lt;br /&gt;
|-&lt;br /&gt;
| 8086_24ca || R50, R51, T40, T40p, T41, T41p, T42, T42p, X31, X32, X40 || Intel 82801DBM (ICH4-M) || /org/freedesktop/Hal/devices/pci_8086_24ca_scsi_host_0_scsi_device_lun0&lt;br /&gt;
|-&lt;br /&gt;
| 8086_2653 || R52, T43, T43p, X41  || Intel 82801FBM (ICH6-M) || /org/freedesktop/Hal/devices/pci_8086_2653_scsi_host_scsi_device_lun0&lt;br /&gt;
|-&lt;br /&gt;
| 8086_27c4 || R60, X60 || Intel 82801GBM (ICH7 Family) || /org/freedesktop/Hal/devices/pci_8086_27c4_scsi_host_scsi_device_lun0&lt;br /&gt;
|-&lt;br /&gt;
| 8086_27df || T60, T60p, Z61p || Intel 82801GBM/GHM (ICH7 Family) || /org/freedesktop/Hal/devices/pci_8086_27df_scsi_host_scsi_device_lun0&lt;br /&gt;
|-&lt;br /&gt;
| 8086_2850 || R61, T61, T61p, X300 || Intel 82801H (ICH8 Family) || /org/freedesktop/Hal/devices/pci_8086_2850_scsi_host_scsi_device_lun0&lt;br /&gt;
|-&lt;br /&gt;
| 8086_2929 || R400, R500, T400, T500, W500, X200, X301 || Intel 82801I ICH9 Family || /org/freedesktop/Hal/devices/pci_8086_2929_scsi_host_0_scsi_device_lun0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==When using the &amp;lt;tt&amp;gt;ide-disk&amp;lt;/tt&amp;gt; driver==&lt;br /&gt;
The following applies if you use the &amp;lt;tt&amp;gt;ide-disk&amp;lt;/tt&amp;gt; driver for the UltraBay device.&amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Note that essentially, you shouldn't be using this driver, and use ata_piix instead unless you're running an older kernel where ata_piix won't work for you&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Hotswapping is supposed to be supported as well, using either hdparm/[http://packages.debian.org/unstable/admin/hotswap Debian hotswap] or [[lt_hotswap]] to (un)register IDE devices. The latter is the recommended method with kernels from 2.6, since it will leave DMA working. However, for recent models (R52, T43, X41, Z60 and later) no method is known to work while maintaining DMA support; see [[Problems with SATA and Linux]].&lt;br /&gt;
&lt;br /&gt;
Only IDE devices (HDD's, optical drives, zip drives) require special treatment - batteries, floppies and other devices can just be pulled from the bay, provided they are not mounted or in use at the time. However, you should still power them down first using the [[ibm-acpi]] eject function.&lt;br /&gt;
&lt;br /&gt;
The [[ibm-acpi]] kernel module has an eject function ({{cmdroot|echo eject &amp;gt; /proc/acpi/ibm/bay}}). This only manages the ACPI calls to power down the device and the bay. It does not actually unregister the device from the IDE driver. {{cmdroot|cat /proc/acpi/ibm/bay}} shows &amp;quot;unoccupied&amp;quot; unless an IDE device is present, but the eject function still works and should still be used.&lt;br /&gt;
&lt;br /&gt;
To unregister the device, you can either use the [http://packages.debian.org/unstable/admin/hotswap Debian hotswap] package, or [[lt_hotswap]]. Note that lt_hotswap doesn't seem to even build on recent (at 2.6.22 or newer, although it probably broke before 2.6.22) and on newer kernels, you should not build/load the old IDE PIIX (CONFIG_BLK_DEV_PIIX) and use the natively hotswapping ata_piix (CONFIG_ATA_PIIX) as explained on the top of this page.&lt;br /&gt;
&lt;br /&gt;
[http://packages.debian.org/unstable/admin/hotswap Debian hotswap] also allows the drive to be swapped as a normal user by default, which is useful. You should use &amp;lt;tt&amp;gt;hotswap&amp;lt;/tt&amp;gt; to unregister the device and then {{cmdroot|echo eject &amp;gt; /proc/acpi/ibm/bay}}. However, if you use this method on a 2.6 kernel, you will lose DMA support for the reinserted drive. This is due to kernel issues. This method was reported to work on a ThinkPad {{T23}} (kernels 2.6.8.1, 2.6.14.2 and 2.6.15-arch) and {{T42}} (kernel 2.6.13), but fails on a ThinkPad {{T43}} (kernel 2.6.14.3).&lt;br /&gt;
&lt;br /&gt;
[[lt_hotswap]] is now the recommended method to un- and reregister the IDE device. It installs as a kernel module and has support for automatically unregistering (if loaded with the auto_eject=1 option) the device when the eject event is generated by [[ibm-acpi]]. It will leave DMA support intact. It has supported to work on a ThinkPad {{T22}} and {{T40}} and should work with many other models (but not recent models which require the &amp;lt;tt&amp;gt;ata_piix&amp;lt;/tt&amp;gt; driver for disk DMA support). With the [[lt_hotswap]] kernel module loaded, run: {{cmdroot|modprobe -r ide_cd &amp;amp;&amp;amp; modprobe -r cdrom &amp;amp;&amp;amp; echo &amp;quot;MSTR eject&amp;quot; &amp;gt; /proc/acpi/lths}}&lt;br /&gt;
&lt;br /&gt;
===HAL support===&lt;br /&gt;
&lt;br /&gt;
HAL support also can also be configured To do so, create the file {{path|/etc/hal/fdi/information/10-ultrabay.fdi}} as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt; &amp;lt;!-- -*- SGML -*- --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;deviceinfo version=&amp;quot;0.2&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;device&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;!-- UltraBay Devices --&amp;gt;&lt;br /&gt;
    &amp;lt;match key=&amp;quot;storage.bus&amp;quot; string=&amp;quot;ide&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;match key=&amp;quot;storage.physical_device&amp;quot; string=&amp;quot;/org/freedesktop/Hal/devices/pci_8086_24ca_ide_1_0&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;merge key=&amp;quot;storage.hotpluggable&amp;quot; type=&amp;quot;bool&amp;quot;&amp;gt;true&amp;lt;/merge&amp;gt;&lt;br /&gt;
      &amp;lt;/match&amp;gt;&lt;br /&gt;
    &amp;lt;/match&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;/device&amp;gt;&lt;br /&gt;
&amp;lt;/deviceinfo&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For more details see HAL section for ata driver.&lt;br /&gt;
&lt;br /&gt;
==Password protected HDD==&lt;br /&gt;
&lt;br /&gt;
If you are hot-swapping a hard disk on a Ultrabay HDD tray, and the HDD has a password set, you will have to enter the password before it can be used. Example:&lt;br /&gt;
 hdparm /dev/sdb --security-unlock&lt;br /&gt;
&lt;br /&gt;
[[Category:Scripts]]&lt;br /&gt;
[[Category:HOWTOs]]&lt;/div&gt;</summary>
		<author><name>Xkahn</name></author>
		
	</entry>
</feed>