Ultrabay use with an advanced dock (T61).

T60/T61 series specific matters only
Post Reply
Message
Author
newyorkpaulie
Sophomore Member
Posts: 202
Joined: Fri Sep 29, 2006 6:49 am
Location: new york (duhh)

Ultrabay use with an advanced dock (T61).

#1 Post by newyorkpaulie » Mon Apr 08, 2013 8:38 am

Can drives in the ultrabay drive slot in the advanced dock be safely removed/inserted while the machine is running? I was not able to do this with my T30 so I'm hesitant to try this without first checking here.

Cigarguy
ThinkPadder
ThinkPadder
Posts: 1435
Joined: Thu Aug 09, 2012 3:08 pm
Location: Calgary, Alberta, Canada

Re: Ultrabay use with an advanced dock (T61).

#2 Post by Cigarguy » Mon Apr 08, 2013 2:26 pm

A T61, being PATA at the Ultrabay interface, hot swapping is a no no. It's OK to do this on most SATA interface but I would not recommend it on PATA.

newyorkpaulie
Sophomore Member
Posts: 202
Joined: Fri Sep 29, 2006 6:49 am
Location: new york (duhh)

Re: Ultrabay use with an advanced dock (T61).

#3 Post by newyorkpaulie » Mon Apr 08, 2013 3:15 pm

Cigarguy wrote:A T61, being PATA at the Ultrabay interface, hot swapping is a no no. It's OK to do this on most SATA interface but I would not recommend it on PATA.
But my ultrabay devices take SATA drives. Does that mean it's OK to swap?

Cigarguy
ThinkPadder
ThinkPadder
Posts: 1435
Joined: Thu Aug 09, 2012 3:08 pm
Location: Calgary, Alberta, Canada

Re: Ultrabay use with an advanced dock (T61).

#4 Post by Cigarguy » Mon Apr 08, 2013 3:20 pm

Yes the Ultrabay adapter takes SATA drives, but the Ultrabay adapter hooks up to the computer via a PATA to SATA adapter. So natively it is a PATA connection. You can try it for youself. Take it out with the machine on. Your T61 will whine at you and will not recognize any device in there until you restart.

newyorkpaulie
Sophomore Member
Posts: 202
Joined: Fri Sep 29, 2006 6:49 am
Location: new york (duhh)

Re: Ultrabay use with an advanced dock (T61).

#5 Post by newyorkpaulie » Mon Apr 08, 2013 5:49 pm

Cigarguy wrote:Yes the Ultrabay adapter takes SATA drives, but the Ultrabay adapter hooks up to the computer via a PATA to SATA adapter. So natively it is a PATA connection. You can try it for youself. Take it out with the machine on. Your T61 will whine at you and will not recognize any device in there until you restart.
Well I didn't get the whine, but you're right about its not seeing the swapped drive. Thanks.

jcvjcvjcvjcv
Senior Member
Senior Member
Posts: 722
Joined: Tue Jun 26, 2007 8:42 pm
Location: Amsterdam, The Netherlands

Re: Ultrabay use with an advanced dock (T61).

#6 Post by jcvjcvjcvjcv » Tue Apr 09, 2013 1:00 pm

I can remove and insert the optical drive of my T61 as often as I like and it will always get recognized without reboot. Can't speak for the HDD in Ultrabay adapters though. Only have one optical drive and one ultrabay battery.
W520
T61

dr_st
Senior ThinkPadder
Senior ThinkPadder
Posts: 6647
Joined: Sat Oct 29, 2005 6:20 am

Re: Ultrabay use with an advanced dock (T61).

#7 Post by dr_st » Tue Apr 09, 2013 2:25 pm

I'm also curious as to why it would be problematic via the dock, when it works without issues with the ultrabay on the laptop itself (which is also PATA).

Maybe the problem is with hard drives? I only really tried it with opticals/floppies.
Current: X220 4291-4BG, T410 2537-R46, T60 1952-F76, T60 2007-QPG, T42 2373-F7G
Collectibles: T430s (IPS FHD + Classic Keyboard), X32 (IPS Screen)
Retired: X61 7673-V2V, A31p w/ Ultrabay Numpad
Past: Z61t 9440-A23, T60 2623-D3U, X32 2884-M5U

