john-peterson / windows

0 stars 0 forks source link

Converting Windows 7 MBR to GPT installation #3

Open john-peterson opened 11 years ago

john-peterson commented 11 years ago

Introduction

This post is written because

Run these commands in Ubuntu

# obtain these partition identities
# ESP file name: /dev/sdb1
cat /proc/partitions; sudo parted -l
# copy the ESP files from an existing Win 7 EFI installation
# the files will later be copied to the new ESP
# ESP file name: /dev/sdb1
sudo mkdir /mnt/esp
sudo mount -r /dev/sdb1 /mnt/esp
mkdir ~/esp
sudo cp -vR /mnt/esp/* ~/esp
# convert the partition table from MBR to GPT
sudo gdisk /dev/sdb
r
f, y
m
w, y
# convert SRP to ESP
# this assume that BitLocker isn't used
sudo gdisk /dev/sdb
t, 1, ef00
w, y
# format ESP as FAT32 (it's by default NTFS)
sudo mkdosfs -vF32 -n"EFI System" /dev/sdb1

# copy files to ESP
sudo mount /dev/sdb1 /mnt/esp
sudo cp -vR ~/esp/* /mnt/esp

Run these commands in WinPE

# make bootable from Windows 7 install image (WinPE)
# open the console with Shift + F10
recovery\startrep               

Use caution

Test the operation with a disk image in a virtual machine

by adding this line to the .vmx to enable EFI

firmware="efi"

before applying the operation to the original disk because

A default Windows 7 MBR installation has the partition

A default Windows 7 GPT installation has the partition

Describe a problem with this conversion that's not described in this post

I.o.w. a difference between the resulting partitions from this conversion and a default Windows 7 GPT installation

Bootable

Describe a more precise way than StartRep to make the ESP bootable because

The WindSLIC UEFI SLIC loader can be used to

The reason for using GPT over MBR are

Partition size

support for >2TiB partitions

Easier to change boot code

The boot code is easier and safer to change because

Windows and GPT FAQ

Data critical to platform operation is located in partitions and not in unpartitioned or "hidden" sectors. GPT disks use primary and backup partition tables for redundancy and CRC32 fields for improved partition data structure integrity

Unpartitioned or "hidden" sectors refer to for example the 0x00 to 0x1b8 MBR code area