Swap file

  • ATTENTION! As of November 1, 2020, you are not able to reply to threads 6 months after the thread is opened if there are more than 500 posts in the thread.
    Threads will not be locked, so posts may still be edited by their authors.
    Just start a new thread on the topic to post if you get an error message when trying to reply to a thread.

thelonelycoder

Part of the Furniture
Skynet, an 'essential' amtm script, requires a 2GB swap file.

Also, a swap file is required and not a swap partition, for amtm to work properly.
Yeah, amtm itself does not require a swap file, third party apps however may do.

i disagree, the firewall will block nasties already. the only benefit is if you are running any public facing services and want to block "known" baddies

amtm doesn't require swap to be used, but if you do use swap you are correct that amtm works with swap files and not partitions
While amtm does not offer to create a swap partition, it can certainly recognise one that was created manually by a user.
 

Makaveli

Very Senior Member
Maybe scMerlin and other methods are not reporting swap file usage correctly, but I have never witnessed my usb-based swapfile utilize even 1KB. Never.

I have swap file usage and it matches what I see in the GUI aswell as scMerlin.

Atmt swap.PNG


scswap.PNG
 

coloxim

Regular Contributor
Yeah, amtm itself does not require a swap file, third party apps however may do.


While amtm does not offer to create a swap partition, it can certainly recognise one that was created manually by a user.
But is better file or partition?
Anyway i didn't understand when is necessary or not...the only think that i know it's that I'll make the swap anyway...
 

Hazel

Regular Contributor
Reading through this thread I can understand that someone new at this doesn't get it anymore. So many conflicting opinions/statements, plus the fact that new participants most likely don't have a clue who are the coders among them and therefore authoritative. For newbies this is utterly confusing, despite what I assume, everyone's best efforts.

For what it's worth to OP: I always install a swap file, better safe than sorry. That way I'm sure that if my router runs out of internal memory, it has the swap as backup file to use it as 'external' memory. Most USB sticks nowadays have plenty of space, so what's 2Gb on a 4GB-64GB or even larger drive to prevent possible future problems. As mentioned before, if a script requires a swap file (like SkyNet) it will prompt you for it during install. As for your question whether to use a drive or a stick: in general USB sticks have a tendency to wear out faster, so make sure you've got a spare. Connecting a (cheap but decent) SSD drive will probably save you some money in the long run as, in my experience, they last longer then (most) USB sticks.
 
Last edited:

coloxim

Regular Contributor
Reading through this thread I can understand that someone new at this doesn't get it anymore. So many conflicting opinions/statements, plus the fact that new participants most likely don't have a clue who are the coders among them and therefore authoritative. For newbies this is utterly confusing, despite what I assume, everyone's best efforts.

For what it's worth to OP: I always install a swap file, better safe than sorry. That way I'm sure that if my router runs out of internal memory, it has the swap as backup file to use it as 'external' memory. Most USB sticks nowadays have plenty of space, so what's 2Gb on a 4GB-64GB or even larger drive to prevent possible future problems. As mentioned before, if a script requires a swap file (like SkyNet) it will prompt you for it during install. As for your question whether to use a drive or a stick: in general USB sticks have a tendency to wear out faster, so make sure you've got a spare. Connecting a (cheap but decent) SSD drive will probably save you some money in to long run as, in my experience, they last longer then (most) USB sticks.
Yes you are right, there is confusion...

Perfect! Thanks for reply! You answered to my question...

;)
 

thelonelycoder

Part of the Furniture
But is better file or partition?
Anyway i didn't understand when is necessary or not...the only think that i know it's that I'll make the swap anyway...
A swap file is the preferred way, it can simultaneously be handled/created/deleted by at least Skynet, Diversion and amtm.
I am the creator of amtm and Diversion. Skynet’s creator @Adamm and I agreed long ago on the standard to prefer a swap file for its easier management. We also agreed to use the same procedure to manage swap.
 

pirx73

Senior Member
Maybe scMerlin and other methods are not reporting swap file usage correctly, but I have never witnessed my usb-based swapfile utilize even 1KB. Never.
Look at amount of RAM in your router. There's your answer why "never" :) On AC68 i saw constant swap file usage especially when heavier addons like Skynet and Diversion are installed.
Hazel said:
in general USB sticks have a tendency to wear out faster
Absolutely agree. I tend to think about USB sticks as floppies and treat them accordingly - just for information transfer, never as longtime storage, especially for critical data.
 

coloxim

