[CentOS] strange partitioning problem

Wed Apr 25 14:06:29 UTC 2012
Lamar Owen <lowen at pari.edu>

On Tuesday, April 24, 2012 05:40:50 PM Gé Weijers wrote:
> Any way you'd like. CentOS can't BOOT from a GPT partitioned device if
> the BIOS does not support it, but you can certainly use GPT on
> non-boot devices.

While I can't confirm for a drive larger than 2TB, it is not true that you can't boot a Linux kernel close to the one in CentOS using a GRUB similar to the one in CentOS from a GPT partitioned disk.  People are doing this all the time using bootloaders like Chameleon and PCEFI (used typically to build a 'hackintosh'), dual-booting with Mac OS X on semi-generic PC hardware.

Here's what the GPT looks like for such a system, dual-booting Fedora 14 and Mac OS X (using gdisk):
[root at localhost ~]# gdisk -l /dev/sda
GPT fdisk (gdisk) version 0.8.1

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.
Disk /dev/sda: 976773168 sectors, 465.8 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 1BE631E1-4E0C-4D33-9108-9F7E5EBB411A
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 976773134
Partitions will be aligned on 8-sector boundaries
Total free space is 525717 sectors (256.7 MiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1              40          409639   200.0 MiB   EF00  EFI System Partition
   2          409640       386210423   184.0 GiB   AF00  Flopdinger
   3       386473984       402104319   7.5 GiB     8200  LinuxSwap
   4       402104320       484024319   39.1 GiB    0700  F14
   5       484024320       861511679   180.0 GiB   0700  LinuxHome
   6       861511680       976510983   54.8 GiB    AF00  Interchange
[root at localhost ~]# 

Using parted -l:
[root at localhost ~]# parted -l
Model: ATA ST9500420AS (scsi)
Disk /dev/sda: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End    Size    File system     Name                  Flags
 1      20.5kB  210MB  210MB   fat32           EFI System Partition  boot, hidden
 2      210MB   198GB  198GB   hfs+            Flopdinger             hidden
 3      198GB   206GB  8003MB  linux-swap(v1)  LinuxSwap
 4      206GB   248GB  41.9GB  ext3            F14
 5      248GB   441GB  193GB   ext3            LinuxHome             hidden
 6      441GB   500GB  58.9GB  hfsx            Interchange           hidden


[root at localhost ~]# 

Installation of the GRUB bootloader is simple; it's installed to /dev/sda4 instead of /dev/sda (since Chameleon is sitting in the MBR and in the EFI system partition):
[root at localhost ~]# cat /boot/grub/menu.lst
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You do not have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /, eg.
#          root (hd0,3)
#          kernel /boot/vmlinuz-version ro root=/dev/sda4
#          initrd /boot/initrd-[generic-]version.img
#boot=/dev/sda4
default=0
timeout=9
splashimage=(hd0,3)/boot/grub/splash.xpm.gz
hiddenmenu
title Fedora (2.6.35.14-106.fc14.x86_64)
        root (hd0,3)
        kernel /boot/vmlinuz-2.6.35.14-106.fc14.x86_64 ro root=UUID=8cda63bd-9eed-4a65-a834-138df5dca1a2 rd_NO_LUKS rd_NO_LVM rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYTABLE=us rhgb quiet nouveau.modeset=0 rdblacklist=nouveau
        initrd /boot/initramfs-2.6.35.14-106.fc14.x86_64.img

Booting a generic BIOS PC from GPT is a solved problem, just not in the 'usual' Linux space.