It is suggested to have some sort of permanent storage made available to tomato. USB is an excellent candidate and an provide a swap partition to prevent issues.
Given that you are using either an ARM build or a MIPS with USB support, it is assumed you have already enabled USB support.
For this exmaple I'm using a 16GB USB3 pen drive which is seen in the system as sda.
make sure your device is actually sda!
The echo 1000M below defines the size of the swap partition you might want to adjust that.Then:
device=/dev/sda partition=$device'1' nvram set usb_automount="0" (echo o; echo n; echo p; echo 2; echo ; echo 1000M; echo t; echo 82; echo n; echo p; echo 1; echo ; echo ; echo w) | fdisk $device mkfs.ext2 -L USB $partion mkswap /dev/sda2 swapon /dev/sda2 mkdir /mnt/sda1 && mount /dev/sda1 /mnt/sda1 nvram set usb_automount="1"
From the GUI: Disable the automount under USB and NAS/USB Support
Via SSH: delete any exsisting partitions:
At this point your USB pen drive is unpartitioned. Now let's go into creating the partition table needed:
1000M (Essentially 1 GB out for swap)
l (to verify)
w (to save and exit fdisk)
At this point you should have two unformatted partitions in your USB:
sda1 ~14GB (fs-type ext2/3/4)
sda2 ~1GB (fs-type swap)
Let's format the partitions. NOTE: it is suggested to use ext2 for pen drives and ext3 for hard disks.
mkfs.ext2 -L USB /dev/sda1 mkswap /dev/sda2
mount the partitions:
swapon /dev/sda2 mkdir /mnt/sda1 && mount /dev/sda1 /mnt/sda1
You can now re-enable the USB automount under USB and NAS/USB Support