Cigarguy
ThinkPadder
ThinkPadder
Posts: 1435
Joined: Thu Aug 09, 2012 3:08 pm
Location: Calgary, Alberta, Canada

Re: Ultrabay use with an advanced dock (T61).

#8 Post by Cigarguy » Tue Apr 09, 2013 8:25 pm

I use 3 Ultrabay adapter with a HDD in my T61s. The few times that I disconnect and reconnect the Ultrabay adapter it did not like it and would not recognize it until I reset the system. Sounds like it varies depending on device. Best way to know is to try it on your machine and see what happens.

91011
Junior Member
Junior Member
Posts: 438
Joined: Sun Feb 01, 2009 6:10 pm
Location: Centennial, CO

Re: Ultrabay use with an advanced dock (T61).

#9 Post by 91011 » Tue Apr 09, 2013 10:37 pm

If Windows doesn’t detect the Ultrabay HDD when it’s reinserted you can use the Rescan button in Device Manager to reinstall the drive – saves rebooting.
X301 -- X201s -- X2faux1s -- X201 -- x230 -- T61 -- T60p -- T42p

newyorkpaulie
Sophomore Member
Posts: 202
Joined: Fri Sep 29, 2006 6:49 am
Location: new york (duhh)

Re: Ultrabay use with an advanced dock (T61).

#10 Post by newyorkpaulie » Wed Apr 10, 2013 4:57 am

91011 wrote:If Windows doesn’t detect the Ultrabay HDD when it’s reinserted you can use the Rescan button in Device Manager to reinstall the drive – saves rebooting.
Do you know of a way to duplicate this with Linux? (not a Windows fan)

rumbero
Junior Member
Junior Member
Posts: 451
Joined: Fri Mar 04, 2011 7:02 pm
Location: Barcelona, Spain

Re: Ultrabay use with an advanced dock (T61).

#11 Post by rumbero » Wed Apr 10, 2013 5:52 am

newyorkpaulie wrote:Do you know of a way to duplicate this with Linux? (not a Windows fan)
See thinkwiki.org/wiki/How_to_hotswap_Ultrabay_devices for details and also thinkwiki.org/wiki/Talk:How_to_hotswap_Ultrabay_devices for further discussion about that topic.

I actually had the ultrabay_eject script from this site working in Debian on various T61's and actually could hotswap HDD's this way.
With most recent kernels (3.7 and 3.8, maybe even 3.6) this doesn't appear to be working for me anymore, even after having updated the DEVPATH to the recenty changed value, as explained in the script's comment section.
Still investigating what is failing here.
Broken T23 2647-9RG | A few 14.1" T61 Frankenpads | Two 15" Frankenpad T61+ with UXGA IPS Display

aoitenshi
Sophomore Member
Posts: 130
Joined: Sat Oct 06, 2012 9:54 pm
Location: Depok, Indonesia

Re: Ultrabay use with an advanced dock (T61).

#12 Post by aoitenshi » Wed Apr 10, 2013 8:36 am

I always do hot-swapping on my ultrabay when my T61 is running ...
Well I guess because I activate the AHCI mode ...

tested on my T61, when I put 7200 rpm HDD or SSD inside the ultrabay (with 2504 dock ) ...
works fine on winXP x86 and Win7 x64

I just select "eject" and then the pop-up message show up, telling me that it's now safe to remove the hardware (the ultrabay) ... and I can insert the optical drive back, and the system will recognized the optical drive ..
Hello world.

newyorkpaulie
Sophomore Member
Posts: 202
Joined: Fri Sep 29, 2006 6:49 am
Location: new york (duhh)

[SOLVED] Re: Ultrabay use with an advanced dock (T61).

#13 Post by newyorkpaulie » Wed Apr 10, 2013 3:44 pm

aoitenshi wrote:I always do hot-swapping on my ultrabay when my T61 is running ...
Well I guess because I activate the AHCI mode ...

tested on my T61, when I put 7200 rpm HDD or SSD inside the ultrabay (with 2504 dock ) ...
works fine on winXP x86 and Win7 x64

I just select "eject" and then the pop-up message show up, telling me that it's now safe to remove the hardware (the ultrabay) ... and I can insert the optical drive back, and the system will recognized the optical drive ..
The answer then is to first "unmount" (Linux) or "safely remove" (Windows) the drive in the docking station's Ultrabay slot. Since I did not (really) have to do this with the bay in the PC itself I had the wrong idea that this step wasn't necessary when swapping out Ultrabays in the Dock.

