Converting your Raspberry Pi into a light weight torrent box

Raspberry Pi is one of the most common SBC (Single Board Computer) available in the market. It’s cost and performance makes the product very popular among tech enthusiasts. Even though the hardware details of the Raspberry Pi remains a mystery, the software support for the board is quite impressive. Almost all the required packages are ported and stable for RPi which makes it one of the best choices for prototyping.

I have a Raspberry Pi 2 Model B and I would like to transform my RPi to a light weight torrent box. I would like to be able to push torrents to the torrent box from any location and download the content. That way I will be able to utilize the available bandwidth of the inernet connection in the best possible way. I would also like to schedule torrent downloading time to get the maximum out of off peak internet usage.

In order to design a reliable torrent box we need several things.

  1. A torrent client
  2. An external storage
  3. A method to remotely push torrents
  4. A method to schedule torrents

Before doing anything on the Raspberry Pi it is important to upgrade and update the repositories and all the available packages to make sure that we have all the current patches installed on our system.

$: sudo apt-get upgrade
$: sudo apt-get update

The Torrent Client

2000px-Deluge-Logo.svgWe need to select a torrent client and install it.

There are several torrent clients we can use for this purpose. The one that I am interested in is ‘deluge’. I would like to do all the configurations in CLI therefore I will not be using any GUI applications. There is no paricular reason for that, but I just like it that way.

We need following packages to use deluge torrent client.

  • deluged – Daemon for deluge
  • deluge-console – The console application which communicates with daemon

$: sudo apt-get install deluged
$: sudo apt-get install deluge-console

Just run the daemon to see whether it executed without any errors.

$: deluged
$: deluge-console


Type ‘exit’ to close the deluge-console. Use the following command to stop the deluge daemon.

$: sudo pkill deluged

Deluge looks at ‘auth’ file to make sure that proper authentication parameters are available. Therefore the next task is adding the authentication parameters in the file. But before doing that let us backup the original file. This will make sure that if we add some wrong authentication parameters, still we can revert back to the original file. The format of the data for this file should be ‘username:password:priority’.

$: cp ~/.config/deluge/auth ~/.config/deluge/auth.bkup
$: echo “pi:raspberry:10” >> ~/.config/deluge/auth

Note that ‘pi’ is the username and ‘raspberry’ is the password. The value 10 is the priority.

Next thing we need to do is change the configuration file of the deluged to allow remote access. This would allow other seeders to connect to the torrent client. This is said to be a security issue, but I don’t mind someone hacking into my RPi. If someone hacked in please let me know how you did it.

Now we’ll edit the configurations.

$: deluged
$: deluge-console “config -s allow_remote True”
$: deluge-console “config allow_remote”

After this we need to connect to the host. Which in this case is our local IP which is connected to the internet. Here we should include the <IP> <UserName> <Password> in the command.

$: deluge-console “connect pi raspberry”

External Storage

Now the configurations of the torrent client is done. The next thing is to mount a storage device to the RPi. This is not an essential step. But chances are that you will hardly use the files you downloaded, on the RPi itself. Therefore it will be easier to mount an external storage device (External hard disk, USB flash) and directly store the files there.

I tried connecting my Transcend external hard drive to the RPi directly. It did not come up as I expected. I assumed that the power is not enough to drive the external hard disk. So we need to connect external power to the Hard Disk. That is too much power supplies for one application, therefore I decided to use an 8GB pen drive that I have. (Later I will include the external hard disk)

First thing to do after you connect the USB flash drive would be to check whether the RPi can detect it. Execute the following command,

$: sudo fdisk -l

Now you should see your USB drive as follows,


When we talk about the storage devices, one of the most important decision to make would be “What file system should I use?”. My idea is to download torrents in RPi and move the files to a Windows PC. So it is pointless to format the storage device using file systems such as ext3 or ext4. The FAT32 file system has been around a long time now (I think it was introduced along with Windows 95) and the general file operations on a device with FAT32 file system is supported by Linux. Nevertheless, we should take into account that the maximum file size FAT32 can accommodate is 4GB. Note that in this case I have formatted the USB flash to FAT32 file system.

$: mkdir -v -p /mnt/usb_flash

$: sudo mount /dev/sda1 /mnt/usb_flash -o uid=pi,gid=pi

Now make sure that your drive is mounted properly.

$: df -h

Now make sure that you can read/write data to the disk. These are just sanity tests. This would prevent us being stuck in later stages in the task.

$: cd /mnt/usb_flash

$: touch a

$: echo “hello” > a

$: cat a

Now the device is mounted properly and we confirmed it. Yey!!!

Adding Torrent Files

The next thing we need to do is adding the required torrent. There are many ways to add a torrent but I would use .torrent files to add them. In this first phase I will use manual method to add the torrents to the deluge torrent client. Later I need to implement a way to push torrents from a different location to the RPi.

Copy the torrent file to some location in the RPi. Let’s say it is in the home directory with the name my_file.torrent.

Please ensure that deluge connect is called as mentioned in one of the earlier steps.

Now, let’s add the torrent.

$: deluge-console “add -p /mnt/usb_flash /home/pi/my_file.torrent”

You can use the following command to check the progress of the torrent.

$: deluge-console “info”

Now we can easily download any torrent to our thumb drives. In the next article I will extend this torrent box to make it very easy to use. If you have any questions please put a comment below.

Thank you.


Leave a Reply

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

You are commenting using your 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 )

Connecting to %s