Pre-Installation steps

From ThinkWiki
Revision as of 19:00, 19 August 2007 by Shachaf (Talk | contribs) (Minor fixes)
Jump to: navigation, search

Rescue and Recovery Media

Most modern ThinkPads ship with Windows preinstalled on the hard disk only -- no recovery disks are included. Instead, Lenovo ThinkVantage software allows you to create a Rescue and Recovery CD-ROM and a Product Recovery DVD-ROM. These will allow you to restore the hard disk to its exact factory installed state. They can also perform other useful system recovery functions.

Even if you have no intention of using Windows, your first action should be to create these disks. Later, you or someone else may want to use Windows again. The recovery disks make it very simple to reinstall Windows, perfectly configured for your ThinkPad. Here's how:

1. Turn on the system and boot Windows.

2. Start the recovery media creation program with Start | All Programs | ThinkVantage | Create Recovery Media.

3. Choose to create Recovery Disks. The other alternative, Rescue Media, creates only the first of the Recovery Disks.

4. Insert a blank CD-ROM as instructed. This will become a bootable Rescue and Recovery disk.

5. Insert one DVD-ROM (or a series of seven CD-ROMs) as instructed. This will become the Product Recovery disk that contains the bulk of the data on the hard disk.

6. Save the disks in a safe place.

When you want to erase everything on the hard disk and restore the system to its factory preinstalled state, boot from the Rescue and Recovery disk, and run Restore Your System.

If you forget to make recovery disks, Lenovo offers shipment of a pack of rescue disks if you call the support hotline. Also, recovery CDs for older ThinkPads are sold on eBay (you must supply your own Windows disk). However, the only way to get recovery disks that match your system exactly is to make them now.

The copy of Windows that came with your ThinkPad cannot be legally transferred to any other system. Leave the Windows license sticker intact. The resale value of your ThinkPad will be lower without it.

Resizing your Windows Partition

Modern ThinkPads ship with a FAT32 recovery partition of about 5GB, and a Windows NTFS partition that consumes the rest of the hard disk. If you want to keep Windows on your system, you will need to shrink the Windows disk partition to make room for Linux. The easy way is to use commercial software like Partition Magic (US$70) or Partition Manager (US$50).

If you do not want to pay for Partition Magic or Partition Manager, you can use ntfsresize. I recommend booting Kanotix or Knoppix, getting it online and using the latest version to be found at the ntfsresize link because the live CD distributions tend to come with slightly out-dated versions. Be sure not to forget to resize your Windows partition (e.g. with cfdisk) AFTER having resized ntfs and TAKE CARE not to make the partition smaller than you made the ntfs. If you like it safe and smooth you can also take a look at the program "qtparted" which reportedly takes care of ntfsresize and partition table changing in one go and allows you to adjust partition sizes in a GUI. But I have not tested this software personally.

If you want to retain Rescue and Recovery functionality, do not delete the 5GB recovery partition. You can either move it or leave it in place at the end of the hard disk. A procedure for moving it appears in the next section.

Please be careful before taking the following steps. I suggest that you should create rescue and product recovery CDs (6 CDS will be required) before going for the following so that if anything goes wrong you can go back to the factory setting using those CDs.

Moving the Recovery partition using a Linux rescue system

On newer models (i.e. the T43) the preinstalled HDD has two partitions; the first one containing the OS and second one having the rescue files used to boot the machine when Access IBM button is pressed before Windows XP takes control of the laptop. One can use his Linux distributions boot CD (usually the first CD) to boot into rescue mode and shift the rescue partition from the end of the HDD to somewhere in between leaving required space for Windows. This can be done in following steps:

Creating a temporary rescue partition

  • Run # fdisk /dev/sda.
  • Delete the 1st partition (/dev/sda1).
  • Create a partition /dev/sda3 immediately before the rescue partition (/dev/sda2) with exactly the same number of cylinders as the rescue partition.
  • Save the partition table and quit fdisk. Reboot.
