does debian on usb need a swap partition?

If none of the more specific forums is the right place to ask

does debian on usb need a swap partition?

Postby MagicPoulp » 2020-03-03 22:05

As you proably know, I run deiban on usb 3.1 on a ssd disk.

Does debian on usb benefit from having a swap partition?

If ever I start on USB 2 and not USB 3, then the swap can slow down.

From what I remember, the swap is not just to extend the maximum memory, it also works as an automated cache when little memory is used.

I guess the answer is "it depends what you do". FOr what applications should I have a swap and for what should I not have one?

I know I can always use swapoff -a to temporarily stop the swap.


I also had small flickering on the screen (first in gnome, then in xfce and with kernel 4.19 and 5). I installed gpahical drivers from nvidia and the problem disappeared. I thought the nouveau driver worked very well. During a long time nouveau was recommended and proprietary drivers were jsut a last resort if really you need it. But it seems now there is good linux support. Any thoughts if one should stick to nouveau for stability nowadays?

THe only constraints is that one must reinstall the nvidia drivers after each kernel update. But one does it via apt-get and it is simple. A few years ago, one had to download manually a deb file from nvidia.


I installed the nvidia-driver from teh backports because I thought it would match better my backports kernel. But during the isntallation, there was a warning, the driver is experimental. Seems more like a legal stuff than a serious issue.
Last edited by MagicPoulp on 2020-03-04 05:35, edited 1 time in total.
MagicPoulp
 
Posts: 292
Joined: 2018-11-05 21:30

Re: does debian on usb need a swap partition?

Postby tynman » 2020-03-04 04:05

The requirement for a swap partition is not dependent on the bus your hard drive is connected with (loosely speaking: USB vs SATA). (The performance of the swapping function will be affected by that choice somewhat, but that's another matter.)

You need swap space primarily if you don't have enough RAM installed for the OS plus all the applications you intend to run simultaneously. Secondly, swap space is used to support the hibernate function.

I have never heard of swap space being used for cache. Now that I have heard of it, I can't get my head around why that would make sense.
tynman
 
Posts: 123
Joined: 2016-05-03 19:48
Location: British Columbia, Canada

Re: does debian on usb need a swap partition?

Postby MagicPoulp » 2020-03-04 05:39

I may be wrong. Or maybe the term I used "automated cache was wrong. But the thing about automated cache was found in an official doc.

That the swap is more than jsut an extension of RAM is consistent with the fact that the swap installation is so muc ha default on most linux distributions whereas runnign out of RAM is not something everyone encounters everyday. SO why would they reserve 10% of the partition as they recommend if it was not more important?

Here is a blog not oficial doc. But it mentions more a swapping out of unused allocated memory than an automated cache. But the first blog even refers to "even for the disk cache." Maybe they mean if one swaps out unused allocatedf memory, then the disk cache will work better inderectly.

https://www.linux.com/news/all-about-linux-swap-space/

"Swapping is necessary for two important reasons. First, when the system requires more memory than is physically available, the kernel swaps out less used pages and gives memory to the current application (process) that needs the memory immediately. Second, a significant number of the pages used by an application during its startup phase may only be used for initialization and then never used again. The system can swap out those pages and free the memory for other applications or even for the disk cache."

And here is another blog doc (the guy managed to login and deploy on kernel.org):
https://www.kernel.org/doc/gorman/html/ ... nd014.html
"The casual reader1 may think that with a sufficient amount of memory, swap is unnecessary but this brings us to the second reason. A significant number of the pages referenced by a process early in its life may only be used for initialisation and then never used again. It is better to swap out those pages and create more disk buffers than leave them resident and unused."
MagicPoulp
 
Posts: 292
Joined: 2018-11-05 21:30

Re: does debian on usb need a swap partition?

Postby MagicPoulp » 2020-03-04 06:56

I group questions here since I do not want to create too many questions on the forum.

The nouveau driver package is called xserver-xorg-video-nouveau.

Does that mean it is highly dependent on the X server?
If the desktop is using gnome and wayland, does the nouveau driver require a fallback to the X server (x-wayland interop)?

And does it affect performance?
MagicPoulp
 
Posts: 292
Joined: 2018-11-05 21:30

Re: does debian on usb need a swap partition?

Postby p.H » 2020-03-04 08:26

MagicPoulp wrote: The system can swap out those pages and free the memory for other applications or even for the disk cache

This does not mean that the swap is used as cache. It just means that the swap ca be used to unload inactive data from the memory so that the memory can be allocated to more useful tasks such as disk cache.

You can consider memory as a cache for swap, not the other way around.

MagicPoulp wrote:I group questions here since I do not want to create too many questions on the forum.

IMO this is a bad idea. This thread will quickly become unreadable.
p.H
 
Posts: 1308
Joined: 2017-09-17 07:12

Re: does debian on usb need a swap partition?

Postby MagicPoulp » 2020-03-04 08:32

OK I have moved other unrelated things to a new question.

I think we said all about the swap here. It can free up RAM of unused pages even when using very little RAM, but the swap does not work as a cache.

And if we should have a swap or not depend on if the io is fast enough (USB 2 vs USB 3.1).
MagicPoulp
 
Posts: 292
Joined: 2018-11-05 21:30


Return to General Questions

Who is online

Users browsing this forum: No registered users and 14 guests

fashionable