Your here: .. / .. / TomatoUSB Tutorials / How to set up NAS and Optware on Tomato for Total Noobs

Also if you are looking for a vary easy way to install optware see NAS and Optware done easy.


The first step is to get yourself a Linux environment. I suggest using a noob friendly build like Ubuntu. You can use it as live distro, install it, or create a virtual machine. As this is a total noob guide, I am inclined to think all of you reading this come from windows, so the easiest way is to make a live cd, live usb, and work from there, I suggest using Ubuntu. For this guide to work correctly, or just to work, you need internet connection.

Setting up you linux environment

1. Just go into, download it, and follow the tuto to create a live cd, or live pendrive.

2. Once on Linux, connect the usb drive you want to format.

Setting up your usb drive correctly

If you just want to share your drive, and not install Optware, skip this.

1. Go to system, Administration and Gparted Partition Editor, if you haven’t got it installed, install it through synaptic package manager.

2. Select you drive on Gparted, and now Delete all partitions.

3. Create a new partition with 512mb using linux-swap format, and call it SWAP (if you prefer using other names on the partitions, feel free to use them, but remember to change them everywhere where you see the names I use)

4. On the space left you have two options, make a big partition with all the space, to share and install optware, or make different partitions one to share, and the other just for optware ( I suggest using one big partition for everything, and then on the nas, jus show the folders you want restricting the access, or eliminating visibility) If you want to follow my approach you'll have to select the unformatted space and create a new partition, name it OPTWARE, use ext3 as format (if on pendrive use ext2).

5. When Gparted finishes, unplug extract the drive and plug it in your router.

Set Tomato to work with your drive

1. Log into your Tomato router, go to USB and NAS and check Core USB Support, USB 2.0 Support, if you are going to use usb 1.1 also check those boxes, the same as usb printer support, just if you are going to use it, check the filesystems that you will be using, in this case if you did what I said and aren’t going to plug any other drives, just check Ext2/Ext3. Also check Automount.

If you dont want to install Optware, and just share your drive you are done, skip this.

2. Nice now you should see at the bottom of the page on attached Devices, your drive, with the partitions you made, you'll see swap is not mounted.

3. Use telnet or ssh and log to your router.
(for an easier cleaner way see How to enable swap in TomatoUSB)

4. Type:

vi /etc/fstab

5. Now lets introduce our custom Fstable, copy the selected to the opened table with the right click and paste (If you have more partitions or drives, or different naming scheme, mount their labels accordingly, and don’t mount for example two different drives on /opt at the same time!, also remember, all this is case sensitive).

#device Mountpoint FStype Options Dump Pass#
LABEL=SWAP none swap sw 0 0
LABEL=OPTWARE /opt ext3 rw,noatime 1 1

6. Now press esc twice, and type:


This will save the fstab temporarily on your router ram.

7. To make it permanent type:

nvram setfile2nvram /etc/fstab
nvram commit

8. When rebooted, log with telnet or ssh and type :


It should show your mounted partitions, it will look something like:

Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/root                 5568      5568         0 begin_of_the_skype_highlighting              5568 5568 0      end_of_the_skype_highlighting 100% /
tmpfs                    30984       628     30356   2% /tmp
devfs                    30984         0     30984   0% /dev
/dev/sda2            480204528  18649556 437161912   4% /opt

If you log on tomato web ui you will see that swap is mounted, and that your ext3 partition is mounted as /opt.

9. Now on USB and NAS, USB Support, Run before unmounting, type

# Unmount Opt from flash drive
umount /opt
sleep 2

10. If you installed optware as transmission or plowshare also kill them before unmounting, so type for example:

# Unmount Opt from flash drive
killall screen
killall transmission-daemon
sleep 2
umount /opt

Congratulations, now you are ready to start installing optware and start setting up your nas samba share, ftp, media server etc.

Tweak your usb HD

Lets add spindown if possible and modify swapiness on tomato. 1. Log on tomato web ui and go to USB and Nas, File Sharing, enable file sharing with no Authentication to start, when finished change it as you like, and add access to /opt or /mnt if you don't want optware.

2. Log on telnet or ssh to your router, and type:

scsi-stop /dev/sda

You should hear your drive spinning down.

