I installed a new system (EnOS NEO with BTRFS), and forgot to create the swapfile in calamares.
So, I created it following the below procedure, if you have a minute can you please check if its correct?
Boot to live USB
Commands used
# mount /dev/sda2 /mnt
$ cd /mnt
# btrfs subvolume create @swap
$ cd @
# mkdir swap
# mount -o subvol=@swap /dev/sda2 swap
$ cd swap
# truncate -s 0 ./swapfile
# chattr +C ./swapfile
# btrfs property set ./swapfile compression none
# dd if=/dev/zero of=swapfile bs=1M count=512 status=progress
# chmod 600 swapfile
# mkswap swapfile
# swapon swapfile
Add this to fstab
/etc/fstab
UUID=UUID_OF_DEV/SDA2 /swap btrfs subvol=@swap,defaults,noatime 0 0
/swap/swapfile none swap defaults 0 0
After reboot
cat /proc/swaps
$ cat /proc/swaps
Filename Type Size Used Priority
/swap/swapfile file 524284 0 -2
What is strange, is that in Arch Wiki they say to remove the discard,autodefrag and compression options
, but I can’t remove compression, it mounts with that option automatically.
# mount | grep swap
/dev/sda2 on /swap type btrfs (rw,noatime,compress=zstd:3,ssd,space_cache=v2,subvolid=262,subvol=/@swap)