rumbero
Junior Member
Junior Member
Posts: 451
Joined: Fri Mar 04, 2011 7:02 pm
Location: Barcelona, Spain

Re: Ultrabay use with an advanced dock (T61).

#14 Post by rumbero » Fri Apr 12, 2013 11:08 pm

Investigation complete, and here is my solution for Debian Linux on a T61, based on the information and scripts found in the aforementioned Thinkwiki resource at thinkwiki.org/wiki/How_to_hotswap_Ultrabay_devices#Script_for_Ultrabay_eject:

Save as "/etc/udev/rules.d/50-thinkpad-ultrabay.rules":

Code: Select all

# Change the DEVPATH variable to match your system, if it doesn't match your ThinkPad model
# The DEVPATH value used here should hopefully be working out of the box on any T6x ThinkPad.
# To find the correct value for your ThinkPad, insert the UltraBay optical drive and execute:
# udevadm info --query=path --name=/dev/sr0 | perl -pe 's!/block/...$!!'

SUBSYSTEMS=="block", DEVPATH=="/devices/pci0000:00/0000:00:1f.1/ata4/host3/*", ENV{UDISKS_SYSTEM_INTERNAL}="0"
ENV{EVENT}=="undock", KERNEL=="dock.1", ACTION=="change", SUBSYSTEM=="platform", RUN+="/usr/local/sbin/ultrabay_eject"
ENV{EVENT}=="dock", KERNEL=="dock.1", ACTION=="change", SUBSYSTEM=="platform", RUN+="/usr/local/sbin/ultrabay_insert"
Save as "/usr/local/sbin/ultrabay_eject":

Code: Select all

#!/bin/bash
#set -x

# Sources:
# http://www.thinkwiki.org/wiki/How_to_hotswap_Ultrabay_devices#Script_for_Ultrabay_eject
# http://www.thinkwiki.org/wiki/Talk:How_to_hotswap_Ultrabay_devices

SCRIPTNAME="$(basename $0)"

# Change the DEVPATH variable to match your system, if it doesn't match your ThinkPad model
# The DEVPATH value used here should hopefully be working out of the box on any T6x ThinkPad.
# To find the correct value for your ThinkPad, insert the UltraBay optical drive and execute:
# udevadm info --query=path --name=/dev/sr0 | perl -pe 's!/block/...$!!'

if [ "$DEVPATH" = "" ]
then
   DEVPATH="/devices/pci0000:00/0000:00:1f.1/ata4/host3/target3:0:0/3:0:0:0"
fi

shopt -s nullglob
export DISPLAY=:0.0 # required for notify-send

DISP0_USER=$(who | grep "tty" | awk '{ print $1 }')
DISP0_USER_HOME=`getent passwd ${DISP0_USER} | cut -d':' -f6`
export XAUTHORITY=${DISP0_USER_HOME}/.Xauthority # also required for notify-send

ULTRABAY_SYSDIR=/sys$DEVPATH

# Find generic dock interface for UltraBay
dock=$(dirname $(/bin/grep -l ata_bay /sys/devices/platform/dock.?/type))

if [ ! -n "$dock" -a -d "$dock" ]; then
        logger "$SCRIPTNAME": cannot locate bay dock device
        notify-send -u critical -t 100000 "ThinkPad Ultrabay eject failed" "Cannot locate bay dock device"
        exit 1
fi

# Umount the filesystem(s) backed by the given major:minor device(s)
unmount_rdev() { perl - "$@" <<'EOPERL'  # let's do it in Perl
        for $major_minor (@ARGV) {
                $major_minor =~ m/^(\d+):(\d+)$/ or die;
                push(@tgt_rdevs, ($1<<8)|$2);
        }
        # Sort by reverse length of mount point, to unmount sub-directories first
        open MOUNTS,"</proc/mounts" or die "$!";
        @mounts=sort { length($b->[1]) <=> length($a->[1]) } map { [ split ] } <MOUNTS>;
        close MOUNTS;
        foreach $m (@mounts) {
                ($dev,$dir)=@$m;
                next unless -b $dev;  $rdev=(stat($dev))[6];
                next unless grep($_==$rdev, @tgt_rdevs);
                system("umount","-v","$dir")==0  or  $bad=1;
                if ($bad == 1) {
                        system("logger","ultrabay_eject","ERROR unmounting",$dev,$dir);
                        system("notify-send -u critical -t 100000 \"Error unmounting $dir\" \"Unmounting of $dir on $dev failed!\"");
                } else {
                        system("logger","ultrabay_eject","unmounted",$dev,$dir);
                        system("notify-send -u normal -t 5000 \"Unmounted $dir\"");
                };
        }
        exit 1 if $bad;
EOPERL
}

