K.Mandla's blog of Linux experiences

Case in point: An rtorrent slave setup

Edit: Unfortunately, the images originally included in this post are gone, because of hosting problems in late 2009. My apologies.

With two wounded laptops lying around the house, and no real prospects for fixing either one of them in the near future, I decided it was time to take my own advice, and I’ve set up the battered Thinkpad as a torrent slave for my Inspiron. I suggested this setup about a year ago (as well as some other ideas), when I described a cool way to set up rtorrent, and since I have the system working and in place now, I thought I would share the nitty-gritty.

I built this with both machines running Arch, mostly for ease and speed of setup. Ubuntu and Crux will both work just as well, but for my own case I wanted to be able to build and install stuff as quickly as possible, so Arch was ideal for me. (Let’s face it, pacman makes aptitude look ridiculously slow.😈 )

I’ll explain the situation, since it is pertinent: The main laptop, the Inspiron, has a 120Gb modular drive that I use to hold files, packages, software, notes, and so forth. The main drive in the Inspiron is a faster, but smaller 60Gb drive that serves as a system drive and standard /home directory. With that arrangement, I can dump files into the modular drive when I feel I need to save them, and not worry about system rebuilds or drive crashes. I’m free to play around.

The Thinkpad has a single drive in it, and it’s neither fast nor big — a lousy 4200rpm 20Gb IBM-DJSA-220. Regardless, all of the files I download need to be shifted back to the Inspiron when they’re done.

For that reason, I actually have two shared directories listed in the client’s /etc/fstab — the download directory on my Inspiron system drive, and a temporary directory on the modular drive. When a torrent file is downloaded it is dropped in the download directory, but when the Thinkpad saves information, it sends it back across the network to the modular drive.

The Thinkpad uses its own $HOME/download directory as a session directory, and that’s what’s defined in .rtorrent.rc. The Inspiron’s download directory is mounted to $HOME/watch on the Thinkpad, and that’s how it knows what torrents are in queue.

NFS handles the transfers, of course. Both machines are wired directly into my proprietary router, and there is no access to the wireless system. I did that on purpose; I don’t care to share any of my drives with the local populace (which would probably be unlikely anyway, but that’s beside the point).😉

These aren’t much in the way of screenshots, but hopefully they’ll give you an idea of the arrangement. Here’s the host machine, the Inspiron, with the torrent in the download directory and the target file stashed on the modular drive.

Of course, the size of that file is reported as if it had already been downloaded in full; it has, in fact, only been downloading a few minutes, as this screenshot from the client machine, the Thinkpad, shows.

The lower half of the screen is shattered, which is why I don’t have anything there. There’s nothing installed on the client aside from X, Openbox, Sakura, rtorrent, elinks and few other maintenance programs. There’s not much point in installing a whole lot on this machine, since I can’t see what most of it does.

Here’s the sessions folder — the $HOME/downloads folder on the client. You can see the temporary files here that rtorrent creates.

On the left side is the symbolic link to the modular drive on the opposite machine, plus the $HOME/watch folder, which is ratcheted to the $HOME/downloads folder on the Inspiron. The contents of $HOME/watch are the same as $HOME/downloads in the first screenshot.

And that’s about all it takes. As soon as a *.torrent file appears in the watch directory, rtorrent starts working on it, sending periodic bursts to the modular drive on the host machine. Memory caching takes the brunt of the read-writes as far as I can tell, so there’s not a continual stream of traffic between the two computers, as you might expect.

You could change that if you want. I originally set up the Thinkpad with all the action isolated on that one machine, but I decided I would rather have them run in syncopation. If you prefer you can move files manually to their destination; I have a hard time seeing what is going on, so I prefer to have the file automagically transferred. The downside is that both machines need to be working to complete the arrangement. (It’s also worth noting that I can download a torrent on the client machine, add it to rtorrent manually, and the file is automatically sent to the modular drive.)

Any questions? Of course there are. Here are the configuration files for /etc/exports on the host, and /etc/fstab and .rtorrent.rc on the client. Setting up your network and NFS on each machine is your responsibility. For ease of use, I strongly recommend taking a look at the Arch Linux wiki page on NFS, which has never let me down.😉

23 thoughts on “Case in point: An rtorrent slave setup”

I have a very similar set up on my network that was actually inspired by your initial rtorrent post!

Try running rtorrent within a screen session. Whenever you want to check on rtorrent’s progress, ssh into that machine and connect to the screen session that rtorrent is running on. You’ll never have to look at that busted laptop screen again🙂

screen is such a useful tool on older (or headless) machines. running processes within screen sessions has proved invaluable…

I too took the original post on rtorrent and ran with it. I have a small machine dedicated to rtorrent. The only things I have on this machine are privoxy, rtorrent, and moblock. I run this machine headless and do the “screen” method. I must say this beats the pants off of wasting resources with a GUI torrent client.

Paul, listen: TOR is for people, who need anonymity on the net because their gevrnment will kill them or stuff like this. Stealing TOR bandwith just for downoading some movies or porn or warez stuff is a m,isuse of the TOR network. use a proxy server in another country instead, that is easy to setup with ssh -D – but leave the TOR network free from torrent traffic! As long as criminal warchiefs are dominating the world, we need TOR to fight babylon, not to collect moviez.

I’m most curious about your proprietary router! How do you isolate wi-fi traffic from your LAN, but still allow access to the Internet? If you ssh to your headless box from a laptop do you have to go out through the router, around the Internet, and then back in through the firewall to get there, or is there some secret trick to allowing certain pass-through from wi-fi to LAN?

It would be nice to open up a wi-fi again, just to be a good citizen for passers by, but without giving my neighbors full access to my NFS shares! 😛