Last active
June 5, 2024 14:55
-
-
Save Aqours/90a364dd5f8729286c21cd87660f2c08 to your computer and use it in GitHub Desktop.
Creating Swap File for AsusWrt(RT-AC86U)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# @see https://www.snbforums.com/threads/add-swap-to-usb-drive-on-asus-router.46911/ | |
# 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=524288 | |
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 | |
# Uninstall swap: `swapoff /tmp/mnt/volume-label/myswap.swp` | |
# Delete swap: `rm /tmp/mnt/volume-label/myswap.swp` | |
#-------------------------------------------- | |
# Create the script file in /jffs (The following is using telnet. There are other ways to create the file) | |
#-------------------------------------------- | |
cat > /jffs/post-mount | |
# Press `Enter` | |
#!/bin/sh | |
# Press `Enter` | |
swapon /tmp/mnt/volume-label/myswap.swp | |
# Press `Enter` | |
# Press `Ctrl + Enter` keys | |
chmod 755 /jffs/post-mount | |
#-------------------------------------------- | |
# 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 512MB. | |
#-------------------------------------------- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment