Convert Levovo T430 Windows 7 Factory Disk to UEFI Without ReInstall

My Lenovo T430 came with UEFI 2.3.1 firmware but Lenovo had factory-installed Windows 7 Professional 64-bit using an MBR-partitioned 500gb disk. I was a bit unhappy with that and decided to convert the disk to GPT (GUID Partition Table) and modify Windows 7 to UEFI-boot without reinstalling Windows 7. While, I was at it, I decided to install Fedora 17 and enable either operating system to be booted without the need for GRUB, LiLo or the like. This post describes how I did it. This post was written some months after I successfully converted my laptop – so I may have got some details wrong! Note also, this post assumes Secure Boot is not enabled.

First order of business was to shrink the side of the existing Windows volume. The factory installation had allocated most of the disk to Windows. The remainder consisted of a small Microsoft-specific partition (128Mb – do not touch), a system partition and a recovery partition. I am not going to describe how to do this as there is plenty of documentation on the Internet on how to do this. I then created a set of standard recovery DVDs and deleted the recovery partition.

The next order of business was to convert the disk from MBR to GPT. To do this, I used the Winodws version of Rod Smith’s excellent gdisk utility. You can download gdisk from SourceForge. To use the utility, first launch a Command Prompt as the Administrator. To do this, locate the Command Prompt program icon, right-click it, and select “Run as Administrator.” If you use a non-Administrator Command Prompt, you will not be able to edit hard disk partition tables, although you will be able to edit raw disk image files.

Note that this utility requires a hard disk identifier as an option. You can specify this in either of two forms on Windows. The first way is as a number followed by a colon, as in:

C: gdisk.exe 0:

Disks are numbered starting from 0, so the preceding command launches gdisk on the first disk. The second form to specify a disk device is via the Microsoft absolute syntax:

C: gdisk.exe \\.\physicaldrive0

This command is equivalent to the first form shown above. Change the number at the end of the device name (physicaldrive0) to change which the disk layout is edited.

By the way, if you pass a -l option to gdisk.exe in addition to the disk identifier, the utility displays the current partition table information and then exits.

Use the gdisk utility to convert the existing MBR to GPT, relocate the C: drive NFTS partition (Windows 7) to a say 1 Gb from LBA0, and create a new EFI System Partition (ESP) of at least 100Mb (This is a required minimum) but preferably 200Mb as close to LBA0 as you can. The partition type should be EF00. Do not make the ESP part of any LVM or RAID. Once you are happy with you new partition layout (ESP and Windows 7), you then need to write then to disk. There is no going back once you have written the GPT label to disk. At this stage your Windows 7 installation will not boot.

The ESP typically contains files which can be loaded and executed by the UEFI firmware. It can also contain a (U)EFI Shell and various (U)EFI utilities. Each OSV (Operating System Vendor) can store their files under a \EFI\VENDOR_NAME\ folder and can use the firmware or its shell (UEFI shell) to launch the boot program. An EFI System Partition is usually formatted as FAT32. Note that \EFI\BOOTX64.EFI is the default 64-bit fallback loader.

Next install a 64-bit UEFI version of Fedora. This will create another ESP which can be later deleted. Reboot into Fedora. Fix up your /etc/fstab to use the original larger ESP you created and copy all the files from the Fedora-created ESP into your ESP. Typically all these files for Fedora will reside under \EFI\REDHAT. Then install an EDK1 (EFI Development Kit Version 1) shell at the root of your ESP. You can download such a shell from many locations or from here.

Using the efibootmgr utility, modify the Fedora boot option to use your ESP and add an option to boot into the UEFI shell that you installed at the root of your ESP. Reboot your system and ensure that you can boot into either of these options. When both work, reboot into Fedora and use gdisk to remove the (now redundant) ESP which was created when you installed Fedora.

The final steps are to install the UEFI executable (\EFI\Microsoft\Boot\bootmgfw.efi) required to make Windows 7 UEFI-bootable and add the required entry into the UEFI boot menu using Fedora’s efibootmgr.

Comments are closed.