3. Now go into your share and copy something or open something and you will hear the drive spinning up.

4. Try again spinning it down and then up for a few times, to make sure everything is OK.
If your drive is not compatible it wont work, just forget about it and continue.

5. Optional, in telnet or ssh typing:

dmesg | tail

You can look at the kernel messages. Make sure there are no scary warning/error messages about USB drives or devices.

12. Once done this download this file:

and paste the sd-idle-2.6 somewhere on your /opt or /mnt partition.

13. Go to tomato web ui, into administration, scripts and Init.

Input the following:

/opt/any folder you created for the program, or not/sd-idle-2.6


/mnt/any folder you created for the program, or not/sd-idle-2.6

For example my script looks like:


Remember to type the folders exactly as their name is, with lower and upper case letters.

14. To make sure you have permission to autorun the file type on telnet or ssh:

chmod +x /opt/(or /mnt)any folder you created for the program, or not/sd-idle-2.6


chmod +x /opt/share/spindown/sd-idle-2.6

15. Now reboot. To change settings on the idle program, if you used the same directory setup as I did use this, if not change accordingly:

root@unknown:/tmp/home/root# cd /opt/share/spindown
root@unknown:/opt/share/spindown# sd-idle-2.6 --help
Usage: ( runs as a daemon )
  sd-idle-2.6 [ -d devices ] [ -i idletime ] [ -c checktime ] [ -h --help ] [ -v --version ]
    -d  [a-z]+   include where a => /dev/sda, b => /dev/sdb (default is all disks)
       ![a-z]+   exclude
    -i n         n seconds a disk must be idle to spin it down (default 900, min 300)
    -c n         n seconds to sleep between idle checks (default 30, min 5)
    -h --help    usage
    -v --version version
  for example:
    sd-idle-2.6        will manage all disks with default times
    sd-idle-2.6 -d bc  will manage /dev/sdb, /dev/sdc with default times
    sd-idle-2.6 -d !bc will manage all disks except /dev/sdb, /dev/sdc with default times
    sd-idle-2.6 -i 600 will manage all disks spinning down after 600 seconds or 10 minutes

As you can see, for example if you type:

cd /opt/share/spindown/sd-idle-2.6 -i 600

Your drives will spindown with 5 minutes of inactivity, the minimun time accepted.

16. Now lets change swapiness, all this is of course is optional.

Swapines is how linux determines when to start swaping pages to swap, I have mine set to 75, so when my memory drops down to 75 avaylible, tomato starts swapping.

To check your swapiness type on telnet or ssh:

cat /proc/sys/vm/swappiness

17. To change your swapiness for example to 75 type:

echo 75 > /proc/sys/vm/swappiness

When rebooting this seting will be lost and it will be reverted to default swapiness.

18. To make the changes we are doing permanent the easy way, go to tomato web ui, into administration, scripts and Init. Input the following under the already written:

echo 75 > /proc/sys/vm/swappiness

Some people like this value low so their ram is kept fully usen and everything is snappy, I like it high so that tomato uses the Ram for what is really important, you can play with this number and see how it goes.

19.Reboot. Your done.


If you are sick of having to log into telnet or ssh each time, try this method:

  1. Download putty:
  2. Unzip the file in a folder and open Puttykygen, generate a key, and dont give it a password.
  3. Click save private key, and save publick key, and save both, dont close Puttykygen yet.
  4. Now go into tomato webui and into admin access.
  5. Enable SSH Daemon enable at startup and Allow Password Login, now go to Authorized Keys and copy all the key from Puttykygen, from the first number or letter to the las you see, and save.
  6. Go to putty, type your router ip, select ssh, now go to Connection, SSH, to Auth, and on Private key select your previously saved key.
  7. Now go to Session, on Saved Sessions type a name for this config (I have it as TOMATO), and click on save.
  8. Now create a shortcut for putty, right click on it, properties, and at the end of the path type -load "TOMATO" (or the session you just created), apply, accept, and your done, you can now enter tomato without logging in, and with a little security.
  9. If you dont need remote access to ssh, disable it, I think this approach is much more safe, than adding the hostname, username, and password at the end of the shortcuts path.

Installing the prerequisites for optware

1.For optware installation, first we need ipkg and Uclib, for this just type the following on telnet or ssh:

