Rescue and Recovery

From ThinkWiki
Revision as of 05:02, 7 August 2007 by MarcH (Talk | contribs) (Using the Windows Bootloader to Boot Linux: added hibernate warning)
Jump to: navigation, search

Rescue and Recovery

Rescue and Recovery version 3.0 consists of a bootable partition containing various system recovery tools, including full recovery of the preinstalled Windows XP partition. It can be activated by pressing the ThinkPad, Access IBM or ThinkVantage Button during system boot. It contains a FAT filesystem (labeled "IBM_SERVICE"), and has partition type 0x12 ("Compaq diagnostics" in fdisk).

As opposed to a Hidden Protected Area Recovery partitions are ordinary partitions, accessible through the partition table. As they are ordinary partitions they are accessible by ordinary partitioning tools. They should be dealt with carefully.

Rescue and Recovery is a Windows specific feature. If you intend to recover into Windows when you have an issue, it is important to follow the warnings here carefully. If you intend to run another operating system exclusively and never return to Windows, removing this partition is safe. If you remove it, you can still reinstall windows at a later time, provided you have created a Recovery set of discs (1CD + 1DVD or 5CDs required). Booting from the Recovery CD will restore the system to the factory state including the recovery partition.

Proper MBR

Only tinker with the MBR and the Rescue and Recovery partition if you know what you're doing. Mistakes can leave the system unbootable and can make it very difficult to retrieve the data on the harddisk.

Consideration 6 of the Readme states:

"The Master Boot Record (MBR) must be configured properly for the Rescue and Recovery application to function properly. When possible, the Rescue and Recovery application attempts to ensure the proper configuration of the MBR. This can only occur if the Rescue and Recovery application is installed after other applications that requires the MBR."

Apparently, the MBR is not "configured properly" if LILO or GRUB have written it. The following is the case:

  • The default bootloader seems to ignore the active bit and always boots the first partition instead
  • The default bootloader contains code to catch a press of the appropriate button during bootup and launch the Rescue and Recovery application in that case
  • Before launching the Rescue and Recovery application at system boot, the default bootloader changes the partition type of the Rescue and Recovery partiton to 0x0b, otherwise it changes it to 0x12 (to hide it from Windows)
  • The Rescue and Recovery application assumes that the first partition contains Windows
  • When booting from the Rescue and Recovery partition, it needs to have its type set (either by Thinkvantage or by GRUB) to 0x0b (FAT32) for the default bootloader to launch the Rescue and Recovery application.

Since neither LILO nor GRUB catch the press of the button (an undocumented mechanism anyway) it is not possible to launch the Rescue and Recovery application by pressing the appropriate button during system boot, once LILO or GRUB have altered the MBR for their boot procedure.

IBM provides a program to manage the Rescue and Recovery bootloader. It is located in C:\Program Files\IBM ThinkVantage\Common\BMGR or C:\Program Files\Common Files\Lenovo\BMGR. It can select the partition to boot, and also allows for rewriting the MBR if it was written by another bootloader. More information is needed about this program.

Some information here, but it may be slightly out of date:

MBR written by GRUB

If the MBR was written by GRUB you can still use GRUB to launch the Rescue and Recovery application. However if you leave the type of the Rescue and Recovery partition to 0x12 (Compaq diagnostics), this will result in an error message "c000021a, Fatal System Error" if you try to launch it. To avoid that and to make sure the recovery partition always is of the right type, add a line to change the partition type to 0x0b to the Rescue and Recovery partition's entry in your /boot/grub/menu.lst. Assuming your Rescue and Recovery partition is the second partition, it could look like this: Please note that there are people who report that this didn't work, for example it didn't work on a Z61m 9450-3HG.

 title           IBM Rescue and Recovery
 root            (hd0,1)
 parttype        (hd0,1) 0x0b
 unhide          (hd0,1)
 chainloader     +1

Also add an unhide line here because we are going to hide the Rescue and Recovery partition on every boot of Windows, so we need to unhide it, when the recovery partition is booted. This is because if we don't hide the partition when booting Windows, it would be visible and accessable there and that's not what we want. So, assuming that Windows is on the first partition, the Windows entry could now look like this:

 title           Windows
 root            (hd0,0)
 hide            (hd0,1)
 chainloader     +1

GRUB in a partition's boot sector

A way to have your Access IBM button still functional on bootup, is to create a separate /boot partition, install GRUB to that partition and make it active. This will leave the MBR untouched.

If the above finding is true that the MBR ignores the active bit, that partition has to be the first one. In most recent Linux distributions it is not easy to create /boot as first partition and shrink the Windows partition. In that case the Windows bootloader can be used to boot Windows and Linux, also preserving the Rescue and Recovery functionality. See below.
  • In the BIOS, set the IBM Predesktop Area to 'Secure'.
  • Boot your Linux distribution's installation CD.
  • Follow the instructions and go through the regular installation process.
  • Create a primary partition for /boot (the other stuff can go into the extended partitions) and when the time comes to install GRUB, make sure you install it into the boot sector of the boot partition.
  • Set this boot partition as active.

