Tookmund / Swapspace

A fork of Jeroen T. Vermeulen's excellent dynamic swap space manager
GNU General Public License v2.0
128 stars 12 forks source link

Some better documentation for noobs #13

Closed michaldybczak closed 6 years ago

michaldybczak commented 6 years ago

There is not much info about what to do after install. I checked and found /etc/swapspace.conf and uncommented some of the lines. You said I need to add it to startup but for that I need to know the path to the script and at the moment I don't. Reading doc/swapspace.8 is not helpful for average user. I'm sure someone oriented in code development can find their way out but I am lost and have no idea how to enable it. Install info is ok - I installed it from AUR so that's none issue. What next? How to enable it on startup? Can I trigger/start it after installation and how? How can I preview what is happening with additional swap spaces/files? Will I see it in htop or some GUI system managers on the fly? If not, how can I see that it is working and how to see the state of new/temporal swap spaces?

I found some more info here:

https://unix.stackexchange.com/questions/134258/dynamically-growing-swap-file-on-debian/134372#134372

but that's not answering all that questions I have.

Thanks for help.

michaldybczak commented 6 years ago

I think I got something.

[michaldybczak@alienware-PC ~]$ pacman -Ql swapspace
swapspace /etc/
swapspace /etc/swapspace.conf
swapspace /usr/
swapspace /usr/bin/
swapspace /usr/bin/swapspace
swapspace /usr/lib/
swapspace /usr/lib/systemd/
swapspace /usr/lib/systemd/system/
swapspace /usr/lib/systemd/system/swapspace.service
swapspace /var/
swapspace /var/lib/
swapspace /var/lib/swapspace/
[michaldybczak@alienware-PC ~]$ sudo systemctl status swapspace
● swapspace.service - dynamic swap manager
   Loaded: loaded (/usr/lib/systemd/system/swapspace.service; disabled; vendor preset: disabled)
   Active: inactive (dead)
[michaldybczak@alienware-PC ~]$ sudo systemctl start swapspace
[michaldybczak@alienware-PC ~]$ sudo systemctl status swapspace
● swapspace.service - dynamic swap manager
   Loaded: loaded (/usr/lib/systemd/system/swapspace.service; disabled; vendor preset: disabled)
   Active: active (running) since Fri 2018-04-13 17:43:09 CEST; 3s ago
  Process: 11492 ExecStart=/usr/bin/swapspace -d -p /run/swapspace.pid (code=exited, status=0/SUCCESS)
 Main PID: 11493 (swapspace)
    Tasks: 1 (limit: 4915)
   Memory: 364.0K
   CGroup: /system.slice/swapspace.service
           └─11493 /usr/bin/swapspace -d -p /run/swapspace.pid

kwi 13 17:43:09 alienware-PC systemd[1]: Starting dynamic swap manager...
kwi 13 17:43:09 alienware-PC systemd[1]: Started dynamic swap manager.
[michaldybczak@alienware-PC ~]$ sudo systemctl enable swapspace
Created symlink /etc/systemd/system/multi-user.target.wants/swapspace.service → /usr/lib/systemd/system/swapspace.service.

Now the question is, is my config configured correctly? How would I know is it working as it should?

Tookmund commented 6 years ago

On most modern systems, you'll probably never hear a peep from this program. If you want to hear everything its doing, try adding the -v flag to the swapspace.service file.

Sorry this project should really be better documented. It shouldn't really be used on most systems, as a static swapfile or swap partition is much more reliable.

michaldybczak commented 6 years ago

Thanks @Tookmund. It looks like enabling sytemd service was enough. After reboot I see 2GB swap instead usual 0,5GB. On the other hand I'm surprised that swapfile created additional space right on start instead when swap is running out. Or maybe I misconfigured something? Anyway, will observe how it works.

Can I turn on the -v flag once the deamon is already running? Sort of like enabling preview on terminal of what is happening since systemd started service already.

Is setup: a swapfile + swapspace not reliable? If modern distros came with swapfiles and the ability to dynamically add swapspace when needed and had GUI to manage it, we would be on the same level as Windows with its simple GUI where you can set virtual memory as static and define amount of memory (swapfile size) or dynamic.

Here is a quote of what I wrote on Manjaro forum in one of the topics:

I think that Linux distros, at least those user friendly should come with swapfile (because it’s easier and safer to manage or change then partition) and GUI: System Resources Management. Swapspace should be installed by default. In GUI we could tweak swap management (turn on/off dynamic swap, set swapfile size), enable zram, zswap or other parameters, also we could have some basic default presets. I can imagine such System Resources Management to be a part of Manjaro settings :D. I bet that this could be one of the big points people would praise Manjaro for as something new, useful and friendly. We have all that possibilities (most of them in kernel) but we don’t use it and there is no GUI to manage it.

At least those are the dreams of a non-IT noob who don't know specifics. Now you can tear down those dreams because... (if you are in the mood for discussion) ;).

P.S. I close this thread. because you responded and I hope some few lines of additional info will be added to the description here.

michaldybczak commented 6 years ago

Yay, it works!

I was using chromium the other night and installing Manjaro Deepin in vbox (which I gave 4GB - that is half of my RAM) with full graphic effects mode and swap was eaten in no time, I had 5 maybe 10 second minor lag (but not freeze) and then everything went back to normal. I checked my system monitor and it showed 5GB of swap (it grew from 2 to 5)! Manjaro Deepin installed without problems and I could use chromium and do other stuff at the same moment without any inconvenience! Normally I would have total freeze out in that moment. Swapspace is awesome on SSD and it gives exactly that functionality that I needed! I can have small swap and thrown RAM hungry programs and system simply adjusts and will work fluently, just like on Windows… (given that you still have some free space on SSD).

My observation is, swapspace package does more to overall RAM or swap shortages then zram or zswap (those reduce only used memory space by a bit). This is brilliant! In my opinion it should be incorporated as a default package into distros and be sanely pre-configured so it would work as a safeguard in memory shortage episodes. In HDD systems usually users give lot of space to swap so that would be of no consequence, on SSD’s we must be more aware of space so swapspace package can be very handy.

Thank you so much for this package! It's too little known in my opinion and as I said above, it should be a default for major distros.