# Get the UltraBay's /dev/foo block device node
ultrabay_dev_node() {
        UDEV_PATH="`readlink -e "$ULTRABAY_SYSDIR/block/"*`" || return 1
        UDEV_NAME="`udevadm info --query=name --path=$UDEV_PATH`" || return 1
        echo /dev/$UDEV_NAME
}

if [ $( cat $dock/docked ) == 0 ]; then
        logger "$SCRIPTNAME": dock reports empty
else 
    if [ -d $ULTRABAY_SYSDIR ]; then
	logger "$SCRIPTNAME": dock occupied, shutting down storage device $DEVPATH
	sync
	# Unmount filesystems backed by this device
	## This seems to be very inelegant and prone to failure
	unmount_rdev `cat $ULTRABAY_SYSDIR/block/*/dev     \
	  $ULTRABAY_SYSDIR/block/*/*/dev`  \
	|| {
		logger "$SCRIPTNAME": umounting failed
		notify-send -u critical -t 100000 "ThinkPad Ultrabay eject failed" "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"
		exit 1;
	}
	sync
	# Nicely power off the device
	DEVNODE=`ultrabay_dev_node` && hdparm -Y $DEVNODE
	# Let HAL+KDE notice the unmount and let the disk spin down
	sleep 0.5
	# Unregister this SCSI device:
	sync
	echo 1 > $ULTRABAY_SYSDIR/delete
    else
	logger "$SCRIPTNAME": bay occupied but incorrect device path $DEVPATH
	notify-send -u critical -t 100000 "ThinkPad Ultrabay eject failed" "Bay occupied but incorrect device path"
	exit 1
    fi
fi

# We need to sleep here to wait for the bay and the drive to disconnect
sleep 1

# Undocking the UltraBay:
logger "$SCRIPTNAME": undocking $dock
if [ "$(cat $dock/docked)" != "0" ]; then
    echo 1 > $dock/undock
else
    # Tell the user we're OK once done
    logger "$SCRIPTNAME": successfully completed
    notify-send -u normal -t 10000 "Safe to remove device" "The ThinkPad Ultrabay device can now be safely removed"
    exit 0
fi
Save as "/usr/local/sbin/ultrabay_insert":

Code: Select all

#!/bin/bash
#set -x

# Source:
# http://www.thinkwiki.org/wiki/How_to_hotswap_Ultrabay_devices#Script_for_Ultrabay_eject
# http://www.thinkwiki.org/wiki/Talk:How_to_hotswap_Ultrabay_devices

SCRIPTNAME="$(basename $0)"

export DISPLAY=:0.0 # required for notify-send
DISP0_USER=$(who | grep "tty" | awk '{ print $1 }')
DISP0_USER_HOME=`getent passwd ${DISP0_USER} | cut -d':' -f6`
export XAUTHORITY=${DISP0_USER_HOME}/.Xauthority # also required for notify-send

# Change the DEVPATH variable to match your system, if it doesn't match your ThinkPad model
# The DEVPATH value used here should hopefully be working out of the box on any T6x ThinkPad.
# To find the correct value for your ThinkPad, insert the UltraBay optical drive and execute:
# udevadm info --query=path --name=/dev/sr0 | perl -pe 's!/block/...$!!'

if [ "$DEVPATH" = "" ]
then
   DEVPATH="/devices/pci0000:00/0000:00:1f.1/ata4/host3/target3:0:0/3:0:0:0"
fi

ULTRABAY_SYSDIR=/sys$DEVPATH

# Get the UltraBay's /dev/foo block device node
ultrabay_dev_node() {
        UDEV_PATH="`readlink -e "$ULTRABAY_SYSDIR/block/"*`" || return 1
        UDEV_NAME="`udevadm info --query=name --path=$UDEV_PATH`" || return 1
        echo /dev/$UDEV_NAME
}