Hint:
To be on the safe side, reboot the machine every time the partition table is modified and saved using fdisk from linux rescue mode.
  • rawcopy the contents of /dev/sda2 to /dev/sda3 with
# dd if=/dev/sda2 of=/dev/sda3

Creating the rescue partition in its final position

  • Run # fdisk /dev/sda.
  • Delete the rescue partition /dev/sda2 (we just backed it up to /dev/sda3).
  • Create a partition /dev/sda2 immediately after the space you want to leave for Windows. Note that this new partition again should have exactly the same number of cylinders as the rescue partition (now /dev/sda3).
  • Save the partition table and quit fdisk. Reboot.
  • rawcopy the contents of /dev/sda3 to the newly created /dev/sda2:
# dd if=/dev/sda3 of=/dev/sda2
  • Run # fdisk /dev/sda.
  • Delete the temporary rescue partition /dev/sda3 (we just copied it to /dev/sda2)
  • Save the partition table and quit fdisk.
  • Reboot the machine and press Access IBM Button to restore the Windows XP from the rescue partition. Windows XP will occupy only the space available before the new rescue partition.

Once Windows XP is recovered follow the standard mechanism for installing Linux in the available free space at the end of the HDD. If you have created Rescue and Product Recovery CDs, then the Rescue Partition also can be deleted at this stage to make more room for your Linux installation.

Alternative Method: Dual Booting and retaining ThinkVantage Utility

Note: T60 2913 with 60 GB drive

The key here is to find a bootable CD version of Linux that has the PartEd package on it (preferrably with qtparted also). I used SystemRescueCd (http://www.sysresccd.org/Main_Page). I've read people say to defrag Windows, but according to the PartEd website, the PartEd resize command (http://www.gnu.org/software/parted/manual/parted.html#resize) will take care of all that. Now boot with the SystemRescueCd and when you get the prompt, press F2. This will list available images. I used fb1024, because I wanted to use qtparted (graphical, fb1024 is framebuffer at 1024x768 vs fb800 is framebuffer at 800x600, etc), not parted (commandline).

What I saw was a 3 partition device sda. Only touch the NTFS partition (sda1 on mine, should be on yours if it is factory settings). You do not want to move the VFAT at the end of the device nor touch that little section (sda-1) at the beginning. I resized sda1 (NTFS) down to 20 GB, what you should see is the the New Size + the Free Space After = Old Size of sda1. Click the commit under the file menu to write the changes. That's it.

I then rebooted with Fedora Core 5 disk 1 and used Anaconda and its utilities to partition the free space to be a 20 GB mount point "/", a 512 MB swap, and a 10 GB vfat, these could have been done using qtparted, or pretty much any distro's install. The swap and vfat were shown inside a logical partition. I set up GRUB in the MBR and clicked the GRUB advanced setup checkbox. This allowed me to add entries, in addition to Linux, for GRUB. I added the NTFS (Windows) partition and the VFAT (ThinkVantage partition, not the 10 GB I created, because that would be silly).

The results are: On boot, the post screen tells you to press the ThinkVantage button, and... it does nothing, but once GRUB starts, press the key GRUB tells you to which shows the boot list, and there you have Linux, Windows, and ThinkVantage. I tried it and I can boot into all 3. When you first boot into Windows, you may get a chkdsk (I did), but it should be fine.

A word of warning. Be careful, I've heard some people say GRUB in the MBR while dual booting WinXP can result in false positives from virus software, but I didn't have that issue. Also, be very careful about the resize of the NTFS partition with qtparted. Any change in the placement of the start of the pre-existing partitions, and all bets are off. I'm just saying this because I don't know what might happen if Windows isn't where it wants to be. Also I think the placement of the ThinkVantage utility on the disk is very important from my reading. However, since pressing the ThinkVantage at POST doesn't do anything, I may have screwed that up, but with GRUB pointing at that VFAT, I can still get to the ThinkVantage utilities, so I'm happy.