No swap, swap or swap with hibernate. And do you change the swappiness setting?

  • HumbleExaggeration@feddit.org
    link
    fedilink
    arrow-up
    0
    ·
    3 hours ago

    Noob question: what is bad about having a swap drive on an SSD?

    When installing OpenSuse, I followed the recommended setup, of creating a swap drive equally sized to my 32 GB RAM. And because I only have SSDs this also sits on an SSD. Seems to be working fine so far with quick hibernation and wakeup. What am I missing?

  • monovergent@lemmy.ml
    link
    fedilink
    arrow-up
    0
    ·
    9 hours ago

    For desktops, zram with no swapping to disk. Hasn’t given me any trouble yet, except for the rare news website (it’s always news websites) with a horrific memory leak.

    For laptops, zram plus a low-priority swap file for suspend-then-hibernate. My old laptop drains a fair bit in sleep mode and my new one doesn’t have proper S3 suspend because microslop is pushing manufacturers to only support S0 idle.

    Always a file, never a swap partition. Everything that can be encrypted lives inside the encrypted root partition.

  • Taasz/Woof@lemmy.blahaj.zone
    link
    fedilink
    English
    arrow-up
    0
    ·
    11 hours ago

    I use zram only with no swap on the SSD for my laptop/desktop.

    For my server it has zram too but with extra low priority swap on the SSD just in case zram gets full up.

    Hibernate isn’t something I’ve really ever used, my laptop uses very little power in sleep mode.

  • SavvyWolf@pawb.social
    link
    fedilink
    English
    arrow-up
    0
    ·
    12 hours ago

    Depends on how much RAM you intend to use, and how much you need. For normal web browsing, I think probably enough swap space to make your total RAM + Swap amount up to 24GiB should do. If you have more than that and don’t run anything memory intensive, you can probably get away without any swap at all.

    If you want the ability to hibernate though, you need at least the same amount of swap as physical RAM (since Linux will use the swap space as the location to “hibernate to”.

    I think for an SSD it makes sense to use a swap file rather than a swap partition, since random access is basically free and you can resize it easily. That’s a minor thing though.

    How much memory do you have? How much storage do you have? What will this computer be used for? Do you want to be able to hibernate?

  • catdog@lemmy.ml
    link
    fedilink
    arrow-up
    0
    ·
    15 hours ago

    I lhave learned about the existence of zram and zswap today. I added a higher priority RAM swap on my workstation to reduce swapping to SSD. Should speed things up even more.

  • ReverendIrreverence@lemmy.ml
    link
    fedilink
    English
    arrow-up
    0
    ·
    16 hours ago

    cat /proc/sys/vm/swappiness

    Open /etc/sysctl.conf for editing:

    sudo gedit /etc/sysctl.conf

    Add vm.swappiness=10 at the end and save the file.

    Reboot your system and check the swappiness value:

    cat /proc/sys/vm/swappiness # 10

    • elmicha@feddit.org
      link
      fedilink
      English
      arrow-up
      0
      ·
      13 hours ago

      And why do I want this? And if I want this, why is it not the default already? SSDs have been mainstream for ten years I guess, so shouldn’t any current Linux installer do the right thing by now?

      • Ooops@feddit.org
        link
        fedilink
        arrow-up
        0
        ·
        edit-2
        11 hours ago

        Because the default is set for healthy performance. But users in actual reality don’t care for raw performance but want responsive systems. If you are opening a browser to pass time while some longer process runs in the background, you are less interested in that background process being done 10% faster than in your browser not being sluggish.

        PS: Sidenote… Many recommendations are based on older kernels. Since 5.8 swappiness is not measured from 0 to 100, but 0 to 200. So the 60 default is already half of what it was many years ago.