Thursday, February 4, 2016

Dual-booting Linux with Windows 10 - UEFI firmware

I have configured dual boot using LILO/GRUB for various Linux flavors in past. Its pretty straightforward on machines which use BIOS. But I initially got stuck with new hardware which uses UEFI Firmware. So thought of sharing the hurdles I faced. UEFI provides increased security and faster booting but has increased the bar with respect to the knowledge required to dual boot a Windows box with a Linux Distro. Here is a good read on UEFI / Secure Boot.

Steps

  • Backup your data
  • Create a Windows recovery disk (USB recovery drive)
  • Shrink Windows file system 
  • Modify UEFI Boot Order
  • Disable Fast Boot / Fast start up
  • Disable secure boot
 My HP Laptop had Windows 10 pre-installed. So there was no free partition available to install Linux. I have backed up data and also created a recovery disk. There was a 20GB recovery partition out of the box. But it is advised to create a recovery disk.  I was getting message like " insert a Flash drive with at-least 32GB capacity. So I have used a 64GB USB drive.

I have used the "Shrink Volume" option in windows 10 to free up space. Refer this link for details.

Other option is to shrink volume while installing Linux. The custom layout option in Partition Manager has option to shrink windows partition. Since shrink volume feature is available with Windows 10, thought of using it. Note that there is no need to create a file system in the freed up space. If you do so, you need to delete this partition while installing Linux. Otherwise the partition manger will throw error message like "not enough space available".

I have downloaded CentOS 6.7 and burned DVD from Windows 10 using "Burn Disk" option. This is the default DVD writer program available in Windows 10. Make sure that you select "Verify disc after burning"  check box. Refer this link for more details.

Other option is to create a USB boot-able disk using "Universal USB Installer". I have installed Ubuntu many times using "Bootable USB Flash Drive". But this didn't work for CentOS. The Boot menu didn't recognized the bootable USB Flash Drive. So I decided to use DVD. Many CentOS forum links also recommend using DVD.

I have rebooted the box and wanted to access BIOS to change boot order. But I was not able to access BIOS setup to change boot order. After some goggling figured out that I need to disable Windows "fast startup" / "Fast Boot".  Followed instructions  available here. Also got steps to change boot order in UEFI Setup. Again this is not straightforward like BIOS. Refer this link for steps and screenshots.

Now I am able to select DVD from the Boot Options, but I was getting efi authentication error while loading CentOS from DVD. After some goggling figured out that I need to disable "Secure Boot" also. Followed instructions here.

Now I am able to boot CentOS from DVD. Next hurdle was on the partition screen. I have  selected "custom layout" option and created below partitions


swap (with no mount point ) - recommendation is to create a swap partition with double the size of RAM. I have selected 16GB.

/root - 50GB
/boot - 500MB
/home - what ever space is left over



Now select the windows partition and set mount point as "/boot/efi".  Without this partition manager will complain about missing "/boot/efi" partition. This step is very important. Also don't select  the "Format" option. If you do so, you will loose Windows 10 boot loader.

Rest of the installation is straight forward. During reboot keep pressing the "Esc" key to get the boot options.And select Windows or Linux.

Note:
Cent OS 7 is also available. CentOS 7 installer is more user friendly. It has option to create required Linux partitions quickly. It creates boot, root, home, swap and "/boot/efi" partitions by default.
We just need to fine tune the size of the partitions. Also need to delete the "/boot/efi" partition created by CentOS installer. And use the windows EFI partition to store Linux boot loader. Should be careful while deleting this partition. If you by mistake delete or format the efi partition created by windows, then you would need to reinstall windows.

No comments: