Customize Transmission on Fonera 2.0N

I finally managed to nicely setup my Fonera 2.0N torrent client to work as I expect, even if it was not a very simple task.

What I wanted was to use a separate in-progress folder for non completed torrents and a completed folder for… guess what!

I found there are two ways to achieve this goal: having SSH access to the Fonera or having a Linux distro (a live one will do).

Preparation

In both cases you need to plug into the Fonera an USB 2.0 hard drive. I recommend not to use flash drives as they are much slower and will die quite quickly, not considering their capacity is a lot smaller: I used a 250GB USB 2.0 Maxtor hard drive I had lying around.

You don’t have to format the hard drive if it’s formatted FAT32 or ext2/ext3, but both the FOnera team and I recommend against using an NTFS formatted hard drive as it will slow down everything. Remember though that FAT32 has a maximum file size limit (biggest file it can store) of 4GB which can be easily hit if you are used to download Blue Ray images or any other big file format: I went for an ext3 file system which can accommodate all my needs and I will use Paragon ExtFS in case I wish to plug this hard drive into a Windows computer.

Once plugged the hard drive will get assigned a generated name (something like Disk-A1) which I didin’t like as it doesn’t tell much about the functionality and can get confusing if you use multiple hard drives:  I went into the USB Disk section and assigned it the name TORRENT (all uppercase) as this is going to be the disk only purpose.

Whatever is the method you will use, you need to initialize your hard drive for running the torrent client (Transmission is its name) by setting it up into the Torrent section: please ensure the drive name listed here corresponds to the name you assigned to the drive in the USB Disk section as we will use it.

After setting up the disk to run the torrent client (yes, the torrent client binaries and configuration is going to be hosted onto the external hard drive) start it and wait for the process to complete.

Customize through SSH

I start with this method as I think it’s the easiest one if you have flashed a DEV firmware which enables SSH access.

Get access to your Fonera using root as username and your Fonera WPA key as password (the default one is printed on the side of your modem), then get into the Transmission startup script located at /tmp/images/torrent/bin/start.sh.

In this file you’ll find a very long line containing startup instruction for the transmission-daemon client, and by default it contains two directives that are going to override our next customization. We will get rid of them both by removing the part --download-dir $1/torrent -c $1/torrent.

Save the file and let’s switch to a web browser to configure our transmission client through the Transmission web UI: now you will be able to change the Download folder that was previously forced to be torrent by the script we just changed: now it can be anything you like, but the folder must exists on the disk, so create it if it’s not already there. I decided to use a folder called completed, in opposition to in-progress which will store the non completed torrents. I kept the torrent folder in case I wish to upload .torrent files into the disk instead of using the web UI (probably it will never be used).

Shut down the Transmission client: this operation will write into a file your configuration.

Now we need to access the Transmission configuration without having the Transmission client running. When you start the torrent client your Fonera will open three files hosted on your hard drive within the FoneraApps folder and mount them as disks. We will do the same, but we’ll mount only one of them, the torrent.2.3.7.1.var file (the numbering might be slightly different and depends on your firmware version).

Switch back to the SSH console and issue the following commands to create a mount point and mount the disk image into it:

mkdir /tmp/torrent.var
mount -o loop /tmp/mounts/TORRENT/FoneraApps/torrent.2.3.7.1.var /tmp/torrent.var

Now you can edit /tmp/torrent.var/settings.json changing the download-dir, incompleted-dir and incompleted-dir-enable options to your desired folders, the download-dir one should already look correct as it was set by the Transmission web UI.

Mine look like:

"download-dir": "/tmp/mounts/TORRENT//completed",
"incomplete-dir": "/tmp/mounts/TORRENT//in-progress",
"incomplete-dir-enable": "true",

Now ensure those folders exist or make them yourself:

mkdir /tmp/mounts/TORRENT/completed
mkdir /tmp/mounts/TORRENT/in-progress

Customize on Linux

If you don’t have SSH access to the Fonera you can still modify the Transmission configuration as it is completely stored onto your hard drive: just shutdown the torrent client on the Fonera through the web UI and move your hard disk to your Linux box.

Once mounted you’ll find a couple of new folders that have been created by the Fonera: FoneraApps and torrent. Inside the former you’ll find three files:  torrent.2.3.7.1.fmgtorrent.2.3.7.1.var and torrent.2.3.7.1.swp (the numbering might be slightly different as it depends on your Fonera firmware version).

Let’s start with the fmg file, which I guess it stands for Fonera Image, by mounting it through the following:

cd <your usb disk mount point>
mkdir /tmp/torrent.img
sudo mount -o loop FoneraApps/torrent.2.3.7.1.fmg /tmp/torrent.img

We will have to modify the content of the /tmp/torrent.img/bin/start.sh file containing startup instruction for the transmission-daemon client: by default it contains two directives that are going to override our next customization. We will get rid of them both by removing the part --download-dir $1/torrent -c $1/torrent.

Save the file and let’s move to the next step: unmount this disk image and mount the var one with:

sudo umount /tmp/torrent.img
sudo mount -o loop FoneraApps/torrent.2.3.7.1.var /tmp/torrent.img

Now you can edit /tmp/torrent.img/settings.json changing the download-dir, incompleted-dir and incompleted-dir-enable options to your desired folders, mine look like:

"download-dir": "/tmp/mounts/TORRENT//completed",
"incomplete-dir": "/tmp/mounts/TORRENT//in-progress",
"incomplete-dir-enable": "true",

Now save the file, unmount the image and ensure those folders exist:

umount /tmp/torrent.img
rmdir /tmp/torrent.img
cd <your usb disk mount point>
mkdir completed
mkdir in-progress

Unmount your usb drive, unplug from your Linux box, plug it back into the Fonera and restart the Transmission client to enjoy your new custom configuration!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s