Creating Ext3%Swap Partitions On Tomato
Creating Ext3%Swap Partitions On Tomato
1a) For simplicity's sake, make sure you have only one USB device attached, to avoid making a mistake
and wiping out a different device.
2) Open your favorite web browser, log into the Tomato website
4a) USB devices tend to be slow to mount, so patience helps. I usually get up and grab a cup of coffee
rather than refresh-refresh-refresh.
4b) If router doesn't recognize the USB device, verify core USB support & USB storage support are
enabled. Remember to hit Save after changing settings. Give it some time, at least a couple minutes,
then refresh the page and see if it's listed.
4c) Some devices only work if USB printer support is disabled, others require USB 3G modem support to
be disabled. Remember to hit Save. Give it some time then refresh.
4d) Occasionally I've noticed toggling on USB 1.1 Support kickstarts the process. Remember to hit Save.
Give it some time then refresh.
4e) If all else fails, and all settings are configured, try to reboot router.
4f) Typically once the router has mounted the device it'll continue to recognize it, so you can probably
turn on USB printer sharing, 3G modem support, disable USB 1.1, etc. and it'll still stay mounted. YMMV
(your mileage may vary)
Commands here follow the step's initial instructions/explanation, which are then followed by some
example output. Any subsequent commands follow the output, and so on, within a step.
8) Login to router over telnet or ssh (putty for Windows is free and supports both)
fdisk -l
9a) In my example, the device is /dev/sda and contains partition /dev/sda1 that uses a FAT32 format.
9b) It will probably be this or /dev/sdb and /dev/sdb1 but you need to read and interpret what it says
9c) /dev/jffs and /jffs is the JFFS filesystem, you do not want to touch it; do not run fdisk on a jffs device
9d) If you are at all confused STOP RIGHT NOW and ask for help!
10) Now we're going to create a new partition map and partitions:
fdisk /dev/sda
o
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that the previous content
won't be recoverable.
e extended
For a single partition you can hit enter to use the entire disk. I want to create a swap partition so I will
type +500M for a 500MB swap partition:
+500M
12a) Since I'm creating a swap partition I need to set the partition type:
Selected partition 1
Hex code (type L to list codes)
You can type L to list all types of filesystems, but 82 is Linux swap, so that's what I'll type:
82
13) Now I want to create a 2nd primary partition for ext3 data storage:
e extended
Hit enter to use the entire disk for partition 2, or if you want to use a specific value (e.g. to create a 3rd,
4th, etc. partition) then type +###M with the appropriate numeric value like I did for swap.
If you want to create 3rd, 4th, etc. partitions then go back and create them. Otherwise continue on to
the next step.
14) Now that my two partitions are created I'm going to verify the partition map is how I want it by
printing it to screen.
15) Now ask yourself: Is this how you want the disk to be? Are you sure? Are you really, really sure? If no
then hold down control & press c to break out of fdisk and abort all changes. If yes, then you need to
write it to disk.
You will then be dropped back to the shell prompt. If you failed to unmount the filesystem an error will
be displayed after ioctl. This error means fdisk couldn't write the partition map to disk, and your old
partitions are still intact. Go back to step one and unmount the partition(s).
16) Okay now you have your partitions there, and it's time to format them. Since I created a swap
partition, I'll format that one first, giving it the label "swap":
Filesystem label=Data
OS type: Linux
26 block groups
17) And you're back to a shell prompt. You can either reboot the router by typing:
reboot
At which point the router will reboot, and the default mounts will take effect.
Or you can manually mount the partitions. Because I gave the partition the label "Data" it will mount to
/tmp/mnt/Data. Therefore I would type:
mkdir /tmp/mnt/Data
Which would mount my Data partition. If you labelled your partition "Stuff" it would mount to
/tmp/mnt/Stuff instead. If you leave the label blank it will mount with the device name, which will
change depending on which USB port its plugged into (which is why labels are a Very Good Idea). Make
sure your labels are unique across devices, you don't need two partitions called Data (just call the other
one Lore).
swapon /dev/sda1
Note that swapon only affects the current state of the router. If you reboot swap gets disabled. To
"permanently" enable swap call swapon in either the Init or Firewall tab under Administration -> Scripts.
As far as I can tell the label is ignored by swapon, so if you shuffle the drive between ports then you'll
need to adjust swapon to the new device name.
18a) Do not enable swap on flash-based devices unless you like destroying flash-based devices. For short
term purposes it will be perfectly fine, but if you need swap enabled 24/7 to run something from
optware/entware/etc. 24/7 then you need to put your swap on a hard disk. I create them for what-if-I-
need-swap-at-the-remote-site-in-6-months emergency purposes, purely a temporary solution to allow
the full range of possibilities at a future date. If I needed to enable it permanently I would go through
the trouble of partitioning a HD this way and using that instead (or, likely, in addition to flash).
One last note, if you wanted to format in ext2 instead of ext3, you would use the mkfs.ext2 command
instead of mkfs.ext3. Aside from changing 3 to a 2 the command line is otherwise identical (the output
will be slightly different).a