Windows 11 and Kali Linux are two different operating systems with different characteristics and purpose. Windows 11: Windows 11 is the latest version of the operating system developed by Microsoft. It offers improved features, improved performance, improved aesthetics and a new interface design. Windows 11 has a wide range of uses, from everyday tasks to gaming and professional use. It supports many programs and applications created for Windows and provides a convenient user experience. Kali Linux: Kali Linux is a Linux operating system distribution specifically designed for penetration testing, network security, and digital intelligence tasks. It contains a wide range of tools and programs necessary for conducting penetration testing and security analysis. Kali Linux is often used by security professionals, ethical hackers, and digital intelligence professionals.
Although Windows 11 and Kali Linux are operating systems, they have different purposes and functionality. Windows 11 is aimed at a wide range of users and offers a variety of features, while Kali Linux specializes in network security and penetration testing. In this article, I will tell and show how to install two operating systems Windows 11 and Kali Linux on a flash drive. Instead of a flash drive, you can use a USB drive. To create installation media, you need: a computer with a reliable Internet connection, a USB flash drive, an external hard drive, or a DVD. You can find a bunch of ways to create a bootable flash drive online, but the methods discussed there are outdated. With the appearance of a new version of the hacker distribution, creating a bootable flash drive with saving has become much easier and faster. My plan for marking a 256 GB flash drive: 100 GB will be allocated for Windows 11. As a result, we will receive a USB flash drive for downloading, which can be inserted into the USB port of any computer and boot into either Windows 11 or Kali Linux.
In this instruction, I will show how to install two operating systems Windows 11 and Kali Linux on a flash drive. Instead of a flash drive, you can use a USB drive. As a result, we will receive a USB flash drive for downloading, which can be inserted into the USB port of any computer and boot into either Windows 11 or Kali Linux.
firstly, thanks to this approach, it is absolutely safe and we are guaranteed not to delete data from any drives on the computer;
secondly, although Windows starts from a USB drive, this OS refuses to be installed on a USB flash drive or an external drive.
All systems will be fully installed if they were installed on disks inside the computer.
As a storage device, I will use a 256 GB USB 3.2 Gen1 flash drive (model USB Flash Samsung BAR Plus [MUF-256BE3/APC] 256 GB). On the laptop, the flash drive is connected to a SuperSpeed USB 10 Gbps port (USB 3.1 is also known as USB 3.1 Gen 2). Looking ahead, operating systems in such a combination work very quickly.
My plan for marking a 256 GB flash drive:
100 GB will be allocated for Windows 11.
50 GB will be allocated for Kali Linux OS files, as well as for installing tools. The remaining space (about 100 GB) will be given to the user’s personal files (/home folder) – this partition will be encrypted.
If necessary, you can reinstall the operating systems separately.
Many experiences of installing Windows and Linux suggest that the ideal option is when the flash drive is cleaned, that is, when the partition table is deleted from it. If the flash drive is used as a bootable flash drive or Live Flash drive with ISO images, if the flash drive is used for file storage (with an MBR partition table), or if the flash drive has an operating system installed on it, you will almost certainly get an error at the disk labeling stage. Errors occur both in Windows, which, for example, is unable to create the GPT partition table it needs if there is already an MBR (for example, my flash drive comes from the factory with this partition table and the exFAT file system), and Linux, which for some reason automatically mounts all existing partitions, as a result of which the installer cannot remap the drives.
To avoid any of these errors, wipe your flash drive as shown in the article “How to restore USB drive/flash drive after burning ISO or installing OS”. After this stage, the flash drive will cease to be recognized by the system (for example, Windows will offer to format it) – this is exactly the effect we need. If it is not possible to use a flash drive, then everything will be fine for the installer.
VirtualBox can work with USB devices, including USB media. But we need to connect the USB flash drive in a special way. In fact, everything is quite simple, we need to perform 2 simple actions:
1. Create a file that will be something similar to a link to a flash drive as a device. It’s just a simple text file that is created by a command like:
2. The second action that we need to perform – when creating a virtual machine, instead of creating a new virtual disk, specify the file that we created at the first stage.
That’s all! As a result, VirtualBox will work with a flash drive not as a USB device, but as a regular medium. The most important consequence of this, why we did it: now virtual OSes will also perceive a USB flash drive as a regular SATA drive – this is necessary to trick Windows, which refuses to install on the medium, if it recognizes it as a USB flash drive or an external drive.
Bootable flash drives created with Windows and Linux can be used on real computers, i.e. boot from USB devices on laptops and desktops. But at the same time, you can also boot from the same flash drive in the VirtualBox virtual machine. We will also perform the installation in VirtualBox ourselves. For all this to work, we need to set the following settings in VirtualBox so that both systems (Windows and Linux) can work. Well, at least their installers did a great job. This is exactly what is shown below.
See also: Інструкція з VirtualBox
Start creating a new virtual machine.
Enter any name, select “Linux” as Type and “Debian (64-bit)” as Version.
Specify the amount of RAM you want to allocate to the virtual machine.
Next, select “Use existing virtual hard disk”.
Click on the “Choose a virtual hard disk image” button.
Click the “Add” button.
Locate the .vmdk file created in the previous step in the file system, in my case the file is called flash.vmdk.
Select the drive.
You will see the size of the selected disk, click the “Create” button.
Go to the virtual machine settings.
On the “System” → “Motherboard” tab, enable the “Enable EFI (custom OS only)” setting.
On the System tab → Processor, enable the Enable PAE/NX option. Optionally add CPU cores.
On the Display tab → Screen, select VboxSVGA as the graphics controller. If desired, you can add video memory.
All other settings can be left unchanged.
General rule: Windows is always installed first.
The fact is that Windows does not take into account other OSes and they will not be present in its bootloader menu.
In turn, Linux “respects” any OS it can find and adds them to its bootloader.
Therefore, we will install Linux after Windows, as a result, the Linux bootloader will be used.
You can install both Windows 10 and Windows 11 using the following method. There are no special installation requirements for Windows 10, and the Windows 11 image must have a patch that does not check for TRIM.
Start the virtual machine.
Select the Windows installation file.
Restart the machine using the menu “Machine” → “Restart”.
After turning on the virtual machine, press any button to start booting from disk.
Next, a typical Windows installation begins.
На етапі розмітки дисків виберіть диск, куди ви хочете встановити Windows, і натисніть кнопку ” Створити “.
Enter the size in Megabytes that you want to allocate under Windows and click the Apply button.
The installer warns that it will create additional partitions necessary for the normal operation of Windows.
When the partitions are created, click the “Next” button.
Wait for the installation to complete.
Next, the system will offer to add keyboard layouts – we will not stop at trivial settings.
Come up with a computer name.
Select “Customize for personal use” and click “Next”.
To use an offline account instead of creating a Microsoft account, scroll down and click Sign-in options at the step shown in the screenshot.
Find and select “Offline Account”.
You will be persuaded, but click « Skip for now».
Come up with and enter a username.
Come up with, remember and enter a password. If you want to log in to the computer without a password, leave this field blank.
Take your time to click Accept at this point.
Go through the list carefully – you may want to disable some options.
After the installation is finished, the system will boot, but the screen will be small in the virtual machine.
If you plan to use this flash drive only on a real computer and you don’t need to boot into a virtual machine, just go ahead and install Kali Linux. If you plan to use USB media to boot on real and virtual computers, then install the VirtualBox guest additions.
After that, the screen will be large even when booting into VirtualBox.
Hibernation should be disabled. The essence of deep sleep is that a permanent copy of RAM is stored on disk – in our case, on a flash card. The speed of a flash card slows down significantly if you read and write data in multiple threads (you will notice this when installing Windows updates). Due to the constant load on the disk, the system starts to work more slowly, especially if you perform other operations of reading and writing to the flash drive. Also, the hiberfil.sys file (where the copy of RAM is stored) is very large (to hold all of the RAM). This leads to unnecessary overuse of valuable disk space.
To disable hibernation and remove the hiberfil.sys file, open a command prompt (Win+x → Windows Terminal (Admin)) and type:
For more detailed information, as well as instructions in case you want to enable hibernation, see the articleі « Що таке hiberfil.sys і як його видалити? ».
You will notice that after disabling hibernation and deleting the hiberfil.sys file, the system has become much more responsive and fast.
If you encounter an error while booting Windows
then watch цю статтю .
Insert the Kali Linux installation image into the virtual CD-ROM.
If you are unable to boot from the Kali Linux installation ISO while booting the virtual machine, hold down the SHIFT key while powering on or restarting the machine.
Select Use Device.
In the boot menu, select “Graphical install”:
Select the desired operating system language. In this guide, I’ll skip the typical installation steps and focus only on mapping the drives. Let me remind you that according to my plan, 50 gigabytes will be allocated for the files of the Kali Linux OS, as well as for the installation of tools. The remaining space (about 100 GB) will be given to the user’s personal files (/home folder) – this partition will be encrypted.
When you get to the drive layout, select Manual.
root partition (/)
the user’s home folder( /home )
The EFI partition is already created by Windows, Kali Linux can use this partition to install the required bootloader.
NOTE. When working with a flash drive with two operating systems, the following was noticed: immediately after installation, after use, Windows creates an additional part of the Windows recovery environment. The size of this partition in my case is 616 megabytes. The location for this partition comes from the partition used to install Windows. This section is created at the bottom of Microsoft Basics and its presence does not seem to affect anything. But actually, after creating the Windows recovery environment, the partition next to which Kali Linux was installed got corrupted. That is, after automatically creating this partition, Windows works as it should and Kali Linux no longer boots. To prevent corruption of the Kali Linux partition, you must leave free space between the Windows and Linux partitions.
We select an unoccupied area (“FREE PLACE”).
We create a new section.
Now we create a “buffer” between the Windows and Linux partitions, it is necessary so that the Linux partition is not damaged during the creation of the Windows recovery environment. I chose a size of 1 GB, but a small size like 100 MB should be enough.
Addendum: in the next installation, I actually created a 100 megabyte partition – everything works fine, the Kali Linux disk does not get corrupted.
In the “Use as” field, select “don’t use”. Then click « Partition Setup Done ».
We select an unoccupied area (“FREE PLACE”).
We create a new section.
Select the partition size. This partition will be root, OS files will be installed on it and programs will be installed here. It is not recommended to make this partition smaller than 20 GB.
In the Use as field, select Journalable Ext4 file system. Select “/” as the mount point. Then click « Partition Setup Done ».
Now let’s move on to creating an encrypted partition. Select “Configure encryption for volumes”.
We are warned that the current partition scheme (those two partitions we just created) must be written to the disk to begin creating the encrypted one – these changes cannot be undone. Select Yes.
We create an encrypted volume.
We choose where exactly this section will be placed. Be especially careful if you have multiple drives. In the screenshot, the free space of a single disk is selected.
Select “Partition setup is complete”.
Again, you should save the current partition scheme to disk. Select Yes.
I only need one section, so I choose Finish.
We are warned that the selected partition will be overwritten with random data and the information from it will be lost. If so, select Yes. If the partition is large, this process will take a long time.
Enter the password to decrypt the partition.
So far, we’ve just created an encrypted partition that has no volumes or mount points. All this is configured in LVM.
Go to “Configuring Logical Volume Manager (LVM)”.
Need to write current partition scheme again, yes again.
In this step, we create a volume group.
Come up with a name, for example, after the name of the car.
Select a device for the new volume group. This device is the encrypted partition created in the previous step.
Now we create a logical volume.
Choose a group – there is only one.
Name it – the name can be arbitrary, but it is in your best interest to make it a speaker.
Specify the size of the volume.
One volume is enough for me, so I choose “Finish”.
Now you can observe the created volume, but it is not used in any way and no file system is selected for it. Click on the volume record.
In the Use as field, select Journalable Ext4 file system.
Select “/home” as “Mount Point”. Then click « Partition Setup Done ».
We complete the partitioning of the disk, select “Finish marking and save changes to the disk” → “Continue”.
I’m warned that I haven’t created a swap file – I have 32GB of RAM, I don’t need a swap file, so I choose No.
We are warned once again that the data will be written to the disk and the information on it will be lost, select “Yes”.
The subsequent installation steps are the same as for a typical installation.
UEFI usually automatically detects operating system bootloaders on media connected to a computer. But sometimes UEFI does not show all available options. Let’s consider how to add a new option in the UEFI boot menu.
For example, I connected a flash drive with two operating systems – Windows 11 and Kali Linux – to the computer, pressed ESC during boot to select boot options.
Linux OS on internal disk
Windows OS on a flash drive
If you choose the first option, it will boot from the internal drive, if you choose the second option, then Windows will boot. There is no option to download Kali Linux from a flash drive.
Go to UEFI settings.
Let’s go to the advanced UEFI settings, on my laptop it’s the F7 key.
Go to the “Boot” tab.
As you can see, two download options are selected and additional ones can be added – both from the list and new ones not in the list.
Among the options available in the list of options, there is no Kali Linux from a flash drive.
Select “Add New Boot Option”.
In the Path for boot option field, you must specify the path to the file /EFI/kali/grubx64.efi.
Select a USB flash drive (there is a line “USB” on the way).
Select the “EFI” folder.
Select the “kali” folder.
Select the file” grubx64.efi “.
In the “Add boot option” field, enter a name for this boot option and click the “Create” button.
New download option successfully created.
Add this option to the download menu.
Save the settings and restart the computer.
The option to download Kali from a flash drive is now available.
The Linux bootloader knows about the existence of Windows 11 installed and adds the option to boot it to the menu.
When Windows Boot Manager is selected, Windows 11 is loaded from a USB flash drive.
If you choose to download Kali Linux, you will need to enter the password for the encrypted partition where the /home folder is located.
Then work from the USB flash drive in Kali Linux continues as usual.
UEFI varies from manufacturer to manufacturer: some have many settings, some have few. It is possible that UEFI does not see the Linux bootloader and does not have a setting to add a new bootloader.
And here you can use another approach. The gist of the method is that any UEFI by default tries to boot a bootloader that has the path /EFI/BOOT/BOOTX64.EFI. This is the so-called fallback (can be translated as backup, resistant to failure) path to the bootloader. Therefore, it is enough to rename the existing path to a fault-tolerant one for UEFI to start loading it.
For example, Kali Linux bootloader path /EFI/kali/grubx64.efi. In this case, you need to rename the folder “kali” to “BOOT” and the file “grubx64.efi” to “BOOTX64.EFI”. These files are located on a hidden partition with a FAT32 file system.
To change Linux, mount this drive with read/write permissions and rename the directory and file.
Let’s look at the names of disks and partitions:
The EFI System partition on which we want to make changes is called /dev/sdb1, mount it:
Now rename the folder and file sequentially.
Once done, unmount the /dev/sdb1 partition:
Open the Windows command prompt with administrator tasks. To do this, press Win+x and select “Windows Terminal (Admin)”.
In the command line, run the program and wait for it to open:
In the DISKPART prompt, type:
We need to find out what the boot disk number is. In my case it is 0.
Now type the following command, replacing the 0 with the number of the boot disk:
Now we will display the list of volumes with the following command:
This is a very important step! We need to find out what number the EFI partition has. In the EFI partition, the file system is FAT32 and this partition has no letter.
In my screenshot, the EFI volume is numbered 2.
Run the following command replacing 2 with your partition number:
Now you need to assign a letter to this section. It can be any unoccupied letter.
Close the command prompt.
Administrator rights are required to edit folder and file names on the drive. To do this, for example, I run Double Commander with administrator rights.
See also: a free Total Commander analogue
After that, you can edit the EFI partition like normal folders and files.