Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Dynamic swap file

Linux Kernel, Network, and Services configuration.
Post Reply
Message
Author
Texlee
Posts: 58
Joined: 2024-01-05 15:10
Has thanked: 4 times

Dynamic swap file

#1 Post 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

User avatar
ruwolf
Posts: 643
Joined: 2008-02-18 05:04
Location: Banovce nad Bebravou
Has thanked: 41 times
Been thanked: 30 times

Re: Dynamic swap file

#2 Post by ruwolf »

You can try:

User avatar
Hallvor
Global Moderator
Global Moderator
Posts: 2044
Joined: 2009-04-16 18:35
Location: Kristiansand, Norway
Has thanked: 151 times
Been thanked: 212 times

Re: Dynamic swap file

#3 Post 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.
[HowTo] Install and configure Debian bookworm
Debian 12 | KDE Plasma | ThinkPad T440s | 4 × Intel® Core™ i7-4600U CPU @ 2.10GHz | 12 GiB RAM | Mesa Intel® HD Graphics 4400 | 1 TB SSD

User avatar
pbear
Posts: 329
Joined: 2023-08-27 15:05
Location: San Francisco
Has thanked: 1 time
Been thanked: 57 times

Re: Dynamic swap file

#4 Post 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.

CwF
Global Moderator
Global Moderator
Posts: 2719
Joined: 2018-06-20 15:16
Location: Colorado
Has thanked: 41 times
Been thanked: 201 times

Re: Dynamic swap file

#5 Post 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.

Texlee
Posts: 58
Joined: 2024-01-05 15:10
Has thanked: 4 times

Re: Dynamic swap file

#6 Post 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.

Post Reply