AIO Create any Windows/Linux Bootable USB Drive
Posted: 13 Sep 2021, 12:30
This is a rewrite of my previous tutorial; greatly simplified, streamlined and expanded.
Some of you are trying to install linux to usb drive and may get an error on etcher.
Others are trying to install Porteus or Tails to a non-usb hard drive.
Some of you might be trying to get a Windows 10 / Linux bootable USB drive from installed Linux or from Live Linux.
In this tutorial I will show you a bullet proof way to get it working.
You will find no better guide on the internet, but attention to detail is important.
So you've downloaded the iso you need.
Typically you will then create a bootable usb drive (stick or hard drive...flash cards don't work for this purpose).
However, what if you wanted to "install" Tails?
Then you could use the internal hard drive; this only becomes problematic with multi boot.
This tutorial won't cover multiboot, but I'm sure some one would appreciate such a follow up i.e., install Windows and then Tails to hard drive.
So decide which device you would like to use for bootable medium and know that all information on it will be destroyed.
Preamble: EFI requires MSDOS partition table (not GPT) and FAT32 File System, macs also require this.
Clear your USB stick with Gparted
1. Select your USB stick from available drives
2. Right click on the partition bar, and select either format to → Cleared, or simply delete the partition.
3. Click on the checkmark to apply.
Prepare your USB stick with Gparted
1. Under Device Menu, select create partition table, choose MS-DOS.
2. Right click on partition bar and select format to FAT32; use defaults.
3. Click on the checkmark to apply.
4. Right click on partition bar and select manage flags, select BOOT and select close.
5. Pay attention to your usb device name; namely is it: sda, sdb, sdc?
Your USB Stick is ready, now Open a Terminal and execute these commands:
1. sudo mount -o loop /path/to/distro.iso /mnt
2. cd /media
3. sudo mkdir drive
4. sudo mount /dev/sdc1 /media/drive/
(add the number 1 to your device name, this selects primary parition)
5. time sudo rsync -rltD /mnt/ /media/drive
Your done.
Remember Windows 8 and beyond uses secure boot by default.
Remember Linux does not use secure boot by default.
Remember you can Boot UEFI without secure boot, but some linux distros absolutely require legacy boot.
Special Instructions for Tails:
1. Enable Legacy Boot in Bios
2. Enable Virtualization in Bios
3. When you get to the Tails boot menu press e or tab to edit and remove "live-media=removable" from the boot sequence, and press F10 to continue.
If the image extension is "img" or if you otherwise get this error:
wrong fs type, bad option, bad superblock on /dev/loop0, missing codepage or helper program, or other error.
Then you are going to multiply the sector size by the start sector (i.e., sector size is 512, sector start is 2048) = 1048576
To view this information for your image you need to use this command:
sudo fdisk -l -u=sectors /home/username/Downloads/tails-amd64-4.13.iso
sudo mount -o loop,offset=1048576 /home/username/Downloads/tails-amd64-4.13.img /media/iso
Cleanup up Post USB Creation
df -h (locate greatest loop)
sudo umount /dev/loop1
sudo umount /media/drive/
Wim Greater than 4GB considerations
Download wimlib 1.13.4 and extract. CD to extracted folder from terminal.
sudo apt install libxml2-dev libfuse-dev pkg-config
./configure --without-ntfs-3g && make && sudo make install
sudo ldconfig -v
sudo wimsplit /mnt/sources/install.wim /home/demo/install.wim 3999
Now you may require 2 clone USB drives (cloned in content except one has wim 1, the other wim 2)
That way when windows asks for disc 2, you can insert the usb drive with wim 2.
Some of you are trying to install linux to usb drive and may get an error on etcher.
Others are trying to install Porteus or Tails to a non-usb hard drive.
Some of you might be trying to get a Windows 10 / Linux bootable USB drive from installed Linux or from Live Linux.
In this tutorial I will show you a bullet proof way to get it working.
You will find no better guide on the internet, but attention to detail is important.
So you've downloaded the iso you need.
Typically you will then create a bootable usb drive (stick or hard drive...flash cards don't work for this purpose).
However, what if you wanted to "install" Tails?
Then you could use the internal hard drive; this only becomes problematic with multi boot.
This tutorial won't cover multiboot, but I'm sure some one would appreciate such a follow up i.e., install Windows and then Tails to hard drive.
So decide which device you would like to use for bootable medium and know that all information on it will be destroyed.
Preamble: EFI requires MSDOS partition table (not GPT) and FAT32 File System, macs also require this.
Clear your USB stick with Gparted
1. Select your USB stick from available drives
2. Right click on the partition bar, and select either format to → Cleared, or simply delete the partition.
3. Click on the checkmark to apply.
Prepare your USB stick with Gparted
1. Under Device Menu, select create partition table, choose MS-DOS.
2. Right click on partition bar and select format to FAT32; use defaults.
3. Click on the checkmark to apply.
4. Right click on partition bar and select manage flags, select BOOT and select close.
5. Pay attention to your usb device name; namely is it: sda, sdb, sdc?
Your USB Stick is ready, now Open a Terminal and execute these commands:
1. sudo mount -o loop /path/to/distro.iso /mnt
2. cd /media
3. sudo mkdir drive
4. sudo mount /dev/sdc1 /media/drive/
(add the number 1 to your device name, this selects primary parition)
5. time sudo rsync -rltD /mnt/ /media/drive
Your done.
Remember Windows 8 and beyond uses secure boot by default.
Remember Linux does not use secure boot by default.
Remember you can Boot UEFI without secure boot, but some linux distros absolutely require legacy boot.
Special Instructions for Tails:
1. Enable Legacy Boot in Bios
2. Enable Virtualization in Bios
3. When you get to the Tails boot menu press e or tab to edit and remove "live-media=removable" from the boot sequence, and press F10 to continue.
If the image extension is "img" or if you otherwise get this error:
wrong fs type, bad option, bad superblock on /dev/loop0, missing codepage or helper program, or other error.
Then you are going to multiply the sector size by the start sector (i.e., sector size is 512, sector start is 2048) = 1048576
To view this information for your image you need to use this command:
sudo fdisk -l -u=sectors /home/username/Downloads/tails-amd64-4.13.iso
sudo mount -o loop,offset=1048576 /home/username/Downloads/tails-amd64-4.13.img /media/iso
Cleanup up Post USB Creation
df -h (locate greatest loop)
sudo umount /dev/loop1
sudo umount /media/drive/
Wim Greater than 4GB considerations
Download wimlib 1.13.4 and extract. CD to extracted folder from terminal.
sudo apt install libxml2-dev libfuse-dev pkg-config
./configure --without-ntfs-3g && make && sudo make install
sudo ldconfig -v
sudo wimsplit /mnt/sources/install.wim /home/demo/install.wim 3999
Now you may require 2 clone USB drives (cloned in content except one has wim 1, the other wim 2)
That way when windows asks for disc 2, you can insert the usb drive with wim 2.