Pre-Installation steps

From ThinkWiki
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 (e.g., 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 defragment 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 distribution'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.

Resizing a Windows Vista partition

My ThinkPad R61 came with an 8GB Rescue & Recovery (version 4) partition at the beginning of the 160GB disk, and Vista on the rest. The Vista partition could not be resized beyond 70GB, either with its built-in resizing program or with a live CD -- there were some unmovable MFT blocks in the middle of the partition, even after using several defragmentation programs. Reinstalling from the Rescue & Recovery partition also didn't help; by the time the installation was over (7 reboots!), the MFT blocks were there again.

Solution 1

To get it working, I had to start the recovery process (this also gave me the chance to get rid of AOL, Norton, and various other useless programs), and then catch it on its first reboot and resize, after the partition is made but before it's filled with files. I used GParted live CD. First I tried to resize the partition with ntfsresize/fdisk, because I had read that GParted had some trouble with resizing Vista partitions -- it seemed to work at first, but when the next step of the installation came, it just showed a blank desktop for a while and rebooted.

Although GParted was much slower (about 1½ hours to do the resizing), it was more successful. After the next reboot, Vista ran chkdsk, and then continued with the installation, on a smaller (32GB) partition.

Note: You should probably make a recovery disk (from Windows) before doing this, in case something unexpected happens during this process.

Update: hircus, September 17th 2007 Newer versions of ntfsresize seem to be able to resize Vista's NTFS partition without problems. On a Thinkpad T61, hard drive freshly restored to initial state, I let Windows install all its updates, then tried using Disk Management's Shrink Partition. It would only release about 40GB, even after turning swap off.

Booted openSUSE 10.3 beta 3's GNOME install CD, told it to shrink the Windows partition and the whole operation took only several minutes. Better than Microsoft's own (free) tools!


Solution 2

Vista's tool (Computer -> Manage -> Disk Management) doesn't seem to move data blocks around. If you happens to have some data sitting toward the end of the partition, it only let you shrink down to where that data sits.

| This guide suggests getting rid off as many system files as possible (disable pagefile, system snapshot, hibernation, kernel debug info dump, ...) then defragments the partition. However, Vista's defrag program seems to just group data blocks together, but doesn't move them to the beginning of the partition. Diskeeper Home Edition (bundled with my Lenovo) moves data blocks up to the beginning, but cannot move system blocks. Depending on your luck (how your system blocks scatter on your partition) you might be able to shrink Vista partition by a few Gigs. I could shrinked mine 112 Gb partition by 11 Gb.

| PerfectDisk (30 days free trial) can defrags system blocks and relocate them up toward the beginning of the partition. After doing that, Vista offers to shrink my partition by 47 Gb. My partition was only 35 Gb out of 112 Gb full, so I was surprised that I couldn't shrink more. Anyway, 47Gb wasn't bad. I hit "OK" and got ... "Access Denied" :-P. I lowered this number to 40 Gb and Vista shrank the partition just fine.