Regular Contributor
A swap file is the preferred way, it can simultaneously be handled/created/deleted by at least Skynet, Diversion and amtm.
I am the creator of amtm and Diversion. Skynet’s creator @Adamm and I agreed long ago on the standard to prefer a swap file for its easier management. We also agreed to use the same procedure to manage swap.
Perfect!!!


Thanks!
 

Makaveli

Very Senior Member
Which script do you use? Do you which one use the swap?
Thanks

all in my sig

Diversion 4.1.12 | Skynet 7.2.5 | Pixelserv-tls 2.3.1 | Scribe 2.4.3 | ntpMerlin 3.4.4 | amtm 3.2.0| scMerlin 2.3.0 | uiDivStats 3.0.0 | uiScribe 1.4.3
 

TheLyppardMan

Very Senior Member
i disagree, the firewall will block nasties already. the only benefit is if you are running any public facing services and want to block "known" baddies

amtm doesn't require swap to be used, but if you do use swap you are correct that amtm works with swap files and not partitions
Could you give a few examples of what you mean by "public facing services"? Could that include things like Plex or Synology Quick Connect on their NAS devices for instance?
 

Tech9

Very Senior Member
Look at amount of RAM in your router. There's your answer why "never" :) On AC68 i saw constant swap file usage especially when heavier addons like Skynet and Diversion are installed.

Possibly. I've never seen any swap usage on AC86U with 512MB RAM.
 

Stephen Harrington

Senior Member
I've never seen any swap usage on AC86U with 512MB RAM.
Probably varies quite a lot depending on what your usage is and what add-ons you have installed.
I used to see the odd small bit of swap usage, 20-50 MB or so, on my old RT-AC86U, but that died in a power surge and since getting an RT-AX86U I've never seen the swap file get any use at all. I assumed that could be because I now have 1GB of RAM and it's not needed anymore for my use case?
 

Tech9

Very Senior Member
I assumed that could be because I now have 1GB of RAM and it's not needed anymore for my use case?

One of the reasons. I looked at the scripts, some may use it temporary or it's there just in case. I believe Skynet may use it during blocklists updates, if available free RAM is not enough. Developers purchased insurance in case someone goes crazy with blocklists. I never triggered swap file use in my tests.
 

miniterror

Regular Contributor
I see people stating with Diversion a SWAP file is needed.
To be fair i have Diversion running and uiDivStats, these are the only two scripts i have running at the moment.
According to the system im still far away from exhausting my memory on the AX-86U, so in my experience it isnt needed for a AX-86U
Within Diversion i have 1.751.xxx domains blocked, so not a small list in my opinion.
1627023465170.png
 

bluepoint

Very Senior Member
I see people stating with Diversion a SWAP file is needed.
To be fair i have Diversion running and uiDivStats, these are the only two scripts i have running at the moment.
According to the system im still far away from exhausting my memory on the AX-86U, so in my experience it isnt needed for a AX-86U
Within Diversion i have 1.751.xxx domains blocked, so not a small list in my opinion.
View attachment 35167
You are far from exhausting your memory in a normal diversion usage, however, once diversion updates and process the blocking list that is when it uses a lot of memory often exhausting the remaining available free memory at which point it uses the swap file. Maybe because the author anticipated the problem together with skynet, they required a certain size for the swap file. Also, diversion clears the memory cache before or after the processing the blocking list on every scheduled runs.
 

Hazel

Regular Contributor
I see people stating with Diversion a SWAP file is needed.

It's not a requirement, but a recommendation:

3) A minimum size of 2 GB is recommended. Diversion uses between 40 to 250 MB of disk space, depending on log file and blocking list size. Entware uses about 20 MB. In addition to that, creating a swap file is recommended with sw. The minimum swap file size is 1 GB.
Source: https://diversion.ch/diversion/requirements.html

Diversion will use a 'lighter' blocklist temporarily when it's craving for additional system resources. Nevertheless, using a swap file will make operations somewhat smoother while Diversion is processing its tasks, even when it only uses a fraction of your swap file, because Linux memory management is (most of the time) so efficient that if it uses your swap file, even though it might only be for a few MB's, it's because it actually needs it.
 

pirx73

Senior Member

Clark Griswald

Senior Member
I have always created/used a swap file whenever an amtm script "recommended"
(currently 2GB Swap File on 120GB SSD).
Griswald Life Pro Tip:
When you don't know what you are doing, follow the "recommended" ;)
 
Last edited:

Similar threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top