This guide will set up an Arch Linux system with an encrypted partition using LUKS containing logical volumes for swap, root, and home using LVM.
This is a basic guide for myself to reference. For a more in-depth guide go to the LVM on Luks section in the arch wiki encrytion guide.
Below is an example of the disk layout:
| |
| Mount Point | Partition | Logical Volume | Type | File System | Size |
|---|---|---|---|---|---|
| /mnt/boot | /dev/partition1 | none(not encrypted) | EFI system partition | fat32 | 1G |
| [swap] | /dev/partition2 | /dev/MyVolGroup/swap | Linux swap | swap | 16G |
| /mnt | /dev/partition2 | /dev/MyVolGroup/root | Linux root | btrfs | 200G |
| /mnt/home | /dev/partition2 | /dev/MyVolGroup/home | Linux home | btrfs | Remainder |
1. Creating the GPT partition table
List the available drives and create the partition table:
| |
2. Preparing the disk
Create and open the LUKS encrypted container that will contain the logical volumes:
| |
3. Preparing the logical volumes
Create a physical volume on top of the opened LUKS container:
| |
Create a volume group and add the previously created physical volume to it:
| |
Create all your logical volumes on the volume group:
| |
Format your file systems on each logical volume:
| |
Mount your file systems:
| |
4. Preparing the boot partition
Create your file system for the boot partition:
| |
5. Configuration during system install
5.1 Packages
Install ‘cryptsetup lvm2’
5.3 Configuring mkinitcpio
Edit /etc/mkinitcpio.conf adding encrypt lvm2 to HOOKS:
| |
Recreate mkinitcpio:
| |
5.4 Boot loader (grub)
Exit chroot to get the UUID of the disks.
| |
Edit /etc/default/grub and add the below to GRUB_CMLINE_DEFAULT:
| |
Generate grub config:
| |