Tag Archives: bios

Fulfilling a dream.

Since I’ve heard about invention of IA-64 architecture in 2002, I was interested in everything its box comes with, be it Itanium CPU, EFI firmware, or GPT disk partioning. It was always my dream to play with those things. Itanium was too expensive and most of the humans I’ve worked with never have any need to use it. So I’ve never worked with the physical CPU but just played a bit with ski . My life’s first server came with an EFI boot method, but being a n00b at that time, I was not able to configure it to boot with elilo which felt quite frustrating at that time. And now on 29th July, 2009, I decided to give GPT partitions a shot on my AMD64 box (Intel DG35EC mobo ++ Intel Core 2 Duo CPU) as I’m plugging in my new 500 GiB disk. There is no problem with disks partitioning with GPT as all of the operating systems I use (GNU/Linux, FreeBSD and GNU Emacs) have no problem reading/writing to it :). So the only problem is booting a disk formatted with GPT as I’ve a BIOS based mobo. I’d an idea how that is going to be, but I’m not sure if there are any FOSS boot loders that are able to boot in this way. Since I use GRUB, I asked my friend (google) if he knows anything about GRUB and GPT. And it revealed that GRUB2 has support for GPT, i.e. grub-install detects at runtime if it is installed on GPT disk. 🙂
With the help of the search results, GRUB2, GPT fdisk (or gdisk), phcoder on #grub and software repository of Arch GNU/Linux distribution, I’m able to boot from my GPT disk.

% sudo gdisk -l /dev/sdb
GPT fdisk (gdisk) version 0.2.0

Found valid GPT with protective MBR; using GPT.
Disk /dev/sdb: 976773168 sectors, 465.8 GiB
Disk identifier (GUID): FADB3815-91DF-4134-8492-E6FE33A3162E
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 976773134
Total free space is 93345773 sectors (44.5 GiB)

Number  Start (block)     End (block)  Size        Code  Name
   1              34            2081   1024.0 KiB  EF02  BIOS boot
   2            2082       125831201   60.0 GiB    0700  GNU/Linux root
   3       125831202       134219809   4.0 GiB     A503  FreeBSD-root
   4       134219810       142608417   4.0 GiB     A502  swap
   5       142608418       143132705   256.0 MiB   0700  GNU/Linux boot
   6       143132706       252184609   52.0 GiB    A503  FreeBSD-home
   7       252184610       378013729   60.0 GiB    0700  GNU/Linux home
   8       378013730       380110881   1024.0 MiB  0700  news spool
   9       380110882       883427361   240.0 GiB   0700  archives
% sed -e '/^#/d' -e '/^[[:space:]]*$/d' </boot/grub/grub.cfg
1insmod gpt
set default=0
set timeout=10
set root=(hd1,2)
search --no-floppy --fs-uuid --set 6ad9832e-6241-4adc-b67b-3829cd1a2942
if loadfont /usr/share/grub/ascii.pf2 ; then
  set gfxmode=1024x768
  insmod gfxterm
  insmod vbe
  if terminal_output gfxterm ; then true ; else
    # For backward compatibility with versions of terminal.mod that don't
    # understand terminal_output
    terminal gfxterm
menuentry "Arch GNU/Linux" {
        set root=(hd0,5)
        linux /vmlinuz26 root=/dev/sdb2 ro vga=0x0f00
        initrd /kernel26.img
menuentry "Arch GNU/Linux (fallback)" {
        set root=(hd0,5)
        linux /vmlinuz26 root=/dev/sdb2 ro vga=0x0f00
        initrd /kernel26-fallback.img
insmod bsd
menuentry "FreeBSD 7.2-RELEASE" {
        set root=(hd0,3)
        freebsd /boot/kernel/kernel
        freebsd_loadenv /boot/device.hints
        freebsd_module_elf /boot/kernel/coretemp.ko
        freebsd_module_elf /boot/kernel/geom_journal.ko
        set FreeBSD.vfs.root.mountfrom=ufs:ad6p3.journal

RIP MBR based partitioning. 🙂

Note: Intel BIOS requires a partition to be marked as active in MBR in order to be able to boot from that disk.