What's new

Swap file not mounting?

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

Dan Z.

New Around Here
I recently setup a swap file on my USB drive (Merlins 384.8_2) and while everything looks okay from the logs:

Jan 6 10:43:39 usb: USB vfat fs at /dev/sda mounted on /tmp/mnt/ASUS.
Jan 6 10:43:40 custom_script: Running /jffs/scripts/post-mount (args: /tmp/mnt/ASUS ) - max timeout = 120s
Jan 6 10:43:40 rc_service: hotplug 1871:notify_rc restart_nasapps


it doesn't appear that the swap file is being recognized:


ASUSWRT-Merlin RT-AC86U 384.8-2 Sat Dec 8 18:21:22 UTC 2018
myrouter:/tmp/home/root# free
total used free shared buffers cached
Mem: 440436 274184 166252 0 72 27324
-/+ buffers/cache: 246788 193648
Swap: 0 0 0

If I manually use this command swapon /tmp/mnt/ASUS/myswap.swp I then see this:

myrouter:/tmp/home/root# free
total used free shared buffers cached
Mem: 440436 275956 164480 0 72 28324
-/+ buffers/cache: 247560 192876
Swap: 262140 0 262140


Since this is the first time I've done this, is this normal behavior until system memory starts to fill up and it starts using the swap location? Many thanks, in advance.
 
If I manually use this command swapon /tmp/mnt/ASUS/myswap.swp I then see this:
Add this line to post-mount script.
 
You have to have some process that turns on the swap file (usually in post-mount). It won't magically do it itself.
 
I recently setup a swap file on my USB drive (Merlins 384.8_2) and while everything looks okay from the logs:

Jan 6 10:43:39 usb: USB vfat fs at /dev/sda mounted on /tmp/mnt/ASUS.
Jan 6 10:43:40 custom_script: Running /jffs/scripts/post-mount (args: /tmp/mnt/ASUS ) - max timeout = 120s
Jan 6 10:43:40 rc_service: hotplug 1871:notify_rc restart_nasapps


it doesn't appear that the swap file is being recognized:


ASUSWRT-Merlin RT-AC86U 384.8-2 Sat Dec 8 18:21:22 UTC 2018
myrouter:/tmp/home/root# free
total used free shared buffers cached
Mem: 440436 274184 166252 0 72 27324
-/+ buffers/cache: 246788 193648
Swap: 0 0 0

If I manually use this command swapon /tmp/mnt/ASUS/myswap.swp I then see this:

myrouter:/tmp/home/root# free
total used free shared buffers cached
Mem: 440436 275956 164480 0 72 28324
-/+ buffers/cache: 247560 192876
Swap: 262140 0 262140


Since this is the first time I've done this, is this normal behavior until system memory starts to fill up and it starts using the swap location? Many thanks, in advance.
Oh, I should also add that this only information in my post-mount script:

#!/bin/sh
swapon /tmp/mnt/ASUS/myswap.swp

Sorry I forgot this info in the original post.
 
Add this line to post-mount script.
My apologies - I added that info after my initial post:

"Oh, I should also add that this only information in my post-mount script:

#!/bin/sh
swapon /tmp/mnt/ASUS/myswap.swp


Sorry I forgot this info in the original post."
 
I suspect your post-mount script is not actually running successfully.

Try this and then reboot your router:

Code:
dos2unix /jffs/scripts/post-mount
chmod 755 /jffs/scripts/post-mount
 
I suspect your post-mount script is not actually running successfully.

Try this and then reboot your router:

Code:
dos2unix /jffs/scripts/post-mount
chmod 755 /jffs/scripts/post-mount
Okay, I ran the commands you suggested and after a reboot the results are still the same - again, I can manually use the swapon command to engage the swap file so at least it works. Any other ideas? And than kyou for taking the time to offer your suggestions, it is appreciated.
 
Okay, I ran the commands you suggested and after a reboot the results are still the same - again, I can manually use the swapon command to engage the swap file so at least it works. Any other ideas? And than kyou for taking the time to offer your suggestions, it is appreciated.
Try running:
Code:
/jffs/scripts/post-mount
 
Arghhh....I found the issue. Like most programming problems, this was a case of user error...when I deleted and recreated the post-mount script I typed one char incorrectly - this is what is was: swapon /tmp/mst/ASUS/myswap.swp So I type it correctly (mNt) and after a reboot everything came up correctly. Duh...sorry everyone.
 

Latest threads

Sign Up For SNBForums Daily Digest

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