Fork me on GitHub

Dual booting Arch Linux and Windows 8 on a UEFI system using LVM

Update: This article originally used the GRUB 2 bootloader to dual boot with Windows 8. This ended up being needlessly complex and could lead to accidently breaking your Windows 8 bootloader. The new version of the article uses Gummiboot instead because of the ease of use.

This article is up to date as of 18th of November 2014.

You’ll need to ensure you are connected to the internet to successfully install Arch Linux.

I have recently spent quite a while trying to get a dual boot system with Windows 8 Pro 64 bit edition and Arch Linux 64 bit edition on my UEFI system. Hopefully this guide will provide you with all the information you need to get up and running.

In this tutorial I assume that you have two hard drives. One for Arch and one for Windows 8 and that you are planning on using LVM for the Arch drive. Furthermore I’ll assume that /dev/sda is the Windows 8 drive and /dev/sdb is the Arch Linux drive. If this is not the case then change the commands as appropriate.

First of all you must install Windows 8. This is simple and I will not go into how to do this. Once it is installed follow the following instructions:

You’ll need to partition your drive for use with Arch Linux. I personally used the GParted Live CD as it was the easiest method available and does the job well. You can download the ISO from the gParted website. Then just burn it to a CD. Boot from the CD, partition the drive you wish to install Arch Linux on by first creating a GPT partition table on the drive and then creating a single LVM2 partition that takes up all the space on the drive. Do NOT create a UEFI SYSTEM PARTITION. We will be using the default Windows 8 UEFI SYSTEM PARTITION to save on space and to reduce the difficulty of the install. We will create the LVM partitions when we are installing Arch Linux later on.

Reboot your computer.

Download the latest Arch Linux ISO from the Arch Linux website (at the time of writing the latest ISO image was 2012.11.01 - although I am sure that these installation instructions will work with future installation images) and then burn that to a CD. Boot your computer from the CD you just made.

efibootmgr -v

If the commands above display an error then you have not booted your computer in UEFI mode. Doing so is out of the scope of this article. Either you do not have a UEFI motherboard or you have misconfigured something. Find out how to correct the issue and then follow the rest of this guide. If no error is shown then the final command should have listed the current UEFI boot options (which on my computer displayed Windows 8 and the Arch Linux CD).

Now we create our LVM volumes:

pvcreate /dev/sdb1
vgcreate VolGroup00 /dev/sdb1
lvcreate -C y -L 8G VolGroup00 -n lv_swap
lvcreate -L 10G VolGroup00 -n lv_var
lvcreate -L 50G VolGroup00 -n lv_root
lvcreate -L 100G VolGroup00 -n lv_home

this creates an 8GB swap partition, a 10GB /var partition, a 50GB / partition and a 100GB /home partition. Obviously you are free to change these sizes to suit your particular requirements.

Now lets format and mount the drives.

mkswap /dev/VolGroup00/lv_swap
swapon /dev/VolGroup00/lv_swap

mkfs.ext4 /dev/VolGroup00/lv_root
mkfs.ext4 /dev/VolGroup00/lv_var
mkfs.ext4 /dev/VolGroup00/lv_home

mount /dev/VolGroup00/lv_root /mnt
cd /mnt
mkdir home
mkdir var
mkdir boot

cd ~

mount /dev/VolGroup00/lv_home /mnt/home
mount /dev/VolGroup00/lv_var /mnt/var
mount /dev/sda1 /mnt/boot

Now that the file system has been sorted we can start the installation procedure.

pacstrap /mnt base

This will install the basic requirements for Arch Linux. You can also add base-devel if you wish although I opted to do that later once I had a working system. It is not required for any part of this article.

Now generate the fstab file.

genfstab -p /mnt >> /mnt/etc/fstab

Now we simply chroot into our install so we can finish up the installation:

arch-chroot /mnt

install the bootloader (I am using Gummiboot):

pacman -S gummiboot efibootmgr

Now you just need to follow the installation guide found here until you reach the section about mkinitcpio.conf. Once you hit that part return here and we will proceed.

Now you need to edit /etc/mkinitcpio.conf.

Add the following entries to the MODULE section:

vfat ext4 dm-mod

and add the following entries to the HOOKS section:

keymap lvm2

IMPORTANT: It is vital that the lvm2 entry comes before the filesystem entry, otherwise your system will not boot.

Now run:

mkinitcpio -p linux

and

passwd

to set the root password.

Finally we just need to configure the bootloader:

modprobe dm-mod
gummiboot --path=/boot install

Once that has been done you need to edit /boot/loader/loader.conf and put the following in it:

default arch
timeout 4

and put the following in /boot/loader/entries/arch.conf

title       Arch Linux
linux       /vmlinuz-linux
initrd  /initramfs-linux.img
options root=/dev/mapper/VolGroup00-lv_root rw

and you are all set up.

Unmount the file systems:

umount /mnt/{boot/efi,home,var,}

and reboot! You now have a fully working dual boot Arch Linux and Windows 8 system. Enjoy!

If the Gummiboot install failed for any reason then you may need to run the following command in order to have the Linux boot manager appear in the UEFI of your motherboard.

efibootmgr -c -d /dev/sda -p Y -l /EFI/gummiboot/gummibootx64.efi -L "Gummiboot"

Comments !

social