btrfs

btrfs on lotr

Use RAID1 and choose stronger checksum XXHASH64

root@lotr:~# mkfs.btrfs -d raid1 -L btrfs_lotr --checksum xxhash /dev/sda /dev/sdb

fstab like so

UUID=<the_uuid> /btrfs_root btrfs defaults,noatime 0       0

Installed btrfsmaintenance package and edited /etc/default/btrfsmaintenance since we are not mounted at /

BTRFS_BALANCE_MOUNTPOINTS="/btrfs_root"
BTRFS_SCRUB_MOUNTPOINTS="/btrfs_root"
BTRFS_TRIM_MOUNTPOINTS="/btrfs_root"

Enabled these timers

systemctl enable btrfs-balance.timer
systemctl enable btrfs-scrub.timer

And refreshed the configuration (unsure if it is needed or a reboot does the same)

systemctl restart btrfsmaintenance-refresh.service

Verified that timers were added to systemd

root@lotr:~# systemctl -t timer list-units 'btrfs*'
  UNIT                LOAD   ACTIVE SUB     DESCRIPTION
  btrfs-balance.timer loaded active waiting Balance block groups on a btrfs filesystem
  btrfs-scrub.timer   loaded active waiting Scrub btrfs filesystem, verify block checksums

Create subvolume for imagelib

btrfs su create /btrfs_root/imagelib

Setup fstab to mount subvolume separate from btrfs_root

UUID=<the_uuid> /imagelib btrfs defaults,noatime,subvol=imagelib 0       0