Edit:
I can't remove swap file with you command or with amtm.
Code:rm: can't remove '/tmp/mnt/USB/myswap.swp': Operation not permitted
I just posted this directly above your reply.
If I use the "sw" command in AMTM and choose 1=Yes
I get thisCode:Swap file found at: /tmp/mnt/SNB/myswap.swp Delete the Swap file? [1=Yes e=Exit]
Code:Swap file deleted: /tmp/mnt/SNB/myswap.swp Added missing swap file entry to /jffs/scripts/post-mount
sync; echo 3 > /proc/sys/vm/drop_caches
sed -i '\~swapon ~d' /jffs/scripts/post-mount
swapoff -a
rm -rf "/path/to/swap/file.swp"
admin@xxx:/tmp/home/root# sync; echo 3 > /proc/sys/vm/drop_caches
admin@xxx:/tmp/home/root# sed -i '\~swapon ~d' /jffs/scripts/post-mount
admin@xxx:/tmp/home/root# swapoff -a "/path/to/swap/file.swp"
swapoff: /tmp/mnt/USB/myswap.swp: Cannot allocate memory
swapoff: /path/to/swap/file.swp: No such file or directory
admin@xxx:/tmp/home/root# rm -rf "/path/to/swap/file.swp"
admin@xxx:/tmp/home/root#
Hmmm..
Not successful....Code:admin@xxx:/tmp/home/root# sync; echo 3 > /proc/sys/vm/drop_caches admin@xxx:/tmp/home/root# sed -i '\~swapon ~d' /jffs/scripts/post-mount admin@xxx:/tmp/home/root# swapoff -a "/path/to/swap/file.swp" swapoff: /tmp/mnt/USB/myswap.swp: Cannot allocate memory swapoff: /path/to/swap/file.swp: No such file or directory admin@xxx:/tmp/home/root# rm -rf "/path/to/swap/file.swp" admin@xxx:/tmp/home/root#
admin@xxx:/tmp/home/root# sync; echo 3 > /proc/sys/vm/drop_caches
admin@xxx:/tmp/home/root# sed -i '\~swapon ~d' /jffs/scripts/post-mount
admin@xxx:/tmp/home/root# swapoff -a "/tmp/mnt/USB/myswap.swp"
swapoff: /tmp/mnt/USB/myswap.swp: Cannot allocate memory
swapoff: /tmp/mnt/USB/myswap.swp: Cannot allocate memory
admin@xxx:/tmp/home/root# rm -rf "/tmp/mnt/USB/myswap.swp"
rm: can't remove '/tmp/mnt/USB/myswap.swp': Operation not permitted
admin@xxx:/tmp/home/root#
swapoff: /tmp/mnt/USB/myswap.swp: Cannot allocate memory
sed -i '\~swapon ~d' /jffs/scripts/post-mount
swapoff -a
rm -rf "/tmp/mnt/USB/myswap.swp"
I state that was the output of AMTM.Did you delete file from within Skynet or AMTM? If you deleted withing Skynet you will need to reboot and then do as mentioned with AMTM. All you're doing with AMTM and what's necessary is to delete and expand swapfile. The reason it doesn't work through Skynet is because the swapfile is being used because you're already in Skynet UI. Hope this helps...
Ok, will try that, it just has to wait for a few hours or ...As suspected you don't have enough available ram to unload the contents of the swap file, so you will need to uninstall in two stages;
Code:sed -i '\~swapon ~d' /jffs/scripts/post-mount
Followed by a reboot of your router, then;
Code:swapoff -a "/tmp/mnt/USB/myswap.swp" rm -rf "/tmp/mnt/USB/myswap.swp"
Then the swap install command should work as expected.
The swap file is likely in use and therefore cannot be removed.Yes, I'm an idiot, still not successful....
Code:admin@xxx:/tmp/home/root# sync; echo 3 > /proc/sys/vm/drop_caches admin@xxx:/tmp/home/root# sed -i '\~swapon ~d' /jffs/scripts/post-mount admin@xxx:/tmp/home/root# swapoff -a "/tmp/mnt/USB/myswap.swp" swapoff: /tmp/mnt/USB/myswap.swp: Cannot allocate memory swapoff: /tmp/mnt/USB/myswap.swp: Cannot allocate memory admin@xxx:/tmp/home/root# rm -rf "/tmp/mnt/USB/myswap.swp" rm: can't remove '/tmp/mnt/USB/myswap.swp': Operation not permitted admin@xxx:/tmp/home/root#
swapoff: /tmp/mnt/8GB/myswap.swp: Cannot allocate memory
rm: can't remove '/tmp/mnt/8GB/myswap.swp': Operation not permitted
I am so glad I have 2GB swap files on any USB drive I use on a router.
Having a 4GB, 8GB, 16GB or larger USB drive and creating a swap file smaller than the 2GB maximum allowed seems like wasted use of resources. A larger swap file doesn't hurt anything.
I am sticking to my 2GB recommendation on an Ext4 partition with journaling enabled.
Whitelist Unbound Root DNS Servers
Use ipset restore over individual ipset commands where possible for performance improvements
Commit after nvram changes
Fix Refresh_MBans & Refresh_MWhitelist
Fix WebUI
Only update files with mismatching md5 hash
Only enable WebUI on Merlin builds
Improve Check_Files()
Only allow 1GB+ swap file size to prevent fork() error
Warn if SWAP file too small
Use swapoff -a
Improve swap removal process
Use faster Whitelist_Shared () method if SWAP size allows
Warn about swap size in main menu
I'm also a fan of the "go big or go home" way of thinking, as well as quality usb drives or ssds.
I've pushed v7.1.1
Code:Whitelist Unbound Root DNS Servers Use ipset restore over individual ipset commands where possible for performance improvements Commit after nvram changes Fix Refresh_MBans & Refresh_MWhitelist Fix WebUI Only update files with mismatching md5 hash Only enable WebUI on Merlin builds Improve Check_Files() Only allow 1GB+ swap file size to prevent fork() error Warn if SWAP file too small Use swapoff -a Improve swap removal process Use faster Whitelist_Shared () method if SWAP size allows Warn about swap size in main menu
Now time to get some sleep
Switching to a SSD was probably the best thing I did. no more worrying about usb drives dying. And accessing everything on the scripts are very quick.
lol now that you have added that warning i'm getting it now due to my 512mb swap file which hasn't given me any issues at all. Not sure if i'm going to enlarge it.
Switching to a SSD was probably the best thing I did. no more worrying about usb drives dying. And accessing everything on the scripts are very quick.
lol now that you have added that warning i'm getting it now due to my 512mb swap file which hasn't given me any issues at all. Not sure if i'm going to enlarge it.
I highly recommend it, in the future it will be a requirement to avoid fork() errors and so that certain functions can be simplified where code mitigation's were put in place.
I just checked to see if @L&LD might need to revise his guide:I highly recommend it, in the future it will be a requirement to avoid fork() errors and so that certain functions can be simplified where code mitigation's were put in place.
Fine since you are twisting my arm over it
It looks like the simple route is just to delete it and recreate it from AMTM?
Is that recommended route or do I need to start looking at it from the CLI level?
Skynet has swap uninstall/install functions fwiw, I believe amtm's were based on them. In any case, the manual method is only if you get errors trying to uninstall your swap file using the automated method.
Welcome To SNBForums
SNBForums is a community for anyone who wants to learn about or discuss the latest in wireless routers, network storage and the ins and outs of building and maintaining a small network.
If you'd like to post a question, simply register and have at it!
While you're at it, please check out SmallNetBuilder for product reviews and our famous Router Charts, Ranker and plenty more!