Installing Arch Linux with LVM
Recently I decided to give Arch Linux a try. This is a quick overview of the steps I followed to get up and running on an old Thinkpad T400.
This is mostly a reference for myself, but hopefully it will be somewhat useful for someone out there as well. It is mainly based on the excellent ArchWiki with additional stuff from here and there.
Getting Arch
This guide assumes you already have a bootable Arch installation media. See here on how to get it.
Installation
Start with booting into the Arch live CD/USB.
Connecting to Wi-Fi
Internet connection will be required during install, so let’s do that as the first step (for wired connection see e.g. here).
wifi-menu
Select wireless network, type in the password and if everything went well you should now be connected to the Internet.
Update the system clock
timedatectl set-ntp true
Set up LVM
To view details about the available storage devices:
lsblk
Determine the drive(s)/partition(s) you want to use. In this example I am creating a single LVM physical volume using a full drive.
First, create a Linux LVM partition spanning the whole disk:
fdisk /dev/sdX
n (to add a new partition)
p (for primary partition)
1 (default partition number)
(accept default start)
(accept default end)
t (to change partition type)
8e (for LVM partition when using MBR)
i (to verify)
w (save and quit)
Create an LVM physical volume on the new partition:
pvcreate /dev/sdX1
Create a volume group:
vgcreate vg1 /dev/sdX1
Create logical volumes for boot, root, swap and home.
lvcreate -L 200M -n boot vg1
lvcreate -L 20G -n root vg1
lvcreate -L 4G -n swap vg1
lvcreate -l 100%FREE -n home vg1
Note: instead of -l 100%FREE
you may want to leave some unused space for snapshots.
Format the logical volumes:
mkfs.ext4 /dev/vg1/boot
mkfs.ext4 /dev/vg1/root
mkfs.ext4 /dev/vg1/home
mkswap /dev/vg1/swap
swapon /dev/vg1/swap
Then finally mount them under the live system’s /mnt
:
mount /dev/vg1/root /mnt
mkdir /mnt/boot
mount /dev/vg1/boot /mnt/boot
mkdir /mnt/home
mount /dev/vg1/home /mnt/home
Install base packages
pacstrap /mnt base base-devel
Generate fstab
genfstab -U /mnt >> /mnt/etc/fstab
Change root to new system
arch-chroot /mnt /bin/bash
Set up locale
In /etc/locale.gen
uncomment en_US.UTF-8 UTF-8
or whatever else locale you need then generate the new locale(s):
locale-gen
Create /etc/locale.conf
:
# /etc/locale.conf
LANG=en_US.UTF-8
Setup time
Set time zone:
tzselect
ln -s /usr/share/zoneinfo/Zone/SubZone /etc/localtime
Adjust the time skew, and set the time standard to UTC:
hwclock --systohc --utc
Update initramfs
Add LVM2 hook to /etc/mkinitcpio.conf
:
# /etc/mkinitcpio.conf
HOOKS="...lvm2 filesystems..."
Re-generate the initramfs image:
mkinitcpio -p linux
Bootloader
In this example we are using MBR with grub
.
Install grub
:
pacman -S grub
Install the bootloader to the drive Arch was installed to:
grub-install --target=i386-pc /dev/sdX
Generate configuration file:
grub-mkconfig -o /boot/grub/grub.cfg
Configure network
Set hostname:
# /etc/hostname
myhostname
Install packages for wireless support:
pacman -S iw wpa_supplicant dialog
Set root password
passwd
Reboot to new system
Exit the chroot
environment, unmount partitions, remove live media and reboot:
exit
umount -R /mnt
reboot
Setup automatic Wi-Fi connection
wifi-menu -o
netctl start profileName
netctl enable profileName
Install desktop environment
For desktop environment let’s install Cinnamon. First, X:
pacman -S xorg-server xorg-xinit xorg-utils xorg-server-utils mesa xorg-twm xterm
Touchpad support:
pacman -S xf86-input-synaptics
Detemine the video card:
lspci | grep VGA
Search for video driver packages:
pacman –Ss | grep xf86-video
In this machine I have an Intel integrated video card, so installing driver for that:
pacman -S xf86-video-intel
Install Cinnamon:
pacman -S cinnamon nemo-fileroller
Install and start display manager:
pacman –S gdm
systemctl enable gdm
systemctl start gdm
Note: On password entry click the gear icon and select Cinnamon.
And done, a barebones Arch Linux installation with a desktop environment is now complete.
Resources
https://wiki.archlinux.org/index.php/Beginners%27_guide
http://blog.ataboydesign.com/2012/08/29/installing-arch-linux-on-lvm
https://www.linuxserver.io/index.php/2014/01/18/installing-arch-linux-with-root-on-an-lvm
https://wiki.archlinux.org/index.php/LVM
http://www.tecmint.com/install-cinnamon-desktop-in-arch-linux
https://wiki.archlinux.org/index.php/netctl#Automatic_operation