(Last Updated On: April 18, 2019)

This tutorial describes all the steps required to install Arch Linux with LVM on UEFI system using GPT (GUID partition table). This tutorial uses LVM (Logical Volume Manager) for installation of Arch Linux.

The steps may seem complicated if you’re doing this for the first time but I’ve simplified them to be clear and precise.To install Arch Linux with LVM, you’ll be required to handle LVM stuff. Please note that this tutorial assumes you are doing installation on an empty hard drive. if you have data on your drive, be careful to avoid corrupting your crucial data.

Prerequisites

Download and create bootable flash or CD/DVD

1.. Download Arch ISO

Use the following link to download the latest Arch Linux ISO file.

Download Link

2. Create bootable installation media

Once the ISO is downloaded, create a bootable USB device using dd Linux command.

sudo dd if=path-to-image.iso  of=/dev/sdX bs=4M

Replace sdX with your device name, e.g /dev/sdb

Start to install Arch Linux with LVM

Once you have installation media ready, boot into live Arch Linux to start install Arch Linux with LVM. You’ll be prompted with screen similar to one below:

install Arch Linux with LVM

Select appropriate version of Arch to install on your machine. In my case it’s the first one. You may have to run lsblk command to confirm block devices attached before beginning to partition.

lsblk
install Arch Linux with LVM

Disk Partitioning

Here we’ll create a new GPT partition table for UEFI system using parted command. Then we’ll create necessary partitions for LVM.

Steps to follow are:

  1. Create GPT partition table
  2. Create bootable EFI System Partition ( recommended size is 512MiB)
  3. Mark EFI System partition with the boot flag
  4. Create partiton for /boot
  5. Mark remaining partition for LVM

The syntax to create partition with parted is:

(parted) mkpart part-type fs-type start end

part-type: primary,extended or logical ( meaningful for MBR partition tables only)

fs-type: Used by parted to set 1-byte code used by boot loaders to preview type of data in a partition. It won’t actually create file system.

start: Beginning of the partition from the start of the device. Consist of number followed by unit e.g 1MiB

end: End of the partition from the start of the device. 100% means ends at the end of the device ( use all the remaining space)

Commands:

# parted /dev/sda 
(parted) mklabel gpt
(parted) mkpart ESP fat32 1MiB 513MiB
(parted) set 1 boot on
(parted) name 1 efi
(parted) mkpart primary 513MiB 800MiB
(parted) name 2 boot
(parted) mkpart primary 800MiB 100%
(parted) name 3 lvm-partition
(parted) print
(parted) quit
install Arch Linux with LVM

Create LVM and File systems on partitions

Remember that our third partition starts at 800MiB and ends at 100%, we’ll mark it for LVM so that we can create Logical volumes on it.

parted /dev/sda set 3 lvm on
parted /dev/sda print
install Arch Linux with LVM

Create Physical volume

Use pvcreate command to create a physical volume on your OS installation partition.

pvcreate /dev/sda3

Create Volume group

Volume group is created from the physical volume defined previously.

vgcreate  arch-lvm /dev/sda3

Before you can install install Arch Linux with LVM:

Create Logical volumes:

Create Logical volumes for system, home and swap.

lvcreate -n arch-root -L 20G arch-lvm
lvcreate -n arch-swap -L 2G arch-lvm
lvcreate -n arch-home -l 100%FREE arch-lvm

To confirm all creations, use the command:

lvs
install Arch Linux with LVM

Create file systems

We need filesystems for storing Arch Kernels(boot files), OS installation, home users files and swap partition. Create them as shown.

mkfs.fat -F32 /dev/sda1
mkfs.ext2 /dev/sda2
mkfs.btrfs -L root /dev/arch-lvm/arch-root
mkfs.btrfs -L home /dev/arch-lvm/arch-home
mkswap /dev/arch-lvm/arch-swap
swapon /dev/arch-lvm/arch-swap

Create mount points and mount the file systems

Create all required mount points.

mount /dev/arch-lvm/arch-root /mnt
mkdir /mnt/{home,boot}
mount /dev/sda2 /mnt/boot
mkdir /mnt/boot/efi
mount /dev/sda1 /mnt/boot/efi
mount /dev/arch-lvm/arch-home /mnt/home

