- Closed
BTRFS on kernel5.x supports swapfiles located on the partition.
The current version is not able to use a swapfile
commands to create:
cd /mnt/cache
truncate -s 0 swapfile
chattr +C swapfile
fallocate -l 16G swapfile
chmod 0600 swapfile
mkswap swapfile
swapon swapfile
cat /proc/swaps
actual:
Quoteroot@whitebox:~# cd /mnt/cache/
root@whitebox:/mnt/cache# truncate -s 0 swapfile
root@whitebox:/mnt/cache# chattr +C swapfile
root@whitebox:/mnt/cache# chattr +C swapfile
root@whitebox:/mnt/cache# fallocate -l 16G swapfile
root@whitebox:/mnt/cache# chmod 0600 swapfile
root@whitebox:/mnt/cache# mkswap swapfile
Setting up swapspace version 1, size = 16 GiB (17179865088 bytes)
no label, UUID=c19590a0-0270-4d5d-b96f-b3fa50d93756
root@whitebox:/mnt/cache# swapon swapfile
swapon: /mnt/cache/swapfile: swapon failed: Invalid argument
root@whitebox:/mnt/cache# swapon -a swapfile
swapon: /mnt/cache/swapfile: swapon failed: Invalid argument
root@whitebox:/mnt/cache# cat /proc/swaps
Filename Type Size Used Priority