WikiDevi.Wi-Cat.RU:Tomato/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) !/bin/sh
 * 2) $1 - The fully qualified path of the root directory of the mounted drive
 * 3)      (w/o any trailing '/').
 * 4) See: http://www.linksysinfo.org/forums/showthread.php?p=364690#post364690

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

xx == x$1x && exit
 * 1) If no parameter, complain and quit.

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

swapon -a
 * 1) Activate the swap partition

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