Ubuntu – How to install linux on a computer with GPT

gptuefi

I recently installed Windows 7 on a computer. Left a partition to install linux. Today when I tried to install linux, the installer (of two distros that I tried) failed to recognise the already present partitions. It just shows it as one big unallocated space. However fdisk recognised them just fine.

Turns out I have a GUID partition table. So the installers don't recognise it.

I can boot both into UEFI mode and legacy BIOS mode. If I boot into UEFI mode, I can't boot into any OS, whether it is the installed Windows 7 or Ubuntu or any other linux DVD. It just shows a Operating System not found error. It only boots into the Windows 8 that came preinstalled in the laptop in the UEFI mode. I also have Secure boot disabled.

While installing Windows 7 I booted into legacy BIOS mode.

Can anybody please tell me how I can install Linux on a computer with GPT? I don't want to reformat the whole drive and start fresh with new partition table.

Best Answer

I suspect that you don't have GPT; you have leftover GPT data. Here's what I think happened:

  1. Your computer came with Windows 8 booting in EFI mode and using a GPT disk.
  2. You booted the Windows 7 installer in BIOS mode and forced it to delete the GPT data and install in BIOS mode on an MBR disk. Unfortunately, this only deleted the GPT protective MBR, leaving the bulk of the GPT data intact. (This is known to happen with older partitioning tools and with the Windows partitioning tools.) Technically, the disk is now a legal MBR disk.
  3. When you booted a Linux installer, its libparted-based partitioning tools became confused by the leftover GPT data and reported the disk as being empty. This is a long-standing bug in libparted.

If I'm right, the problem is easily corrected with by my FixParts program (versions are available for both Windows and Linux). Just run it, tell it to delete the stray GPT data when prompted, and exit. Thereafter, the libparted-based partitioner in Ubuntu's installer should be able to handle the disk. If I'm wrong and the disk really is a valid GPT disk, FixParts will refuse to modify it. In that case, you should post back with the output of sudo fdisk -l /dev/sda and sudo parted /dev/sda print.