Page 1 of 1

Dynamic swap file

Posted: 2024-03-26 21:57
by Texlee
Hello, I created a swap file instead of the partition because it had a fixed size but I realize that the file is like that too. Isn't it possible to make it dynamic like the windows paging file that if it's not used doesn't take up space and if needed it can get bigger? Thank you

Re: Dynamic swap file

Posted: 2024-03-26 22:13
by ruwolf
You can try:

Re: Dynamic swap file

Posted: 2024-03-27 11:16
by Hallvor
I would just leave it; it is not a bad design. Even a fixed Swap file only take a few gigabytes. Dynamic resizing adds its own drawbacks like resizing overhead and disk fragmentation.

Re: Dynamic swap file

Posted: 2024-03-28 01:24
by pbear
Hadn't heard of swapspace before. Clever, but don't see the advantage. Unless one leaves unused space on the drive, the app won't work. If the space has to be reserved, might as well do a swap file (imho).

Also, Texlee, what size file/partition are you talking about? Unless wanting to hibernate (which swapspace doesn't support), most recommendations for swap are vastly overstated. With reasonable RAM (which depends on what apps you run), 2 GB of swap is sufficient for most users. OTOH, even with lots of RAM, you should have at least a little swap available.

Re: Dynamic swap file

Posted: 2024-03-28 15:52
by CwF
On a modern system from the last decade, zram can provide all the 'dynamic' swap you need assuming a coherent use case and enough ram.

Re: Dynamic swap file

Posted: 2024-04-18 10:29
by Texlee
CwF wrote: 2024-03-28 15:52 On a modern system from the last decade, zram can provide all the 'dynamic' swap you need assuming a coherent use case and enough ram.
In fact, I'm focusing on this technology, which seems to be the best.