|Asus RT N16 - |
For my setup I have an Asus RT N16 with Toastmans TomatoUSB build. My USB flash drive is 4GB.
Despite the popularity of this topic it was hard to find complete instructions for installation on a USB flash drive.
Following are the steps I took:
Unmount disk, if mountedOpen Tomato menu. On the USB Support page, be sure to check Core USB Support, USB 2.0 Support, USB Storage Support, Ext2/Ext3, and Automount. Save this. Your disk should appear lower on the page under Attached Devices. On the right hand side, if it is Mounted, click Unmount. - 
Create PartitionsSSH into the router using PuTTY to 192.168.1.1
Use fdisk to create the partitions. In the following lines, # and after are comments. is the enter key. - 
fdisk /dev/sda # adjust for disk if necessary. p # to see existing partitions d # to delete partition if any n # new partition p # primary partition 1 # a one for partition 1 for Optware # start at default 1 block +512M # size of Optware partition in MB; can be larger p # check partition n # new swap p # primary 2 # partition 2 Swap # start at default block +64M # size of Swap in MB; can be larger t # set type of Swap partition 2 # partition 2 is Swap 82 # swap type p # check partitions n # new Data for remaining p # primary 3 # partition 3 Data # default start block # default remaining blocks p # check partitions w # write it all out and exit
At the end, if you see a: fdisk: WARNING: rereading partition table failed, kernel still uses old table: Invalid argument ensure you are starting fdisk with using fdisk /dev/sda and not fdisk /dev/sda1!
Format PartitionsSince I'm using a USB stick and not a USB harddrive I picked ext2 for my filesystem. ext3 is journaled and will wear out a USB flash in no time.
ext2 is still recommended over journaling file systems on bootable USB flash drives and other solid-state drives. ext2 performs fewer writes than ext3 since it does not need to write to the journal. As the major aging factor of a flash chip is the number of erase cycles, and as those happen frequently on writes, this increases the life span of the solid-state device. Another good practice for filesystems on flash devices is the use of the noatime mount option, for the same reason. - #-L sets the labels of the partitions
mkfs.ext2 -L optware /dev/sda1
mkswap -L swap /dev/sda2
mkfs.ext2 -L data /dev/sda3
Automount to /optIn the USB support page hit refresh and click mount to mount the partitions.
To automatically mount the partition named "optware" in /opt paste this in the 'Run after mounting' box
if [ -d /mnt/optware ]; then
mount -o bind /mnt/optware /opt
fiOn reboot this should take effect. For now, in PuTTY, type:
mount -o bind /mnt/optware /opt
you should see this:
/dev/sda1 on /opt type ext2 (rw,nodev,noatime)
Great! You're all set to install optware.
Install optwareDownload the installation script and run it -
wget http://tomatousb.org/local--files/tut:optware-installation/optware-install.sh -O - | tr -d '\r' > /tmp/optware-install.sh chmod +x /tmp/optware-install.sh sh /tmp/optware-install.sh
Automatic package updaterTo allow optware to update its package list once a day do the following: Go to Administration » Scheduler and add the following line to the "Command" field of Custom 1, 2, or 3 (just use one that's available). Select the desired frequency (once a day is usually sufficient) -
ipkg update | logger -t OptwareThis will run the update and log the output
Race-Contition WorkaroundDetails on the race-condition are here under 'How optware integrates with TomatoUSB'
To ensure that optware's firewall and wan scripts are run even if a race-condition occurs:
Create a new file /opt/.autorun with the following contents -:
#!/bin/sh if [ -f /var/notice/wan ]; then for s in /opt/etc/config/*.wanup; do $s; done for s in /opt/etc/config/*.fire; do $s; done fi
Make the file executable: chmod +x /opt/.autorun
Awesome! optware is installed!
Using OptwareList all installed packages:
List all available packages:
Find a package: (eg find package 'transmission')
ipkg list | grep transmission
Install a package (eg install 'transmission')
ipkg install transmission
Remove a package (eg remove 'transmission')
ipkg remove transmission