Managing an Arch Linux workstation. Part 1 - Btrfs
Btrfs is a modern file system with many useful features such as subvolumes and snapshots. With Btrfs you aren’t limited to give fixed sizes to partitions, instead you can use Btrfs subvolumes like partitions: mount them separately, and do snapshots of subvolumes to avoid losing important data. ArchWiki explains the usage, so I’ll skip it.
Partition layout
This is how I setup my partition layout:
- /dev/nvm0n1p1 - 2G EFI System
- /dev/nvm0n1p2 - 950G Btrfs filesystem
Btrfs subvolumes
/systems - the subvolume for the Arch Linux setup
- /systems/archlinux-base [RO] - pacstrapped basic installation with base, base-devel and vi packages and zoneinfo, hwclock, locale configurations
/systems/archlinux-base/var/lib/portablesan autogenerated subvolume by systemd, but not needed since Btrfs snapshots aren’t recursive and archlinux-base is just a read-only template subvolume/systems/archlinux-base/var/lib/machinessame as the above- /systems/archlinux-linux [RO] - a snapshot of archlinux-base with linux, linux-headers and linux-firmware* packages
- /systems/archlinux-packaged [RO] - a snapshot of archlinux-linux with packages my basic setup contains (will be discussed in detail in a separate article)
- /systems/archlinux-workstation [RO] - a snapshot of archlinux-packaged with a normal user, fstab configuration, system/dotfiles configuration and some systemd services enabled - a ready to go place
- /systems/archlinux-current - a snapshot of archlinux-workstation used as host
- /systems/archlinux-current/var/lib/portables - created with systemd-tmpfiles
- /systems/archlinux-current/var/lib/machines - created with systemd-tmpfiles
- /systems/snapshots - snapshots of archlinux-current
/containers - the subvolume for systemd-nspawn containers
Will be discussed in detail in a separate article.
/data - user data
- /data/home - a subvolume for user home directories
- /data/desktop - user/container/system -wise setup for:
- desktop package sources to be compiled
- dotfiles
- neovim config
- themes
- wallpapers
- /data/books - tech-related books
- /data/music - music
- /data/movies - movies
- /data/media - user-wise data
- /data/soloarized - here’s everything solariozed!
- /data/src - a subvolume for personal projects
- /data/work - work data
- /data/snapshots - a subvolume for snapshots
/swap - Btrfs supports swap
Mountpoints
| subvolume | mountpoint |
|---|---|
| /systems/archlinux-current | / |
| /data/home | /home/ |
| /swap | /swap/ |
| /data/media | /media/ |
| /data/books | /media/books/ |
| /data/movies | /media/movies/ |
| /data/music | /media/music/ |
| / | /rootfs/ |
| /data/desktop | /desktop/ |
| /data/solarized | /desktop/solarized/ |
| /data/src | /src/ |