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”.

5 thoughts on “Windows 7, BitLocker, Ubuntu, and the case of the missing disk partitions

  1. No idea if this would work, but it might be an idea to take a leaf from some of the multi-boot issues with mac os x. Try having the disk gpt, and create the ubuntu partition, and another partition for 7, and use the gpysync command to sync the tables, then install 7 (get the refit package from the ubuntu universe I think), hopefully 7 will install to the mbr side, and ubuntu is content to live on the gpt side, so it’s possible that might work for you

  2. @Conor – that would probably work (there are quite a few articles discussing dual-booting Windows and Linux in this way) but, in my case, Windows was already installed so it wasn’t really an option. Thanks for your suggestion anyway!

  3. There are at least two issues that could be at play here to explain some or all of what you’re seeing.

    First, the disk may have some GPT cruft left over from some previous experimentation, use in a Mac, or what have you. Some disk utilities will ignore such leftover GPT data, others may ignore the MBR data in preference to the GPT data, and others may do unpredictable things. My own GPT fdisk (http://www.rodsbooks.com/gdisk/), when presented with such a problem, will report it. Since your system runs Windows, your best bet at this point would be to wipe out the GPT data, via the “z” option on the GPT fdisk experts’ menu.

    An important caveat: I don’t know much about BitLocker. If it stores data in the “empty” space immediately after the GPT (as a variety of boot loaders and low-level disk utilities do), wiping out the GPT data will also wipe out the BitLocker data. It’s also conceivable that the BitLocker data is being misinterpreted by disk utilities as GPT data. You could try Googling “BitLocker GPT” to track down more information on this topic.

    The second issue is that some types of malformed MBR data structures can make some Linux disk utilities report the disk as being completely empty. This can happen when the extended partition is too big for the disk or if partitions overlap one another, for instance. I have instructions on my Web page on how to correct this problem in Linux (http://www.rodsbooks.com/missing-parts/). There are probably Windows utilities that will diagnose and fix these problems, too, but I don’t know what they are. I’ve seen enough reports of these problems on Linux forums to think that at least one major disk partitioning tool is creating seriously fouled up extended partitions, but I don’t know what tool is the culprit.

  4. Hi there. I have a brandnew Lenovo ThinkPad Edge E145 with Amd Kabini APU here. Yesterday I installed MS Windows 7, created a 100 GB Windows Primary Partition (with the usual 100 MB for bitlocker in front of it, which Windows did for me, another 100 GB Primary without Formatting (for Linux), and then a 400 GB Extended for Data.

    After installing Windows 7 I wanted to install Ubuntu. 13.10 had a bug (black Screen), fine, let’s install the previous Version with LTS.

    And then I got the same issue. GParted only recognized 500 GB of unallocated space. I googled – no solution. Then I messed around in the Bios … there I found something like UEFI first … activated it. What I got, at least, was the 100 MB boot Partition seen by GParted *Applause*. That’s not enough, but a first step.

    Did you find any solution in the last 3 years? I will Keep trying and inform you.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.