wget -O - | tr -d '\r' > /tmp/
chmod +x /tmp/
sh /tmp/
sleep 5
ipkg update
sleep 5

2. Your done, already!! Now to install Optware, you just need to install the package you want and of course its dependencies.

Installation of popular Optware packages

Here we will revise some basic installation and configuration of popular Optware.

Remember that before you unplug the usb hd or reboot the router, it is recommended to kill all optware running, so add the necessary commands on run before unmounting, like:

killall screen
killall transmission-daemon
sleep 2
umount /opt


1. To install Plowshare, which is a really efficient command line downloader uploader, first you install the program:

ipkg install plowshare

2. Now install all its dependencies, and screen, which will help us managing and monitoring plowshare:

ipkg install libtool
ipkg install tesseract-ocr
ipkg install imagemagick
ipkg install coreutils
ipkg install py25-pil
ipkg install ossp-js
ipkg install recode
ipkg install screen
sleep 10

3. To start a daemon for plowshare:

screen -dmS plowshare

And to attach to the daemon for plowshare:

screen -r plowshare

When you close telnet or ssh, and want to see how plowshare is doing just type:

screen -r plowshare


screen ls
screen -x screen_session_name

4. When you are done with it, or it finished downloading or uploading, type:

Killall screen

5. To download to a folder, with a text file that has multiple links for example from megaupload I use:

plowdown -a user:password -m "/opt/Optware/Downloads/Download_link_list.txt"

6. To upload from a folder with multiple files and to wright the links from the upload on a text file, for example uploading to megaupload I use :

cd /Path of your folder/
for i in *; do plowup -a User:Password -d "Description" "$i" megaupload; done >> /Path of your folder/megaupload.txt
exit 0

7. For more info ask, or go to


1. To install Transmission a popular torrent downloader type:

ipkg install transmission
sleep 5

2. For it to create the necessary config files to run type:

/opt/bin/transmission-daemon -g /mnt/data/torrents/.config/transmission-daemon
killall transmission-daemon
sleep 2

3. To modify this settings type:

vi /mnt/data/torrents/.config/transmission-daemon/settings.json

Once u’r done press esc twice and type:


You can also modify them if you have share enabled on /opt with a program like WinVi32, don't use notepad because when saving will make the file to loose format.

Remember to disable whitelist or to add your ip, or your lan (192.168.1.*) if not you wont be able to access the webui. 4.You can add a torrent watch folder adding and replacing this lines at the bottom of the config file:

    "upload-slots-per-torrent": 14,
    "watch-dir": "/opt/Optware/Torrents",
    "watch-dir-enabled": true

5. You need to forwar Transmissions ports so go to tomato web ui, into administration, scripts and Firewall. Input the following to forward transmissions ports:

# for Transmission (Bit-torrent client)
iptables -I INPUT -p tcp --dport 65534 -j ACCEPT
iptables -I INPUT -p udp --dport 65534 -j ACCEPT
iptables -I INPUT -p tcp --dport 51413 -j ACCEPT
iptables -I INPUT -p tcp --dport 9091 -j ACCEPT

Now reboot.

6. To run transmission type:

/opt/bin/transmission-daemon -g /mnt/data/torrents/.config/transmission-daemon

7. To access the webui go to

Remember you can change download folder, activate and change incomplete download folder, etc.

Samba File sharing

To enable file sharing through samba (accessible on all oses) go to: 1. Tomato web ui USB and NAS, USB Support, File sharing, and enable file sharing, with or without authentication, that’s up to you, (for the first try ill try without authentication).

2. At the bottom of the page, you can mount the directories, or partitions you want to be seen or shared, and you can select to make them visible or not, writable, or not, etc, is quite self explanatory.

I usually create a folder on /opt, called optware, through telnet:

cd /opt
Mkdir optware

Then mount /opt/optware, and name it share, make it read/write and not hidden.

Then I access that folder and create Downloads, Uploads, Torrents, Incoming, folders and set my optware to use those folders accordingly.

3. If you are not using Optware and haven't configured manually your drive partitions (they are being managed by automaunt), your partition should be mounted as /mnt, so create folders on it, and make them visible through the method I exposed, or make visible all the partition.

