Skip to content

Instantly share code, notes, and snippets.

@rbellamy
Created September 16, 2012 02:05
Show Gist options
  • Save rbellamy/3730750 to your computer and use it in GitHub Desktop.
Save rbellamy/3730750 to your computer and use it in GitHub Desktop.
Installing Arch Linux with LUKS system encryption under LVM and Bios-GPT with Grub2
Installing Arch Linux with LUKS system encryption under LVM and Bios-GPT with Grub2
Basic notes for memory recall
Originally written by Earnestly (#archlinux on Freenode)
+--------+---------------+----------------------------+-------------------------+
| Mount | Size | Description | Device |
+--------+---------------+----------------------------+-------------------------+
| - | 2M | 0xEF02 BIOS Boot Partition | /dev/sdX1 |
+--------+---------------+----------------------------+-------------------------+
| /boot | 150M | Kernel & Grub | /dev/sdX2 |
+--------+---------------+----------------------------+-------------------------+
| - | REST | Extended Partition | /dev/sdX3 |
+--------+---------------+----------------------------+-------------------------+
| LUKS | All /dev/sdX3 | LUKS Encrypted | /dev/sdX5 |
+--------+---------------+----------------------------+-------------------------+
| LVM PV | All /dev/sdX5 | LVM Physical Volume | /dev/mapper/arch |
+--------+---------------+----------------------------+-------------------------+
| / | 57G | Root file system (LVM LV) | /dev/mapper/archvg-root |
+--------+---------------+----------------------------+-------------------------+
| swap | REST | Swap partition (LVM LV) | /dev/mapper/archvg-swap |
+--------+---------------+----------------------------+-------------------------+
: Partitioning
1. gdisk /dev/sdX1 0xEF02
gdisk /dev/sdX2 boot
gdisk /dev/sdX3 LVM
2. cryptsetup -c aes-xts-plain -y -s 512 luksFormat /dev/sdX3
3. cryptsetup luksOpen /dev/sdX3 arch
4. pvcreate /dev/mapper/arch
5. vgcreate archvg /dev/mapper/arch
6. lvcreate -L #G -n root
lvcreate -l 100%FREE -n swap
7. mkswap /dev/mapper/archvg-swap
swapon /dev/mapper/archvg-swap
mkfs.ext2 -L boot /dev/sdX2
mkfs.ext4 -L root -m 0 /dev/mapper/archvg-root/root
: Mounting
1. mount /dev/mapper/archvg-root/root /mnt
2. mkdir /mnt/boot
mount /dev/sda1 /mnt/boot
: Installation
1. pacstrap /mnt base base-devel grub-bios
2. genfstab -p /mnt >> /mnt/etc/fstab
3. arch-chroot /mnt
: Configuration
1. vi /etc/hostname
2. vi /etc/vconsole.conf | KEYMAP="dvorak"
3. vi /etc/locale.gen && locale-gen
4. vi /etc/locale.conf | LANG="en_US.UTF-8"
| LC_COLLATE="C"
5. ln -s /usr/share/zoneinfo/America/Los_Angeles /etc/localtime
6. vi /etc/mkinitcpio.conf | HOOKS="...autodetect, keymap, encrypt, lvm2, filesystems..."
| MODULES="ext4, ext2"
7. mkinitcpio -p linux
8. vi /etc/default/grub | APPEND root=/dev/mapper/archvg-root cryptdevice=/dev/sdX3:arch
grub-mkconfig -o /boot/grub/grub.cfg
9. modprobe dm-mod
grub-install --target=i386-pc --recheck --debug /dev/sdX
if test ! -d /boot/grub/locale; then mkdir -p /boot/grub/locale; fi
cp /usr/share/locale/en\@quot/LC_MESSAGES/grub.mo /boot/grub/locale/en.mo
: Housekeeping
1. exit
2. umount /mnt/{boot,home,foo}
umount /mnt
3. reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment