-- Leo's gemini proxy

-- Connecting to tilde.pink:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini;

Create a Swapfile on BTRFS


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

Back to Gemlog

-- Response ended

-- Page fetched on Sun May 19 13:23:43 2024