💾 Archived View for tilde.pink › ~tarial › gemlog › 20220622_create_a_swapfile_on_btrfs.gmi captured on 2023-04-26 at 14:16:04. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2023-01-29)
-=-=-=-=-=-=-
Note to self: If you create a swapfile on a BTRFS system, make sure you set the "no copy on write" file attribute. If you do not set this attribute, `dd` and `fallocate` will create files "with holes in it," which `swapon` will not accept.
This is how you create a swapfile on BTRFS:
$ sudo touch swapfile $ sudo chmod 0600 swapfile $ sudo chattr +C swapfile $ sudo fallocate -l 2G swapfile $ sudo mkswap swapfile Setting up swapspace version 1, size = 2 GiB (2147479552 bytes) no label, UUID=e6d9da68-d5bb-4344-a3b4-84d979c80dc4 $ sudo swapon swapfile
To check what is mounted as swap, you can enter the following:
$ swapon NAME TYPE SIZE USED PRIO /swap/swapfile file 2G 90.8M -2
Published: 2022-06-22