bbunge
Part of the Furniture
I feel that Asus routers are great and the firmware keeps getting better! Yes, there are some teething problems with Aimesh and it would be great to have SMB2 capability in the “Official” release. Merlin’s firmware for Asus has many good features, but lacks Aimesh.
One feature I’ve wanted on the official Asus is the ability to add a swap file to a USB drive. Sometimes Samba writes run teh RAM usage up. Impossible, can’t be done, no way to mount the swap file after router reboot…. Well, there is a way…
An undocumented feature I’ve discovered is the ability to specify a custom script when a USB drive is inserted. This also works when the router is started or rebooted.
I’ve tested this on a RT-N66R and a RT-AC66U_B1. For my test I used a 1 GIG USB with FAT and a 32 GIG with EXT2. I recommend you have a volume label on the drive.
On your router enable Telnet or SSH and connect to the router with a terminal or Putty.
Note: for Windows users WinSCP can be used to connect to the router with SCP, create and edit files in the /jffs directory and set permissions.
Run the command df to see where your USB drive is mounted. Should be something like /tmp/mnt/volume-label Of course use your volume label in the following commands.
Create a swap file
dd if=/dev/zero of=/tmp/mnt/ volume-label /myswap.swp bs=1k count=262144
mkswap /tmp/mnt/ volume-label /myswap.swp
Start the swap
swapon /tmp/mnt/ volume-label /myswap.swp
Run the free command to see the swap is started.
Create the script file in /jffs (The following is using telnet. There are other ways to create the file, WinSCP is recommended.)
cat > /jffs/post-mount (press Enter)
#!/bin/sh
swapon /tmp/mnt/ volume-label /myswap.swp (press Enter)
Press Ctrl + Enter keys
chmod 755 /jffs/post-mount
The contents of the script should look like this:
Modify nvram
nvram set script_usbmount="/jffs/post-mount"
nvram commit
Reboot the router, log in with telnet or SSH and run the free command. You should see the swap size of 256 MB.
One other thing… One wonders what else you can get to run from a USB drive with this?
Edited 07JAN21
One feature I’ve wanted on the official Asus is the ability to add a swap file to a USB drive. Sometimes Samba writes run teh RAM usage up. Impossible, can’t be done, no way to mount the swap file after router reboot…. Well, there is a way…
An undocumented feature I’ve discovered is the ability to specify a custom script when a USB drive is inserted. This also works when the router is started or rebooted.
I’ve tested this on a RT-N66R and a RT-AC66U_B1. For my test I used a 1 GIG USB with FAT and a 32 GIG with EXT2. I recommend you have a volume label on the drive.
On your router enable Telnet or SSH and connect to the router with a terminal or Putty.
Note: for Windows users WinSCP can be used to connect to the router with SCP, create and edit files in the /jffs directory and set permissions.
Run the command df to see where your USB drive is mounted. Should be something like /tmp/mnt/volume-label Of course use your volume label in the following commands.
Create a swap file
dd if=/dev/zero of=/tmp/mnt/ volume-label /myswap.swp bs=1k count=262144
mkswap /tmp/mnt/ volume-label /myswap.swp
Start the swap
swapon /tmp/mnt/ volume-label /myswap.swp
Run the free command to see the swap is started.
Create the script file in /jffs (The following is using telnet. There are other ways to create the file, WinSCP is recommended.)
cat > /jffs/post-mount (press Enter)
#!/bin/sh
swapon /tmp/mnt/ volume-label /myswap.swp (press Enter)
Press Ctrl + Enter keys
chmod 755 /jffs/post-mount
The contents of the script should look like this:
Code:
#!/bin/sh
swapon /tmp/mnt/ volume-label /myswap.swp
Modify nvram
nvram set script_usbmount="/jffs/post-mount"
nvram commit
Reboot the router, log in with telnet or SSH and run the free command. You should see the swap size of 256 MB.
One other thing… One wonders what else you can get to run from a USB drive with this?
Edited 07JAN21
Last edited: