This guide explains what is BTFS (Bittorrent filesystem), and how to mount a torrent or magnet link on your filesystem as a read-only directory using BTFS in Linux.
Table of Contents
What is BTFS?
The torrents have been around for a long time to share and download data from the Internet. There are plethora of GUI and CLI torrent clients available on the market.
Sometimes, you just can't sit and wait for your download to complete. You might want to watch the content immediately. This is where BTFS, the bittorent filesystem, comes in handy.
BTFS is a bittorrent filesystem based on FUSE. Using BTFS, you can mount the torrent file or magnet link as a directory and then use it as any read-only directory in your file tree.
The contents of the files will be downloaded on-demand as they are read by applications. Since BTFS runs on top of FUSE, it does not require intervention into the Linux Kernel.
Install BTFS in Linux
BTFS is available in the default repositories of most Linux distributions.
On Arch Linux and its variants, run the following command to install BTFS.
$ sudo pacman -S btfs
On Debian, Ubuntu, Linux Mint:
$ sudo apt-get install btfs
On Gentoo:
# emerge -av btfs
BTFS can also be installed using Linuxbrew package manager.
$ brew install btfs
Mount Torrents and Magnet links using BTFS Bittorrent Filesystem
Disclaimer:
Downloading copyrighted material using BitTorrent is illegal. Neither the author nor this website shall be held responsible for the misuse, and side effects resulting from using the info in this article. Read our Terms and Conditions and Privacy Policy for details.
BTFS usage is fairly simple. All you have to find the .torrent file or magnet link and mount it in a directory. The contents of the torrent file or magnet link will be mounted inside the directory of your choice.
When a program tries to access the file for reading, the actual data will be downloaded on demand. Furthermore, tools like ls, cat and cp works as expected for manipulating the torrents.
Applications like vlc and mplayer can also work without changes. The thing is the players don't even know that the actual content is not physically present in the local disk and the content is collected in parts from peers on demand.
Now let us mount a video torrent file as a directory in our flesystem and play the video using VLC player.
Step 1: Create a directory to mount the torrent/magnet link:
$ mkdir mnt
Step 2: Mount the torrent/magnet link:
$ btfs video.torrent mnt
This will mount the given torrent file as directory on mnt
directory.
Cd to the directory:
$ cd mnt
And, start watching!
$ vlc <path-to-video.mp4>
Give BTFS a few moments to find and get the website tracker. Once the real data is loaded, BTFS won't require the tracker any more.
Unmount BTFS filesystem
To unmount the BTFS BitTorent filesystem, simply run the following command:
$ fusermount -u mnt
Now, the contents in the mounted directory will be gone. To access the contents again, you need to mount the torrent as described above.
Conclusion
The BTFS application will turn your VLC or Mplayer into Popcorn Time. Mount your favorite TV show or movie torrent file or magnet link and start watching without having to download the entire contents of the torrent or wait for your download to complete. The contents of the torrent or magnet link will be downloaded on demand when accessed by the applications.
Resource: