Skip to main content

Partitioning

This guide assumes an LVM + Btrfs setup. We are not going to create SWAP on disk but are rather going to employ Zram later on.

  1. List disks with fdisk -l
  2. Run cfdisk /dev/nvme0n1 (it's a little bit easier to use) Make sure that /dev/nvme0n1 is actually your desired device!
  3. Partition with the following scheme
    FS Type Size Mount Point Comment
    vfat 1G /boot EFI System
    LVM (remaining) Linux LVM
  4. Run cfdisk /dev/sda Make sure that /dev/sda is actually your desired device!
  5. Partition with the following scheme
    FS Type Size Mount Point Comment
    LVM (all) Linux LVM
  6. Create LVM physical volumes
    pvcreate /dev/nvme0n1p2   # SSD
    pvcreate /dev/sda1        # HDD
    
  7. Create LVM volume group
    vgcreate VOL_GROUP_NAME /dev/nvme0n1p2 /dev/sda1
    
  8. Create LVM logical volumes
    lvcreate -l 100%FREE -n lv_root vg0 /dev/sda1
    lvcreate --type cache-pool -n lv_cache -l 100%FREE vg0 /dev/nvme0n1p2
    
    # Link cache devices
    lvconvert --type cache --cachepool vg0/lv_cache vg0/lv_root
    
  9. Create partitions
    mkfs.fat -F 32 /dev/nvme0n1p1        # EFI System Partition
    mkfs.btrfs /dev/mapper/vg0-lv_root   # Btrfs root volume
    
  10. Create Btrfs subvolumes
    # First, mount root file system
    mount /dev/mapper/vg0-lv_root /mnt
    
    # Create subvolumes
    btrfs subvolume create /mnt/@
    btrfs subvolume create /mnt/@home
    btrfs subvolume create /mnt/@var_log@log
    btrfs subvolume create /mnt/@pkg
    
  11. Mount partitions
    umount -R /mnt
    
    mount /dev/mapper/vg0-lv_root -o noatime,compress-force=zstd,space_cache=v2,subvol=@ /mnt
    mkdir -p /mnt/{boot,home,var/log}
    mount /dev/nvme0n1p1 /mnt/boot
    mount /dev/mapper/vg0-lv_root -o noatime,compress-force=zstd,space_cache=v2,subvol=@home /mnt/home
    mount /dev/mapper/vg0-lv_root -o noatime,compress-force=zstd,space_cache=v2,subvol=@var_log@log /mnt/var/log
    mount /dev/mapper/vg0-lv_root -o noatime,compress-force=zstd,space_cache=v2,subvol=@pkg /mnt/var/cache/pacman/pkg