DOCKDEVICE=$(lsscsi | grep $(ultrabay_dev_node) | tr -s " ")

# Find generic dock interface for UltraBay
dock=$(dirname $(/bin/grep -l ata_bay /sys/devices/platform/dock.?/type))

if [ ! -n "$dock" -a -d "$dock" ]; then
    logger "$SCRIPTNAME": cannot locate bay dock device
    notify-send -u critical -t 100000 "ThinkPad Ultrabay device docking failed" "Cannot locate bay dock device"
    exit 1
fi

# Tell the user we're OK once done

if [ "$(cat $dock/docked)" = "1" ]; then
    sync
    logger "$SCRIPTNAME": Scanning ThinkPad Ultrabay for new device
    echo 0 0 0 > /sys/class/scsi_host/host3/scan
    logger "$SCRIPTNAME": Docking of ThinkPad Ultrabay device successfully completed.
    notify-send -u normal -t 10000 "Docking ThinkPad Ultrabay device completed" "The ThinkPad Ultrabay device is now available for use."
    exit 0
else
    logger "$SCRIPTNAME": ThinkPad Ultrabay device docking failed
    notify-send -u normal -t 10000 "Docking ThinkPad Ultrabay device failed" "Docking the ThinkPad Ultrabay device failed. Please check what went wrong and fix it."
    exit 1
fi
Should (hopefully) work out of the box on at least a T61. Works for me so far. Please try it out and correct my silly errors.

Hope this helps, so enjoy!

EDIT: For those who can read German, an article about this topic is now available at the German language Thinkwiki at thinkwiki.de/Linux_UltraBay_Hotswap.
Broken T23 2647-9RG | A few 14.1" T61 Frankenpads | Two 15" Frankenpad T61+ with UXGA IPS Display

TuuS
ThinkPadder
ThinkPadder
Posts: 1980
Joined: Thu Sep 22, 2011 2:41 pm
Location: Hockessin, Delaware

Re: Ultrabay use with an advanced dock (T61).

#15 Post by TuuS » Sun Apr 14, 2013 2:55 am

Some great work there, it will be an asset to the community :)

ericvb69
Posts: 2
Joined: Mon Oct 20, 2014 7:54 am
Location: Madrid, Spain

Re: Ultrabay use with an advanced dock (T61).

#16 Post by ericvb69 » Tue Jan 13, 2015 10:39 am

Cigarguy wrote:A T61, being PATA at the Ultrabay interface, hot swapping is a no no. It's OK to do this on most SATA interface but I would not recommend it on PATA.
Well he isn't asking about swapping the ultrabay in his T61, rather hotswapping the ultrabay drive in the dock bay.

I own a T60 running linux, I can hotswap the ultrabay disk adapter in the laptop bay (it works as PATA though) and if I plug the disk adapter in the advanced dock, it it detected as USB Mass Storage device:

Code: Select all

[681428.942731] usb 1-6.1: Product: CY4611B V2.50RC16
[681428.942736] usb 1-6.1: Manufacturer: IBM
[681428.942742] usb 1-6.1: SerialNumber: 00000A517286
[681428.943307] usb-storage 1-6.1:1.0: USB Mass Storage device detected
[681428.949697] scsi16 : usb-storage 1-6.1:1.0

dr_st
Senior ThinkPadder
Senior ThinkPadder
Posts: 6647
Joined: Sat Oct 29, 2005 6:20 am

Re: Ultrabay use with an advanced dock (T61).

#17 Post by dr_st » Tue Jan 13, 2015 12:49 pm

ericvb69 wrote:
Cigarguy wrote:if I plug the disk adapter in the advanced dock, it it detected as USB Mass Storage device:
Really! So the Ultrabay in the dock is connected via USB? :o
Current: X220 4291-4BG, T410 2537-R46, T60 1952-F76, T60 2007-QPG, T42 2373-F7G
Collectibles: T430s (IPS FHD + Classic Keyboard), X32 (IPS Screen)
Retired: X61 7673-V2V, A31p w/ Ultrabay Numpad
Past: Z61t 9440-A23, T60 2623-D3U, X32 2884-M5U

Post Reply
  • Similar Topics
    Replies
    Views
    Last post

Return to “ThinkPad T6x Series”

Who is online

Users browsing this forum: No registered users and 11 guests