I bought Lenovo IdeaPad S12 for $400. This little laptop has 12.1" display, VIA Nano processor, 1GB memory and 160GB hard drive. It's shipped with Windows XP, but I want to install Windows 7 alongside XP, so as to have a dual-boot system.
Shrinking the Recovery Partition
I booted IdeaPad S12 with my own Linux Live CD. In Xterm, I typed the following command:
fdisk -l -u /dev/sda
I got the following output.
Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders, total 312581808 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0xee8a96be
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 217909247 108953600 7 HPFS/NTFS
/dev/sda2 217909248 281638911 31864832 f W95 Ext'd (LBA)
/dev/sda3 281638912 312581807 15471448 12 Compaq diagnostics
/dev/sda5 217911296 281638911 31863808 7 HPFS/NTFS
The last primary partition /dev/sda3 seems to be Lenovo's recovery partition. I was able to boot the recovery partition with the following GRUB commands:
root (hd0,2)
chainloader +1
boot
Once I boot into Lenovo's OneKey Recovery System, I can use OneKey AntiVirus to scan the laptop for virus or use OneKey Recovery to restore the laptop to the factory state. I rebooted the laptop with my Linux Live CD. Then, I used GParted to shrink /dev/sda3 and changed its partition number to /dev/sda4:
- Shrink /dev/sda3 to 6 GB.
- Duplicate /dev/sda3 to a new primary partition /dev/sda4.
- Remove the partition /dev/sda3.
- Change the type of the new partition /dev/sda4 to 12.
After that, my partition layout looks like this:
Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders, total 312581808 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0xee8a96be
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 217909247 108953600 7 HPFS/NTFS
/dev/sda2 217909248 281638911 31864832 f W95 Ext'd (LBA)
/dev/sda4 299997810 312576704 6289447+ 12 Compaq diagnostics
/dev/sda5 217911296 281638911 31863808 7 HPFS/NTFS
I restarted my laptop. I was able to boot Lenovo's OneKey Recovery System using the following GRUB commands.
root (hd0,3)
chainloader +1
boot
Moving Lenovo's pre-installed Windows XP to a logical partition
To reserve primary partitions for other crucial operating systems, I moved the Windows XP partition to the extended partition. This technique is explained in this post. Roughly speaking:
- Shrink the Windows XP partition (/dev/sda1) by half using GParted. Space is created between /dev/sda1 (Windows XP, type 7) and /dev/sda2 (extended, type f).
- Enlarge the extended partition (/dev/sda2) to the left. A space is created at the beginning of the extended partition.
- Make a copy of Windows XP partition in the space of the extended partition. The new partition will become /dev/sda6.
- Fix the partition numbers with fdisk (switching partition numbers of /dev/sda6 and /dev/sda5). Previously, /dev/sda6 came before /dev/sda5.
- Fix BOOT.INI of the new XP partition (/dev/sda5).
- Boot the new XP partition (/dev/sda5) in safe mode using GRUB or SYSLINUX. Change drive letters in the registry.
- Reboot Windows XP (/dev/sda5) normally and remove the old partition (/dev/sda1).
Starting Windows XP with SYSLINUX
Recently, I switched to SYSLINUX. I created a 100MB primary partition (/dev/sda1) formatted with FAT16. Then, in Linux, I installed SYSLINUX.
syslinux /dev/sda1
A new MBR had to be installed, too.
install-mbr /dev/sda -v --drive 0x80 --enable +14
I copied chain.c32 from the SYSLINUX package to the SYSLINUX partition (/dev/sda1). Then, I copied NTLDR, NTDETECT.COM and BOOT.INI to the SYSLINUX partition (/dev/sda1), too.
I created a text file named SYSLINUX.CFG with the following instruction.
TIMEOUT 30
DEFAULT chain.c32 ntldr=NTLDR
This will let you boot Windows XP in a logical partition.
Installing Programs on Windows XP
I removed the following programs from factory-installed Windows XP of Lenovo S12:
- Symantec Norton Internet Security
- Diskeeper
- Veriface
Then, I installed the following software:
- Avast Anti-virus
- MyDefrag
Installing Windows 7 Home Premium
I created a new NTFS partition (/dev/sda2) using GParted. I set its bootable flag and hid all other FAT and NTFS partitions. Then, I installed Windows 7 Home Premium.
After that, I moved the Windows 7 partition into the extended partition as /dev/sda6. Then, I removed the original partition (/dev/sda2). I rebooted with Windows 7 installation DVD, clicked the Repair option and opened the Command Prompt. I typed the following commands to make the new Windows 7 partition bootable.
C:
bcdedit /store C:\Boot\BCD /enum
bcdedit /store C:\Boot\BCD /set {bootmgr} device partition=C:
bcdedit /store C:\Boot\BCD /set {default} device partition=C:
bcdedit /store C:\Boot\BCD /set {default} osdevice partition=C:
Then, I added the following entry to SYSLINUX.CFG.
LABEL win7
KERNEL chain.c32
APPEND hd0 6
To make sure that SYSLINUX can boot Windows 7, I typed the following command at the boot: prompt.
chain.c32 hd0 6
Now I am able to boot Windows 7 from a logical partition.
Booting Windows 7 with Software SLIC emulation
There are many ways to emulate SLIC so that Windows 7 can be activated. In my case, I've set up a boot sequence like this.
MBR -> SYSLINUX -> GRUB -> Windows 7
GRUB was patched for the loadslic command which is crucial for Windows activation. The SYSLINUX command to invoke GRUB is like this.
chain.c32 grub=stage2 grubcfg=(hd0,0)/win7.cfg
Then, I created a file WIN7.CFG with the following contents.
hiddenmenu
timeout 0
default 0
title Windows 7 Home Premium
loadslic (hd0,0)/lenovocb-01.bin
chainloader (hd0,5)+1
No comments:
Post a Comment