Install base system

Install base system

Packages to install are base-devel packages,efibootmgr and btrfs-progs package:

pacstrap /mnt base base-devel efibootmgr vim btrfs-progs --noconfirm

Do system configurations

Generate fstab file with all relevant mount points

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

Make /mnt base root

arch-chroot /mnt /bin/bash

Edit /etc/mkinitcpio.conf to include modules needed for btrfs and LVM

vim /etc/mkinitcpio.conf

Look for the line starting with HOOKS=”…”. Modify the line to add lvm2 BEFORE filesystems as shown below

include-lvm-modules-mkinitcpio

Then you have to regenerate initrd image. use command below

mkinitcpio -p linux
regenerate-initrd-image

Install grub2  bootloader. For a 32-bit system replace x86_64 with i386.

pacman -S grub  # grub-install --target=x86_64-efi --efi-directory=/boot/efi 

Generate grub config files

# grub-mkconfig -o /boot/grub/grub.cfg
# grub-mkconfig -o  /boot/efi/EFI/arch/grub.cfg

Set root password and add a standard user

# passwd root
# useradd -G power,audio,wheel,storage username
# passwd username

Configure hostname and Locale

# echo "arch.localhost" > /etc/hostname
# vim /etc/locale.gen

Uncomment line 168 to look like below:

en_US.UTF-8 UTF-8

Now generate locale with locale-gen command

# locale-gen
# echo "LANG=en_US.UTF-8" > /etc/locale.conf

Configure Timezone

ln -s /usr/share/zoneinfo/Africa/Nairobi  /etc/localtime

Configure pacman to enable multilib.

vim /etc/pacman.conf 

Add:

[multilib]
Include = /etc/pacman.d/mirrorlist

Add AUR repo

[archlinuxfr]
SigLevel = Never
Server = http://repo.archlinux.fr/$arch

For usage of AUR, check: yay – Best AUR Helper for Arch Linux / Manjaro

Add archlinuxcn repo if you want ( Optional)

[archlinuxcn]
SigLevel = Never
Server = http://repo.archlinuxcn.org/$arch

Install basic software

pacman -S bash-completion openssh zsh xterm chromium sudo dhclient --noconfirm

Install X11 server

pacman -S xorg --noconfirm

Install audio drivers

pacman -S alsa-{utils,plugins,firmware} \
pulseaudio pulseaudio-{equalizer,alsa} --noconfirm

Install Synaptics touchpad drivers:

pacman -S xf86-input-{keyboard,synaptics,mouse,libinput}

Install Video intel drivers if you don’t have graphics card

pacman -S xf86-video-intel

else run below for Nvidia driver installation.

pacman -S nvidia nvidia-utils nvidia-settings xorg-server-devel opencl-nvidia

Allow member of wheel group to be able to run any command

# echo "export EDITOR=vim" >> ~/.bashrc
# source ~/.bashrc
# visudo

And uncomment the line

# %wheel ALL=(ALL) ALL

to be:

%wheel ALL=(ALL) ALL

Then save and quit.

Install Desktop Environment/Windows manager

KDE:

# pacman -S plasma kde-applications-meta
# systemctl enable sddm.service

Gnome:

# pacman -S gnome gnome-extra gnome-tweak-tool
# pacman -S gdm
# systemctl enable gdm

XFCE:

# pacman -S xfce4 xfce4-goodies xfce4-mixer gstreamer0.10-good-plugins \ libxnvctrl xscreensaver # pacman -S lightdm lightdm-gtk-greeter
# systemctl enable lightdm.service

Cinnamon:

# pacman -S cinnamon
# pacman –S gdm
# systemctl enable gdm

i3 Window manager:

# pacman -S i3 dmenu xorg-xinit rofi feh i3blocks
# vim ~/.xinitrc

Add:

#!/bin/sh
exec i3
# vim /etc/profile

Add:

[ -z "$DISPLAY" -a "$(fgconsole)" -eq 1 ] && exec startx

Finish the installation:

# exit
# umount -R /mnt
# reboot

This marks the end of how to install Arch Linux with LVM. Your system should boot successfully to installed Arch. Next, I’ll cover customizing i3 window manager on newly installed Arch.