Your here: .. / .. / TomatoUSB Tutorials / How to enable swap in TomatoUSB

Thx to jomcty

1. Partition and format a drive with a swap partition (>= 15MB) and at least one data partition (if FLASH-based drive use ext2, otherwise use ext3).

Assign the swap and data partition a single-word descriptive label. For example use the label SWAP for the swap partition. The SWAPNAME variable in the script will have to reflect this label name.

2. Create the following script in the root directory of the data partition of the external drive, using vi, naming it "00-start-swap.autorun":

# $1 - The fully qualified path of the root directory of the mounted drive
#      (w/o any trailing '/').
# See:

# The decriptive label assigned to the swap partition.
SWAPNAME=SWAP #Replace SWAP with your swap partitions label

# If no parameter, complain and quit.
[[ xx == x$1x ]] && exit

# Edit fstab to put the swap partition label there.
sed -i "/^LABEL=.* swap swap/d" /etc/fstab
echo "LABEL=$SWAPNAME swap swap" >>/etc/fstab

# Activate the swap partition
swapon -a

With the script in place in the root-directory of the mounted drive the swap partition will be mounted whenever the drive is plugged in.

The swap partition will auto-unmount when the drive is unmounted via the Tomato GUI.

swap in TomatoUSB

Community content is available under CC-BY-SA unless otherwise noted.