Well , there is also the fallocate command which is safer option to make the swapfile,
which I once used , with success , before I discovered the dd metod.
DD can be really dangerous and you must use it with extreme caution. It can wipe your entire disk if you miss your /dev/sd* partition .

Boba5252
read everything @laky gave you, and the article salexandarz gave you. 16-20GB still seems high to me. I mention this because I have my own thread like Laky where someone walked me through it. It is easy to create SWAP in the terminal.---and second reason you should read is there are several schools of thought regarding swap size (covered in foss article). I chose the percentage of ram school (there's a formula).

I think y'all are barking up the wrong tree on this one. Swap is used for Hibernate, not Sleep. In Sleep, nothing is written to Swap. RAM is left in a low-power refresh mode while most of your system enters low power. For Hibernate to work, Swap needs to be at least as big as system memory so that its entire contents can be written before a full power-off of the system. When you resume from Hibernate, your computer is actually booting again and the Kernel recognized the previous Hibernate in Swap, resuming from there. Incidentally, this is the purpose of the resume cmdline argument for the kernel, as it instructs which Swap partition to use for Hibernate.

If you are having issues resuming for Sleep, I would expect instead that something has gone wrong with the kernel or bringing a piece of hardware out of a low-power/off state. This can be especially true of newer device support in the kernel as they figure things out.

    DataDrake For Hibernate to work, Swap needs to be at least as big as system memory so that its entire contents can be written before a full power-off of the system

    I know this thread and your reply is about Sleep Mode, but still, this hibernate info is fascinating as far as equal proportioning. Appreciate the knowledge here.

    Hmmm I have noticed recently alot of posts involving the amd 5700 video I think first thing I would do make sure your motherboard bios is updated then if you could ( you may not be able to try it on different video card. I have noticed alot of issues around the net with this card. I know Ubuntu and fedora had issues with it but Appears they resolved them thats why in another thread here somebody said ubuntu and fedora worked alright. But from what I understand (maybe I am wrong) the amd 5700 interacts somewhat with your motherboard uefi mode someone on a site resolved there issues by updateing there motherboard bios.(if they have an updated bios)

    DataDrake For Hibernate to work, Swap needs to be at least as big as system memory

    I suspect this is the ideal situation, and it makes sense. However, isn't it true that swap needs to be large enough to store everything that's actually in RAM when hibernate is invoked?

    One of my computers (my laptop) has 16 GB of RAM, but only a fraction of that is normally ever used, and hibernate works just fine on it. Similarly, my main workstation has 32 GB of RAM, and hibernate has always worked just fine on it, too. Both of these machines (actually, all of our computers) have just the default amount of swap installed by Solus installers.

    I would expect hibernate to have issues if it were necessary to store all of RAM every time it were invoked, not if it were necessary to store just what's actually in RAM at that time. Or am I wrong to be using hibernate as I am?

    EDIT: To be sure I wasn't mis-rembering anything about my success with hibernation, I just hibernated my laptop, to make sure. Here is my memory situation prior to hybernating:

                  total        used        free      shared  buff/cache   available
    Mem:           15Gi       2.8Gi       8.7Gi       313Mi       4.2Gi        12Gi
    Swap:         3.7Gi          0B       3.7Gi

    I want to make it clear that I'm not disputing @DataDrake , whom I respect. I'm simply trying to understand the hibernate procedure, as I appreciate being able to return to a session after the computer has been shut down. It occurs to me that having SWAP == RAM would only matter if the ongoing processing has used up all of existing RAM.

    In the case illustrated above, my laptop was running in its eight workspaces:

    • Thunderbird
    • Vivaldi (including Facebook, Twitter, brokerage, online banking, and more)
    • Vivaldi (this forum and ad-hoc browsing)
    • AisleRiot (Spider solitaire)
    • Shisen-sho
    • Mahjongg
    • LibreOffice (writer) and Dolphin
    • Terminal

    I suspect we need to make sure that we don't hibernate when our swap space is not large enough to accommodate the amount of RAM that's in use at the time, and if that's in question, we can easily find out with the command free -h.

      WetGeek I cannot in good conscience recommend a Swap size that does not have a 100% chance of working correctly. There is no mechanism to abort hibernation if there is insufficient swap space for the currently allocated RAM. This has the potential to lead to data loss for users, which I cannot ignore.

        DataDrake

        I appreciate your position, and realize it's up to ME to be sure that I don't screw up. Just trying to make sure I understand exactly HOW hibernate works, since I often use it.

        In fact, after this discussion I plan to increase my swap space now. Whether I'll devote 32 GB to swap on a 120 GB SSD is something I'll need to think about a bit more, but obviously 4 GB is not nearly enough for that machine.

        That makes me wonder ... can't the installer tell how much RAM exists before it creates a swap partition that small?

          WetGeek If your hibernate always (in all workspaces) un-hibernated successfully with the default Solus swap space, then I'm of the "if it ain't broke..." school of thought.
          That said anything maybe just a modest bump to test?
          I nuked my swap by accident rebuilding my filesystem recently and re-created my swap based upon a formula---but only to handle too many processes i.e., my reasons had nothing to do with sleep or hibernate.
          I can't answer the question about the installer.
          I'm wary of just matching it 100% right away. Maybe 25% increments, reboot, see what happens.
          2 cents. Too much too quick has never been a good recipe on my older equipment. Baby steps has.
          With the SSD dynamic (vs. the traditional hdd/ram combo) I think I'm starting to understand maybe.

            brent I'm of the "if it ain't broke..." school of thought

            First let me say that DataDrake is 100% right in suggesting that the swap space should be the same size as RAM. He needs to be sure that his advice keeps everyone who reads it perfectly safe in all cases. I would do the same in his position.

            I was trying to make sure I understand exactly how the hibernate function works in Solus, because I use it routinely. Now I know that it's the amount of RAM that's currently in use that matters, and I know how to check that. And I know that it's my responsibility to use that feature safely, and I'm okay with that.

              WetGeek Gotcha, I understand. It is the amount in use that matters, and that's what I learned as well about hibernate.
              On a related note, do you find having all those isolated work spaces an effective 'compartmentalization' as in more secure? Or just preference? I'm asking because I am interested in going towards compartmentalization in the future.

                brent do you find having all those isolated work spaces an effective 'compartmentalization'

                No, that's not why I use them (and would have preferred a couple more). I want to be able to have that many applications (as I listed in an earlier post) immediately available to me on a continuing basis, without having them stacked on top of each other. Thus, it's mainly a convenience.

                  WetGeek thanks for the reply, wetgeek. I like the non-stack/non-taxing approach. I might try it if the navigation is easy.

                    brent I might try it if the navigation is easy.

                    I'm sure you could handle it after a bit of training.

                      WetGeek My frame of references is I tried this (work spaces) when I had a (very) brief flirtation with Solus Gnome. Hopefully it's different in Budgie, looks-wise. Shall see.

                      brent I am interested in going towards compartmentalization in the future.

                      As happy as I am with Solus (and that hasn't changed at all), I routinely browse DistroWatch to see what's new. One thing I noticed today was EasyOS, based on Puppy. It made me think of you, because it provides the concept of "containers," in which a process can be run inside, or outside, of a container. The container gives each process its own copy of the / filesystem, so it's like a private sandbox. Lots of configuration available!

                      For me, it's not worth the time to download and install it, but I thought you might want to take a look because of your interest in compartmentalization.

                        WetGeek Browser compartmentalization is all I'm ready to try. Don't need a new OS for that, but thanks.

                          brent Browser compartmentalization is all I'm ready to try.

                          Then anything derived from Chromium (Chrome, Opera, Vivaldi, etc.) should do what you want. If you open several tabs, then go take a look at htop, you'll see that every tab represents its own process.

                          For example:

                          If you're looking for something else, please be more specific about what "compartmentalization" means to you, and more help will certainly appear.