Using the Windows Bootloader to Boot Linux

The NTLDR Windows bootloader can be configured to boot Linux in addition to Windows. The master boot record (MBR) is unchanged, so the ThinkVantage Rescue and Recovery system boot functionality is preserved. This clever procedure was originally applied to Ubuntu Dapper Drake, and is generalized here.

0. Added warning: with this method, you cannot hibernate windows and boot anything else. The windows boot loader jumps on resuming windows before asking anything (and you can already verify this right now, whatever your current configuration is).

1. Boot Windows and make product recovery disks. You will see this step repeated throught this wiki for good reason. The recovery disks can refresh your hard disk to its original factory state, getting you out of the trouble you might make in the next step.

2. Shrink the Windows NTFS partition to the size you like. You will need a bootable CD that is capable of resizing NTFS partitions. I have done this before with Knoppix, but this time I used Partition Magic (US$70).

Leave the Rescue and Recovery partition (~5GB) at the end of the disk. Other authors claim that it must not be moved. I did move it, and it works fine. Still, in retrospect I agree that the end of the disk is the best place for your Rescue and Recovery partition.

3. Reboot. Push the ThinkVantage button during system boot, and verify that Rescue and Recovery still runs. Reboot into Windows to verify that the partition resize was successful.

4. Begin your Linux installation. Linux will see the Windows NTFS partition as /dev/sda1, and the Rescue and Recovery FAT32 partition as /dev/sda2. When the Linux installer asks you about GRUB, do not install GRUB in the MBR. Instead, install GRUB in the /boot partition (most likely /dev/sda3).

5. After the Linux installation is finished, reboot with a bootable Linux live CD. The "rescue mode" of your Linux installation CD #1 should work fine for this. Usually you start the rescue mode with the command,

   linux rescue

Start the network if you plan to use FTP in step 7.

6. After you get a shell prompt, become root if necessary, and then write the first sector of the /boot partition (probably /dev/sda3) to a file using the dd command:

    sudo -i                   # If necessary
    cd /mnt/sysimage/boot     # Or wherever your live CD mounts the /boot partition
    dd if=/dev/sda3 of=grub.img bs=512 count=1

The resulting grub.img file should be 512 bytes long.

7. Transfer the grub.img file somewhere where you can read it from Windows. You can use removable media like a USB flash drive, or even FTP.

8. Reboot into Windows. Copy the grub.img file to c:\grub.img.

9. Make a backup copy of the c:\boot.ini NTLDR control file. c:\boot.ini is read-only and hidden, so you will have to tell Windows to show hidden files, and turn off the read-only property on c:\boot.ini.

10. Edit c:\boot.ini. Append the line,

   c:\grub.img="Linux GRUB Bootloader"

So that Linux will boot by default, you may also want to change the default OS to c:\grub.img, and reduce the timeout to 5 seconds or so. For reference, here is my c:\boot.ini file for Windows XP:

   [boot loader]
   [operating systems]
   c:\grub.img="Linux GRUB Bootloader"
   multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Windows XP Professional" /noexecute=optin /fastdetec

11. Reboot. Now the Windows boot menu should offer you a choice of "Linux GRUB Bootloader" or Windows XP. Choose "Linux GRUB Bootloader", and you will be taken to the GRUB boot menu, where you can select Linux, or even go back to the Windows boot menu.

12. When you need Rescue and Recovery, push the ThinkVantage button upon system boot. Since you have touched neither the MBR nor the Rescue and Recovery partition, Rescue and Recovery will work exactly the same as it did before you installed Linux.

Newer versions of Rescue and Recovery

Rescue and Recovery version 4 is installed on T61/R61.

The partition type is 0x27. By factory default, the R&R partition is the first partition on the disk. The filesystem used is NTFS. The preloaded Windows appear as the second partition, with the active bit set.

R&R version 4 bootloader seems to honor the active bit in the partition table. To install Linux while maintaining the R&R functionality is therefore rather straightforward:

  • Shrink the second Windows partition – or remove it if not needed
  • Add partitions for Linux (or other operating systems), one of them has to be a primary partition since the R&R bootloader cannot boot from an extended one
  • Install GRUB on the boot sector of the newly added primary partition
  • Remove the active bit from the Windows partition and activate the boot partition with GRUB

Older versions of Rescue and Recovery

Some Thinkpads (e.g., T23 and T30) do not come with a Recovery CD, but also do not support the Hidden Protected Area. These ThinkPads have an older version of Rescue and Recovery preloaded on the hard disk to implement the factory recovery function. Most of the comments above also apply to the older versions, with the following differences:

  • The recovery partition type is 0x1c, hidden FAT32, LBA-mapped (or 0xc when unhidden).
  • The boot manager program is in C:\IBMTOOLS\RECOVERY and only runs in a 16-bit DOS environment
name of this boot manager needed
  • The IBM Predesktop area runs atop of Windows 98 (command-line) instead of WinPE

External Sources

Models featuring this technology