Windows 7, BitLocker, Ubuntu, and the case of the missing disk partitions

This content is 14 years old. I don't routinely update old blog posts as they are only intended to represent a view at a particular point in time. Please be warned that the information here may be out of date.

Last Thursday was probably best described as “a bad IT day” – over the course of the day I “lost” the partition structure on my netbook’s hard disk, and then got it back again.  It all started because I wanted to dual boot Windows 7 and Ubuntu – and, although I’ve still not managed to acheive that goal, I did learn a bit about recovering Windows along the way…

Since last October, my netbook has been running Windows 7 Ultimate Edition with a BitLocker encrypted hard drive.  It’s been working well but I wanted to fire up an installation of Ubuntu from time to time, so I decided to see if I could dual-boot the two systems.  Clearly I wouldn’t be able to run Ubuntu from a partition that Windows had encrypted (I did briefly consider running Linux as a VM) but I was able to shrink the Windows partition in the Disk Management console and free up around 60GB of hard disk space, with a view to following Microsoft’s advice for dual booting Windows and Linux with BitLocker enabled (although my netbook does not have a TPM so I’m not sure if it would work for me).

I tried to run the installer for Ubuntu 10.04 Netbook Edition but it saw my disk as one chunk of unallocated space, with no existing operating systems installed.  As I knew there were two NTFS partitions there and I didn’t want to wipe them, I quit the installer and rebooted into Windows.

It seemed logical that BitLocker was preventing Ubuntu from seeing the true state of the disk, so I first tried disabling BitLocker, and then removing it altogether (the difference between disabling and removing BitLocker is described on the Microsoft website).  Unfortunately that didn’t make any difference, as far as Ubuntu was concerned, the disk was entirely free for it to do as it liked.

I checked in Windows and, as I thought, it was a basic disk (not dynamic), so I tried rewriting the master boot record (MBR) using the bootrec.exe utility with the /fixmbr switch (as described in Microsoft knowledge base article 927392).  That still didn’t help and, after crowdsourcing for advice I tried a number of utilities to take a look at the disk:

  • Acronis Disk Director Suite agreed with Windows – it saw that I had 64.42GB of unallocated space at the end of the disk, plus 2 primary NTFS partitions (100MB System Reserved and 84.53GB with Windows 7 on it).  It also confirms that the disk is an MBR type (0x0AA55).
  • Ubuntu’s disk utility also saw the NTFS partitions, but thought the disk was a GUID Partition Table (GPT) and complained when I tried to create an ext4 partition in the free space (the message included reference to “MS-DOS Magic” and said that the disk looked like a GPT disk with the remains of an MBR layout present).
  • Gnome Partition Editor (GPartEd), when run from the Ubuntu installer CD, thought the disk was 149.05GiB of unallocated space, but, when run from the GPartEd Live CD, it saw the NTFS partitions (as unformatted) and even allowed me to create an ext4 partition in the free space at the end of the disk.  Unfortunately that also prevented Windows from booting…

At this point, I had no operating system at all, so I booted from a Windows 7 System Repair Disc I had created earlier (just in case).  I tried to repair my system but the message I got back said:

This version of System Recovery Options is not compatible with the version of Windows you are trying to repair.  Try using a recovery disc that is compatible with this version of Windows.

Not too many clues there then… only when I tried to reinstall Windows (thinking it might put the OS back and move the old installation to Windows.old or something similar) did Windows Setup give me a helpful message to tell me that the disk had a GPT layout and that it couldn’t be installed onto such a disk.  It turns out that was as a result of my efforts to create an ext4 partition in the free space at the end of the disk but, sure enough, when I booted into Windows PE and ran diskpart.exe, disk 0 was showing as type GPT.  Thankfully, diskpart.exe was also happy for me to run the convert mbr command (also described in Microsoft knowledge base article 282793), after which I could run a Startup Repair Recovery Tool from the System Repair Disc.  At the end of this, I restarted the netbook and Windows 7 came up as if nothing was wrong… phew!

Incidentally, if Windows thinks the disk is not empty, it will not convert from GPT to MBR, so the trick is to use something like GPartEd to make a change (write a partition in the empty space and then remove it again), after which the convert mbr command will work.  I know this, because I borked the system again as I tried once more to see if either the Ubuntu Disk Utility or GPartEd would create the disk layout that I required.  They didn’t, and the Ubuntu installer still refused to recognise the existing NTFS partitions (Ubuntu’s dual-boot advice doesn’t really seem to explain why either).

I’ve tried the alternative installer for Ubuntu Desktop too but that also sees the disk as one big 160GB lump of free space.  Unfortunately the Ubuntu installer for Windows (WUBI) won’t help as it installs Ubuntu side by side on the same partition as Windows and, critically for a portable device, does not support hibernation.  What I still don’t understand is why Linux utilities think the disk is a GPT disk, and Windows sees it as MBR… as William Hilsum tweeted to me, “[perhaps] Bitlocker does more at the disk level than [he] thought”.