I have created a swapfile /swap on / btrfs with:
touch /swapchattr +C /swapdd if=/dev/zero of=/swap bs=1M count=2048 mkswap /swap && chmod 600 /swap && swapon /swap
It works and mounts fine and all is good when I check with swapon -s
It's mounted in fstab. However, after a while the swapfile is no longer mounted and working when I do swapon -s
and I have recreate the file to get it to work again. I do not know exactly when this happens since I do not notice that my system with lots of is needing swap. How can I find out when and what happens and possibly make sure the swapfile stays active and mounted?
My fstab:
# <file system> <mount point> <type> <options> <dump> <pass># / was on /dev/nvme0n1p2 during installationUUID=546fa6af-ca9c-419f-9883-ba182e35969d / btrfs ssd,space_cache,compress=zstd,noatime,defaults,subvol=@ 0 1# /boot/efi was on /dev/nvme0n1p1 during installationUUID=EAE2-20E2 /boot/efi vfat umask=0077 0 1# /home was on /dev/nvme0n1p2 during installationUUID=546fa6af-ca9c-419f-9883-ba182e35969d /home btrfs ssd,space_cache,compress=zstd,noatime,defaults,subvol=@home 0 2/swap none swap sw 0 0