This tutorial explains how to write an ISO to the USB drive directly from the Internet using BTFS, without having an actual ISO image in our local system.
The title might be bit confusing. Let me clarify it. I want to create a bootable Ubuntu drive, but I don't have the ISO image in my hard drive.
In fact, the ISO image is not even in any systems in my local area network. All I have is an USB drive and an Internet-connected Linux desktop. How can I create a bootable Ubuntu usb drive?
But we are not going to download the ISO and then write it to the USB drive using any bootable creation applications.
Instead, we are going to directly write the ISO to the USB thumb drive from Internet using BTFS. Sounds interesting, right?
Pros of this method
- You don't have to download the ISO image. The contents of ISO file will be directly downloaded from the Internet on demand and written into the USB drive while we creating the bootable drive.
- The process of writing an ISO to a thumb drive is terribly slow. I created Ubuntu 18.04 server bootable usb disk. It took nearly an hour. I knew It's because of the content of the ISO is being downloaded from the Internet on demand. But one hour is way too much.
- This method worked only with Disk Image Creator gui application. The other bootable creation software gave file permission error even though I gave full permission to the directory where I kept the contents of ISO.
Like I already said, the objective of this guide is to show you how to create bootable USB drives directly from the Internet without having an actual ISO image in our local system.
However, I wouldn't recommend this method for creating bootable ISO images. It is quite time consuming process. This guide is purely for educational purpose only!
Write an ISO to the USB drive directly from the Internet using BTFS BitTorrent filesystem
If you haven't installed BTSFS yet, refer this link.
Once BTFS installed, create a directory to mount the content of the ISO file. Let us call it mnt.
$ mkdir mnt
Now, download your torrent. For the purpose of this guide, I will be using Ubuntu 18.04 server edition torrent.
Mount the torrent file (I assume you have kept the torrent file in Downloads directory) using BTFS as shown below:
$ btfs Downloads/ubuntu-18.04-live-server-amd64.iso.torrent mnt/
The above command will mount the Ubuntu 18.04 LTS torrent file in mnt directory. Give BTFS a few moments to find and get the website trackers. Once the real data is loaded, BTFS won’t require the tracker any more.
Now, plug in your USB drive, open the file manager and go to the mount directory i.e mnt in our case. There you will see the ISO image.
Right click on the ISO file. From the right-context menu, Choose Open with -> Disk Image Writer.
If the Disk Image Creator option is not available, please install GNOME Disks. It is a graphical utility to manage disk drives and media.
On Arch Linux and its derivatives:
$ sudo pacman -S gnome-disk-utility
On RHEL, CentOS, Fedora:
$ sudo yum install gnome-disk-utility
$ sudo dnf install gnome-disk-utility
$ sudo zypper in gnome-disk-utility
In the next screen, choose the destination drive i.e your USB drive. Double check if you have chosen the correct drive. Finally, click Start Restoring button.
The BTFS will download the contents of the torrent file directly from the Internet and the Disk Image Creator application will write the ISO into your USB drive.
Now grab a cup of coffee. Like I already said, it may take a long time to complete depending upon your Internet speed.
I have tested Ubuntu 18.04 server ISO (size 800+ MB) and it took roughly one hour to complete. Once the USB bootable drive is created, unmount, plug-in again and check if you can be able to boot from that drive.
Finally, don't forget to unmount the BTFS file system using command:
$ fusermount -u mnt
Now, the contents in the mounted directory will be gone. To access the contents of the torrent file again, you need to mount the torrent as described above.