How to Install Kali Linux on External Hard Drive
How to install Kali Linux on a flash drive or external drive as a full-fledged OS
Table of contents
1. Installing Kali Linux on a memory card or external USB drive: what is different?
2. USB flash drive for Kali Linux
3. Erasing the USB memory stick to install the operating system
4. Instructions for installing Kali Linux on a USB memory stick
5. Booting Kali Linux from a USB stick
6. Backing up a flash drive with Kali Linux
Conclusion
If you would like to have a portable flash drive or external hard drive with Kali Linux, then there are at least two options:
- install the system on a flash drive, external USB disk
- create a flash drive with persistent (persistent storage)
The first option is similar to a typical operating system installation. But since we will install on a flash or external drive, we get portability – the ability to boot on any computer with a USB port. All changes made to the system are saved after reboot. In general, work is not much different from work with a regular computer.
The second option is to create a Live system on a USB drive (the same flash drive). But since the Live system is not able to save changes (user files, system settings), another section is additionally created for it, on which files and settings made are saved. So it would seem, it turns out something like in the first version – there is a system that "remembers" the changes made after restart. In fact, there are some nuances.
A persistent live system itself takes up less space – as much as a downloaded ISO image – i.e. usually up to four gigabytes. The operating system installed normally takes about 13-15 gigabytes. On the other hand, a system installed in the usual way boots faster because Live uses compression. A persistent Live system may face a problem when the new kernel (which is upgradeable) is incompatible with the old bootloader (which is part of the Live image and is not upgradeable).
In general, both methods deserve to exist, and both of them will be reviewed on the Miloserdov.org articles. This tutorial will show you how to create a flash drive with Kali Linux installed. A detailed procedure will be described to avoid some problems that may arise when installing the system on a USB drive or when booting from a USB flash drive or external drive.
Installing Kali Linux on a memory card or external USB drive: what is different?
Installing to a USB stick is similar to installing to an internal drive. But in order not to accidentally damage the main operating system, computer hard drives or the bootloader of the main system, I suggest installing Kali Linux on a USB flash drive inside a virtual computer. After completing this installation, you will be able to boot from this flash drive in your real computer. I am using VirtualBox as my virtual computer.
There are two images available on the Kali Linux download page:
- Installer – for OS installation
- Live – ISO image from which you can boot and work. You can also install from this image
In my method, I need a Live image to erase USB flash drive. But when installing from Live, there is no way to choose which components to install. In addition, the installation is done over the network. In general, we need two images at once: Installer (for installation) and Live erase the flash drive completely.
I assume that you already have VirtualBox installed, or you yourself know how to install it.
In VirtualBox, create a new virtual machine. The most common virtual computer for Linux. The only difference is that it shouldn't have a (virtual) hard drive. If you have difficulty creating a virtual machine in VirtualBox, or have difficulties with other issues related to VirtualBox, then refer to the instructions "How to install Kali Linux (step by step tutorial)", there it is detailed and illustrated with screenshots.
When, in the process of creating a new virtual computer, you reach the Hard disk window, select "Do not add a virtual hard disk":
After creating a virtual machine in its settings, check the box "Enable EFI (special OSes only)":
USB flash drive for Kali Linux
For Kali Linux, as well as any modern Linux distribution, I recommend memory cards over 16 gigabytes in size. Those. that's 32 gigabytes or more. The higher the speed, the better. Flash drives are poorly suited for multiple simultaneous read/write operations, but operating systems work in this mode. Even with a good memory card, your system will work noticeably slower than from internal or external drive, it can lag, slow down. With a bad (slow) memory card, work can become difficult, uncomfortable.
Erasing the USB memory stick to install the operating system
Before starting the installation, I recommend completely erasing the data from the flash drive (remove the GPT), because otherwise I sometimes got errors with the problem of writing to the disk.
We will do this using the Live system, booting from the downloaded ISO.
When the virtual machine is created, start it.
Now if you create a virtual machine without a disk, then it will not offer to select an ISO image to boot. Therefore, when you turn on the virtual machine, go to Menu → Devices → Optical disks and select Live image.
Reboot the virtual machine to start booting from the ISO image. Download Live system.
Plug a USB flash drive.
You can see the list of disks, but since there are no other media (hard disks) there, you will see only a flash drive named /dev/sda:
sudo fdisk -l
To remove GPT from disk, if present, run:
sudo gdisk /dev/sda
In my case, two partition tables were found at once and the system asks which one to choose – choose any (you may not have this issue).
To switch to expert mode, enter there
x
Then to remove the GPT enter
z
Agree twice to completely wipe the disk.
Now our flash drive is cleaned, without removing it, go to Menu → "Devices" → "Optical disks" and select the Installer image, reboot the virtual system.
Instructions for installing Kali Linux on a USB memory stick
There are no differences from the installation of the operating system – everything is quite standard, the choice of language, username, etc. If you have problems with this, then, again, refer to the note "How to install Kali Linux (step-by-step tutorial)".
In the software selection window for installation, you can leave it as it is, but I have a small flash drive, so I chose only to install the 10 most popular tools (unchecked the default).
When the installation is over (and this may take longer than you expected, since flash drives are not as fast as even regular hard drives, not to mention SSDs), then turn off the virtual computer. You can reboot your real computer to boot from the freshly installed USB stick.
Booting Kali Linux from a USB stick
Modern computers with SSD drives boot very fast. In addition, "quick boot" can be enabled in BIOS. In these cases, getting into the BIOS settings (or rather the UEFI settings) will fail.
To cope this situation, use the following method:
1. In Windows turned on, click the Win → Power.
2. While holding down the Shift key, click Restart.
3. Then select "Troubleshooting".
4. Then "Advanced Options".
5. Next, "UEFI Firmware Settings".
6. Click the "Restart" button.
After rebooting, you will find yourself in the BIOS settings (UEFI).
Different manufacturers have different EFI menus, so yours may be different. But I'll show you my laptop as an example, so that the essence is clear. Go to the Boot tab, select Boot Option Priorities, see what options there are:
Just one option and definitely not my flash drive.
We are looking for Secure Boot and disable it:
A new menu item OS Mode Selection appears. In it, select CMS and UEFI OS. If you select only CMS OS, then the installed Windows will not boot.
Now we are looking for such an item as Fast BIOS Mode and disable it. This is necessary so that when the BIOS boots up, it starts checking for USB devices:
It's time to save the changes and reboot:
But again we need a EFI settings! Therefore, when loading, press the corresponding key. This key can be F2, Delete, Esc or similar. The EFI itself writes this key when the computer boots. If you do not have time to look or do not understand English, then look for your model in Google. Or try brute force. In addition to these, this key can also be Esc or some kind of F1-F12.
Go to the Boot Option Priorities tab again. Now there is a flash drive. If you do as I did – put the flash drive in the first place, and Windows Boot Manager in the second, you will achieve the following effect: if the flash drive is inserted into the computer, Linux will boot from this flash drive. If there is no flash drive, then Windows will boot – and there is no need to go into BIOS again!
Do not forget to save and reboot.
Backing up a flash drive with Kali Linux
It is also recommended to make backups before installing video drivers or other similar experiments dangerous for the OS.
If we are talking about creating an OS backup, not individual files, then the best option is to clone an entire disk image. If necessary, this will allow you to very quickly return the entire operating system with all the settings. The downside of this method is that the image with the backup will take up exactly as much space as the flash drive has. Even if, for example, the operating system with all the files occupies only half of the volume of a USB drive, the image will still be the size of a flash drive. As already mentioned, the plus is that you do not need to select files for synchronization, the entire backup is stored as one file, restoration guarantees a full return to its original state.
On Linux systems, such an image can be made using dd, and on Windows there is a wonderful free, open source Win32 Disk Imager utility.
Start Win32 Disk Imager, select your flash drive as Device, and in the Image File field write the path where you want to save the image:
When you're done, click Read.
If you need to restore the operating system to a flash card, then in the same way select the image that you want to write to the flash drive and click Write.
Conclusion
This manual showed in detail how to install Kali Linux on a flash drive, describes possible problems and ways to solve them. In fact, you can install any Linux on a USB memory stick in this way. The following tutorial will show you how to create a Kali Linux USB stick with persistent storage.
After installing the OS, it is recommended to refer to the instructions "Kali Linux post-installation tips and settings".
If you need to view files located on a flash drive from the main Windows system, then refer to the instructions "How in Windows view the contents of a Linux disk and copy files from it".
How to Install Kali Linux on External Hard Drive
Source: https://miloserdov.org/?p=5271