Linux Partition Table

From Free Knowledge Base- The DUCK Project: information for everyone
Jump to: navigation, search

MBR (Master Boot Record) and GPT (GUID Partition Table) are two different types of partition table available to linux users now.

  • MBR standards for Master Boot Record. It was introduced with IBM PC DOS 2.0 in 1983.
  • GPT stands for GUID Partition Table. It is associated with UEFI

GPT

For booting from a GPT device, Linux requires a BIOS Boot Partition and a boot loader that can work with the GPT format (such as Grub2). The boot manager will manage the boot entries in the persistent NVRAM. The appropriate boat loader is located on the UEFI system partition (ESP).

Use the command 'gdisk' which is GPT fdisk to work with your GPT partition table.

More useful might be 'parted'. Here is example output:

(parted) print                                                            
Model: ATA ST3500413AS (scsi)
Disk /dev/sda: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system     Name                  Flags
 1      1049kB  1075MB  1074MB  fat32           EFI System Partition  boot, esp
 2      1075MB  18.3GB  17.2GB  linux-swap(v1)
 3      18.3GB  156GB   137GB   ext4            /
 4      156GB   293GB   137GB   ext4            /2
 5      293GB   500GB   207GB   ext4            /share

The UEFI partition is marked with the boot flag. This is the first partition read on system boot. For UEFI to work, it has to be on the first partition at least 256MB large and bootable, the example above it is actually over sized by at least four times what is necessary. From there UEIF directs which partition to load next, or in this case, which one to direct to grub2. To access the UEFI setup we reboot the machine and from the grub2 menu select "System setup."

Also in the example above both / and /2 contain a grub bootloader. The UEFI directs to the one on / and does not see the one on /2

Q: When I have more than one partition with an active operating system, why does UEIF Startup Menu, Boot Menu (F9) only show one of the operating systems for UEFI Boot Sources?

A: In the case of using the Grub2 Bootloader having two partitions each having Ubuntu, and each having its own /boot then one partition's grub2 in its /boot is ignored. The last Ubuntu to be installed will have the active grub2 configuration in /boot. To change it back to the first one installed simply boot to that Ubunut and from console run:

apt-get install --reinstall grub-efi-amd64

assuming you're using 64 bit version of Ubuntu and UEFI.

efibootmgr is a utility under Linux for manipulating the UEFI boot manager such as changing the sequence of UEFI boot entries.

Tip: if UEFI Secure Boot is on, the machine will only boot to Windows and you must disable that in the BIOS to boot Linux.