I’ve heard a lot of people say your swap should be 2x RAM… but do I really need 32GB of swap?

  • z3bra
    link
    fedilink
    English
    221 year ago

    Don’t even bother with a SWAP partition. Create an empty file on your / partition so you can grow/shrink it as needed.

    did if=/dev/zero of=/SWAP bs=1024m count=4
    mkswap /SWAP
    swapon /SWAP
    
    • @float@feddit.de
      link
      fedilink
      English
      5
      edit-2
      1 year ago

      This is the way! There’s a catch with swap files on encrypted disks and hibernation but that’s quite a special case. Edit: forgot to mention zswap, the compressed version of swap.

      • z3bra
        link
        fedilink
        English
        11 year ago

        Of course there’s no golden rule. But I’ve found this one to be pretty useful ! Didn’t know about btrfs limitations though, thanks for the hint!