• Khleedril@cyberplace.social
    link
    fedilink
    arrow-up
    2
    ·
    2 days ago

    @NaibofTabr @HappyFrog I think this is just incorrect. You don’t need swap space to be the sum of the active swap file and the size of RAM, it only needs to be at least the size of RAM. The numbers in the article suggest bigger sizes for smaller RAM so there is less chance of a heavily-loaded running system crashing. You do want a bit more space when hibernating just to make the hibernation process a bit smoother.

    Happy to be corrected by someone with provenance.

    • NaibofTabr@infosec.pub
      link
      fedilink
      English
      arrow-up
      2
      ·
      2 days ago

      A modern OS running with low RAM (e.g. an RPi with 2G) is going to fill the RAM pretty quickly just in normal operation, so a larger swap space will allow it to run more efficiently as it regularly moves things in and out of swap. You still want to have some overhead to allow for storing the live RAM for hibernation, which with a small amount of RAM is likely to be near 100%. Therefore, running with 3x RAM for swap space is recommended.

      it only needs to be at least the size of RAM

      Yes, technically it only needs to be the size of the RAM, but no matter how much RAM you have some of the swap space will be used at any given time for the swap file during system operarion. If you only have exactly as much swap space as RAM, there won’t be enough available swap space to store the entire live RAM for hibernation.

      The size of the swap file and the size of the live RAM image at any point is unpredictable, therefore 1.5x RAM is the lowest recommended value that is probably safe for hibernation, assuming the swap file is not being used heavily enough to be 50% of the RAM. If you can’t provide at least that much disk space for swap, you should disable hibernation.