I need to setup a swap file, have on 16GB of RAM and had quite a few total freezes from what I believe where RAM exhaustion.
I have a faster NVME used as my game library, formated with btrfs and mapped to /mnt/NVME, created a subvolume on /mnt/NVME/swap, been able to create the swap file and enable it, but how do I automate/mount this? Not sure what to place on fstab.
Relevant info:
root@fedora:/var/mnt/NVME/swap# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 256.2G 0 disk
├─sda1 8:1 0 600M 0 part /boot/efi
├─sda2 8:2 0 1G 0 part /boot
└─sda3 8:3 0 254.6G 0 part /var/home
/var
/sysroot/ostree/deploy/fedora/var
/sysroot
/etc
zram0 251:0 0 8G 0 disk [SWAP]
nvme0n1 259:0 0 931.5G 0 disk
└─nvme0n1p1 259:1 0 931.5G 0 part /var/mnt/NVME
root@fedora:/var/mnt/NVME/swap# btrfs subvolume list /var/mnt/NVME
ID 256 gen 43108 top level 5 path swap
root@fedora:/var/mnt/NVME/swap# swapon -s
Filename Type Size Used Priority
/dev/zram0 partition 8388604 5507360 100
/var/mnt/NVME/swap/swapfile.0 file 8388604 0 -1
created the swapfile.0 with:
chattr +C /var/mnt/NVME/swap/
fallocate -l 8G swapfile.0
chmod 600 swapfile.0
mkswap swapfile.0
swapon swapfile.0
Current fstab:
# /etc/fstab
# Created by anaconda on Tue Feb 10 21:21:59 2026
#
# Accessible filesystems, by reference, are maintained under '/dev/disk/'.
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info.
#
# After editing this file, run 'systemctl daemon-reload' to update systemd
# units generated from this file.
#
# Updated by bootc-fstab-edit.service
UUID=8ca076e1-89fd-4f8c-bdfa-75bea8d722f4 / btrfs subvol=root,compress=zstd:1,ro 0 0
UUID=435c7d42-42e4-4b2a-acee-564e46d5df65 /boot ext4 defaults 1 2
UUID=FC1C-3364 /boot/efi vfat umask=0077,shortname=winnt 0 2
UUID=8ca076e1-89fd-4f8c-bdfa-75bea8d722f4 /home btrfs subvol=home,compress=zstd:1 0 0
UUID=8ca076e1-89fd-4f8c-bdfa-75bea8d722f4 /var btrfs subvol=var,compress=zstd:1 0 0
UUID=01a86fb9-5bf2-4f6b-be83-83442792b873 /mnt/NVME btrfs defaults,users,exec 0 2