Apart from GUI and Command line downloaders, torrent has been a great source of data downloading and sharing.
But, there are times when you just cannot wait for your download to finish and just want to watch the content, like I do with WWDC everytime 😉
It might’ve happened many times with you too when want to see your favourite show/movie on torrent and have to wait for the download to complete to have a glimpse of your favourite content
If you are a programmer and have fun with H/w tools like Raspberry Pi, it is pretty obvious that you don’t have display connected to your Pi all the time, but you can access the files over the network right to your laptop. that’s when a nice little tool comes into play.
BTFS – BitTorrent File System
It is a tool that allows you to mount any .torrent file or magnet link on a directory just like you mount a system drive or a network drive. Tools like ls, cat and cp works as expected.
It lets you to use it as any read-only directory in your file tree.
Sounds cool, right ? Yeah, but…
What is the use of this tool ?
In its most popular likely use, it would turn VLC into Popcorn Time. Mount a TV season torrent and watch episodes without necessarily using enough disk space for the whole set or waiting for completion.
Contents are downloaded on demand when accessed by the applications like Vlc or mPlayer , gedit , file-roller (for zip/tar files)
Currently supports Linux only.
BitTorrent File System is a FUSE based tool.
What is FUSE ?
FileSystem in UserSpacE is a simple interface for user space programs to export a virtual filesystem to the Linux kernel. Fuse also aims to provide a secure method for non privileged users to create and mount their own filesystem implementations.
FUSE is particularly useful for writing virtual file systems. Unlike traditional file systems that essentially save data to and retrieve data from disk, virtual filesystems do not actually store data themselves. They act as a view or translation of an existing file system or storage device.
- fuse (“fuse” in Debian/Ubuntu)
- libtorrent (“libtorrent-rasterbar7” in Debian/Ubuntu)
- libcurl (“libcurl3” in Debian/Ubuntu)
How to install BitTorrent File System on Linux ?
BTFS can be installed in 2 ways
- Using default package manager
- Cloning Git
Way 1: Installing BTFS on a Ubuntu via Package Manager (Xenial, Wily, Vivid or Trusty)
$ sudo add-apt-repository ppa:johang/btfs
$ sudo apt-get update
$ sudo apt-get install btfs
Installing on Arch Linux
$ sudo pacman -S btfs
Way 2: Building BTFS from git on a recent Debian/Ubuntu
You’ll need to install some dependencies before using BTFS
$ sudo apt-get install autoconf automake libfuse-dev libtorrent-rasterbar-dev libcurl4-openssl-dev
Now as you have successfully installed all the dependencies, it is the time to pull the git clone right to your system and install it
$ git clone https://github.com/johang/btfs.git btfs
$ cd btfs
$ autoreconf -i
$ make # use as ./btfs [.torrent or magnet link] [mount dir]
$ make install #Optional, Install if you want to use as a command
Now as you have installed BTFS on your system, you can call it anywhere as a command.
How to use BTFS ?
In order to download a torrent you need to define a mount point, so we’ll go with a relevant name,
I want to download Mr. ROBOT S01E04, let’s make a directory named mr-robot in /home/rootsh3ll
rootsh3ll@rs:~$ sudo mkdir mr-robot
It doesn’t actually matter because the file is not going to be stored on your hard drive.
Mount the .torrent file with BTFS
$ btfs \[kat.cr\]mr.robot.s01e04.hdtv.x264.killers.ettv.torrent mr-robot/
Now when you call the Video file with a video player, Vlc in our case. BTFS will start downloading the video file on-demand.
It is just like streaming feature on the GUI torrent clients like utorrent, bittorrent
You can see the download speed using “system monitor”
Best thing about BTFS is, it’ll only download data whenever data is being accessed by any application, streaming in this case. which means if you close vlc, the download speed will drop right to zero,
Assuming that you have seen the episode you might like to unmount the partition.
Just type fusermount -u and hit <TAB> twice, it’ll show you all the possible unmountable path, including yours. like /home/rootsh3ll/mr-robot in my case
Just enter/copy full path and hit [ ENTER ]and you’re done.
But here is something you’ll have to keep in mind, BTFS might be helping you very well in many cases but it is not healthy to the torrenting and community on a whole.
BTFS downloads files sequentially and not in parts like other torrent clients, and that is not recommended.
and you might ask..
Why Sequential torrenting is very bad idea ?
Because of the following reasons:
- It threatens to kill smaller swarms due to piece starvation
- It severely limits the set of peers interested in each other, thus degrades swarm-wide and local performance
- It gets the client into endgame-mode like conditions towards the end of each file, thus slowing down the download
BTFS is a nice tool which can help you in some cases but can cause damage to the community if used inappropriately.
I would recommend you to use it mainly for test purposes or in emergency, like when you are on an Raspberry-Pi or remote shell and can’t actually install anything on system, mounting a directory in /tmp/ and using magnet link with BTFS might help you.
I hope you find this article helpful and you can post a comment if you have any ideas to add about using BTFS. And if you get any errors while using it, you can as well leave a comment.