VPN (File sharing through WAN)

Follow this method until I create my own tuto:

FTP server

Tomato has an integrated FTP sever, so it is really simple to set it up within the gui, im adding this small tuto as some people have had problems setting up FTP….. allthough its pretty Public Root Directory.

  1. Open tomato's web ui and go to USB and NAS, FTP server.
  2. Once there you must select to enable the FTP server on Lan or also make it viawable on WAN.
  3. Select your ftp port (I suggest leaving the default 21), and forward it if you want it to be seen on Wan. To forward it just go to port forwarding, basic, and on ext ports, type 21, on Int adress type, on description, name it as you like (FTP).
  4. Now select if you want anonimus users to acces, to read, read and write, or just write.
  5. I wouldnt allow Admin login, just my grain of salt.
  6. On Directories select what directories you want who to see, for example I've got as Anonymous Root Directory: /opt/optware/Uploads, as Private Root Directory: /opt, and as Public Root Directory: /opt/optware (private will create an exclusive directory on the directory and partition you select, with the name of the private user, and he/she will only be able to see that folder).
  7. Enable the limit connection attemps.
  8. Add users at the bottom of the page, and you are done with the basic config (private is on the same menu as read/write, etc).

Media Server

1.To setup a Media server go to: USB and NAS > Media Server tab and click on Media / DNLA Server and click Enable.

2. Once you have it enabled, you need to decide and setup where the database is saved for you media and other options. If you have very few music, pictures or videos then you can leave everything at default and just turn on "Scan Media at startup" and reboot.

3. If you have many media to share you will be better of designating a location on your “usb hd” orr jffs (I recommend doing it on your usb), to save the database, so create a Custom Database Path. Doing this will ensure that you have enough space for your database.

4. On Database Location select "Custom Path" in the drop down box, and then enter the path to your hard drive, I suggest you create an specific folder for your database.





Depends on your config.

You can use any name you wish for the folder.

5. If you have a Tivo you can click on the Tivo Support and your Tivo will be able to connect to your hard drive and play TiVo compatible videos, music and display pictures.

6. The Strictly adhere to DLNA standards will allow server-side downscaling of very large JPEG images, which may hurt JPEG serving performance on (at least) Sony DLNA products. I recommend leaving it off unless you are having a particular issue with Jpeg images.

7. On media directories if you want the whole hard drive to be scanned for media you can leave the directories at the default setting of /mnt or /opt If you want to restrict the scan to specific directories or types of media then you can specify the type of media and the directory to scan specifically. The directory has to be exactly entered. example:

/mnt/videos    Video only


/opt/videos    Video only

8. Once you have everything set then click on Save. Depending on the amount of files you have to be scanned and their types it could take some time for everything to show up on your DLNA client. In addition, depending on what DLNA client you are using you may need to force a re-scan on it also.

Specific optware guide requests

If you want an specific optware guide ask for it here:


1. If by any means you get an error working with ipkg, like :

sh: wget: Permission denied
An error ocurred, return value: 1.
Collected errors:
ipkg_download: ERROR: Command failed with return value 127: `wget -q -P /opt/ipkg-znDmt5

or any other, just share opt and make it writable on the file sharing, go to /opt/etc/profile, and remove the following cose:

PS1="[\u@\h \W]$ "

save and everything will be back to normal.

2. If when you reboot, Transmission has been reset to default, change the directory of the settings from:


to something like


To do this:

Delete /mnt/data/torrents/.config/transmission-daemon and run on telnet or ssh:
/opt/bin/transmission-daemon -g /opt/.config/transmission-daemon
killall transmission-daemon
sleep 2

Once done, modify the new settings using WinVi32 or:

vi  /opt/.config/transmission-daemon/settings.json

Press Esc twice, then:


Now to run again Transmission but with the modified config directory type on telnet or ssh:

/opt/bin/transmission-daemon -g /opt/.config/transmission-daemon/

3. If when you run Plowshare you happen to get an error like:

/usr/bin/ line 250: /dev/fd/62: No such file or directory

Its missing a symlink. Type:

ln -s /proc/self/fd /dev/fd

Remember that when you reboot the symlink will be gone, so add it to the init scripts on administration.

Now your ready to plowup and plowdown :p


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