As I’ve just got a new Samsung 840 Pro Series 256GB SSD for my work laptop (HP ProBook 6360b), I wanted to try switching from BIOS booting to UEFI.

SSD setup

Using gdisk I created two partitions:

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048          206847   100.0 MiB   EF00  EFI System
   2          206848       500118158   238.4 GiB   8300  Linux filesystem

I left the default align to 2048-sector boundaries.

In gdisk I entered “extra functionality (experts only)” by pressing “x”, and then “a” ( “set attributes”), and selected “0” for “system partition” and “2” for “legacy BIOS bootable”

Next I formatted the two partitions using:

  • mkfs.vfat -F32 /dev/sda1
  • mkfs.ext4 -m0 /dev/sda2

Finally I mounted the old disk (connected using the eSATA connector on the laptop) and the new disk, and used rsync to copy everything to the new disk.

Bootloader setup

This was the tricky part. First I updated the firmware on the laptop to the newest version (F.29 from HPs support site). I tried all the .exe files on a computer running Windows 7 until I found the one that could create an USB stick.

Booting in UEFI mode

Very importen bit: you can’t install a UEFI bootloader unless you’ve booted in UEFI mode.

I used the instructions in the Arch Linux wiki on how to Create UEFI bootable USB from ISO. Sometimes UEFI refused to boot from the USB, but it worked each time I selected the EFI file on the USB stick. To do that press F9 while the computer is booting and select “Boot from EFI file”, then select the USB device and EFI/boot/bootx64.efi

Installing the bootloader

I tried rEFInd, gummiboot, grub2 and just using the kernel EFI stub support. Nothing worked. After reading UEFI Booting 64-bit Redhat Enterprise Linux 6 I figured out that HPs firmware only allows you to boot from “OS bootloader”, which means that it will only boot from \EFI\BOOT\BOOTX64.EFI. So I installed grub2 using these commands (/dev/sda1 is mounted at /boot/efi):

  • grub-install –target=x86_64-efi –efi-directory=/boot/efi –bootloader-id=arch_grub –recheck
  • grub-mkconfig -o /boot/grub/grub.cfg

This will put the EFI application in /boot/efi/EFI/arch_grub/grubx64.efi which does not work. So I just copied /boot/efi/EFI/arch_grub/grubx64.efi /boot/efi/EFI/BOOT/BOOTX64.EFI and everything works.

Conclusion

I can’t say that that the time I used to get UEFI booting working was time well spend, nothing magic happens when booting using UEFI compared to legacy BIOS, but at least I’m not using anything that is labelled “legacy” :)