How to install Windows on a USB storage
Windows on USB HDD
In this manual, I will show a trick with which you can get a portable Windows on an external USB drive.
This drive is not tied to a computer and should boot on any other laptop or desktop PC. The main thing that it should be not quite an old machine (EFI support is needed - this is the firmware, which now (the last 7+ years already) is replacing the BIOS). In general, in most cases should work.
On a USB drive we will install Windows 10.
If you are not sure to choose a USB flash drive or an external USB HDD/SSD drive, then I recommend an HDD/SSD drive. In my opinion, the speed of the flash drive is not enough, although I did not check it - I simply do not have a flash drive of sufficient size. An HDD is suitable, although it would be better with an SSD. USB 2.0 will do, although USB 3.0 is also better. In this manual I use HDD from an old laptop placed in a SATA-USB 2.0 adapter. The system boots more slowly than with an SSD inside a computer, but the speed of the disk almost does not affect the subsequent work - everything is quite comfortable, just like on a regular computer with an HDD.
If you try to install Windows on USB, the system will inform you that USB drives are not supported. At the same time, there are no obstacles for booting an already installed system from a USB disk. Therefore, we will use one interesting loophole. In VirtualBox, a USB flash drive or USB drive can be connected in such a way that for a virtual computer it would seem like a regular SATA drive. In this state, we will install Windows 10. And then it will be possible to boot from this USB disk as from the most ordinary disk on a real (physical) computer.
So, we will do the installation in VirtualBox and this gives another advantage: we can’t do any harm to the host system (your real computer). That is, we cannot wipe disks accidentally during installation and do not break things in another way. By the way, if you use a regular SATA disk via a USB adapter, then this disk can be removed from the USB adapter and connected to the desktop computer as a usual system disk. That is, we install it in a virtual machine - we use it everywhere.
I will show how to install Windows 10 on a USB drive from Windows and Linux. The principle is the same in both these operating systems, but the commands differ slightly due to the specifics of the OSes. Yes, we will need the command line, since the VirtualBox feature we will use is advanced and its mention in the graphical interface is completely absent.
Installing Windows 10 on a USB drive from Windows
We need to find out the system number of the USB drive on which we will do the installation.
Connect the USB flash drive or HDD/SSD drive to the computer. Then use shortcut Win+r and run diskmgmt.msc.
Find your flash drive and remember the disk number:
For example, in my screenshot the flash drive has the number 1.
Close all VirtualBox windows if they are open.
Next, we need to open the command prompt as an administrator. To do this, click Win+x and select ‘Windows PowerShell (administrator)’.
In the window that opens, enter:
Now go to the folder where you installed VirtualBox. If this program is installed in the default directory, then the command is:
If you chose a different location for VirtualBox, edit the previous command accordingly.
Now in the command line, insert the following command, in which replace # with the number of the disk we looked at just above, then press Enter:
VBoxManage internalcommands createrawvmdk -filename C:\usb.vmdk -rawdisk \\.\PhysicalDrive#
For example, I have a disk 1, then the command looks like this:
VBoxManage internalcommands createrawvmdk -filename C:\usb.vmdk -rawdisk \\.\PhysicalDrive1
If everything went well, the message should appear:
RAW host disk access VMDK file C:\usb.vmdk created successfully.
Please note that you can replace C:\usb.vmdk with any file location you wish.
This command creates a virtual machine disk (VMDK) file pointing to the physical disk that you selected. When you connect a VMDK file as a disk in VirtualBox, VirtualBox will actually have access to the physical disk (USB memory card or USB HDD).
Now open VirtualBox as administrator - this is necessary, otherwise it will not work as it should. To do this, click the Start button, type VirtualBox and select ‘Run as administrator’:
VirtualBox can access raw disk devices only with administrator privileges.
Now in VirtualBox, create a new virtual machine, select the appropriate operating system and when it comes to choosing a hard disk, instead of creating a new one, select Use an existing virtual hard disk:
Now open the C:\usb.vmdk file (or another, if you saved it in a different place or under a different name):
After creating a virtual machine, if you want to install Windows 10, open its Settings, go to the System → Motherboard tab and tick Enable EFI (special OSes only):
Start your virtual machine, select the bootable ISO image with the Windows 10 system and start the normal installation.
Now I will show you how to do the same actions in Linux, and then we will return to installing and running a portable USB disk with Windows on a real computer. If you are not using Linux, just skip the next section.
Installing Windows 10 on a USB disk from Linux
To understand the principle, read the previous section about Windows. In Linux, to find out the name of the USB drive, run the command:
sudo fdisk -l
In my case, the disk has the name /dev/sdb.
To create a virtual disk file that points to a real disk, run a command like this:
sudo VBoxManage internalcommands createrawvmdk -filename /root/usb.vmdk -rawdisk /dev/sd#
Where instead of # enter the letter of the corresponding disk. An example for my conditions:
sudo VBoxManage internalcommands createrawvmdk -filename /root/usb.vmdk -rawdisk /dev/sdb
In this command, you can replace /root/usb.vmdk with a different location up to you.
To run VirtualBox with administrator rights, run the following command:
All the rest is creating a virtual machine and choosing an existing virtual disk as a hard disk - just like in Windows.
Installing Windows 10 on a USB drive
I found an external HDD USB drive and will do the installation on it (and not on the USB flash drive, which is in the screenshots).
When starting the virtual machine, select the installation ISO image of Windows.
At the very beginning, press any button to boot from CD/DVD.
Next comes the usual installation process.
When you come to the choice of type of installation, click on ‘Custom’:
The next step is disk partitioning. You may have a blank disk or, like me, it may already have something installed:
For example, I have a test system there that I don’t need. Then I delete all sections. It turned out like this:
You can, at your request, somehow mark the disk in a special way. If you want to leave the entire disk under the Windows operating system, then simply click the Next button and the system will create 4 or 5 partitions for it during the installation.
Then again, as with the most usual installation, wait for the files to be copied and perform the initial setup.
As with the installation on a regular computer, the system will reboot several times - no action is required from you. Installation is complete (the system is not full screen, as it is running in VirtualBox, and I did not install the VirtualBox guest additions):
Run Windows 10 from a USB drive
Check in the EFI (BIOS) settings that the Security Boot and Fast Boot are disabled. Then select USB drive as the first download source. Or at the very beginning of the boot you can hold down the ESC key (on your motherboard model there may be another key, for example, Delete or some of the function keys, for example, F12, F9, etc.).
Wait for the download options to appear. As I said, my disk is connected via a SATA-USB adapter, the system sees it as a Mass Storage Device):
Windows booted from the usual disk:
You can enlarge the photo and see that the system sees only its own disk on which it is installed. This is an external USB drive at about 750 gigabytes. The system does not see other disks of the laptop, since they have the ext4 and ext2 file systems.
The first download may take longer than usual, on the screen may appear the words “Devices are being prepared” - the system saw new devices and is configured to work with them. You may need to install the necessary drivers - everything is like on a regular Windows computer.
Why Windows does not boot from USB
In Windows, there are no artificial restrictions on booting from USB (although there are restrictions on installation). Therefore, if the system does not boot, then it is most likely due to the features of your BIOS or its settings. For example, it may be that your computer does not have EFI support, or the Security Boot and Fast Boot are enabled.
Also try using other USB sockets. Strictly avoid USB hubs!
How to boot from USB to VirtualBox
We prepared our portable USB disk with Windows for booting on the physical computer, the laptop. But nothing prevents us from booting from it in VirtualBox. If you have already taken steps to connect USB to VirtualBox as a normal disk and created a virtual machine with the appropriate settings, then simply remove the installation disk and your system will boot from USB!
A situation may arise when the computer is out of order, but you need files or a configured operating system from the HDD disk, then you can place the disk in the SATA-USB adapter and boot into VirtualBox on another computer. In this case, the intervention in the host system is minimal: you do not need to disassemble the computer to connect the disk, you do not need to change the BIOS/EFI settings, you do not even need to restart it. Simply plug in your USB drive and boot from it to VirtualBox.
Please note that the USB device must be the first hard disk in your VirtualBox virtual machine, otherwise the download will not occur. If you connect a new USB drive to an existing machine, then try changing the order of the media in the settings of this machine, or select the appropriate drive at the beginning of the download.
Buy SATA-USB adapter online
If you like this guide and you need an external USB drive, an external USB SSD drive, a SATA-USB adapter or a USB flash drive with a very large amount of memory and at the same time you love online shopping, then look at the links below, you might find something appropriate:
- External USB drive
- External USB SSD
- SATA-USB Adapter Case
- 64 GB USB memory stick
- 128 GB USB memory card
- 256 GB USB memory stick
By the way, in the next guide we will install Linux on a USB flash drive or USB HDD drive. There are pitfalls, so do not miss!
- How to install web server on Windows 10 (Apache 2.4, PHP 7, MySQL 8.0 and phpMyAdmin) (54.3%)
- How to install WordPress on Windows (54.3%)
- How to install NetBeans 9 for JDK 9 development (54.3%)
- How to Install Total Commander Counterpart in Kali Linux (54.3%)
- How to install Router Scan (54.3%)
- How to install Guake in Kali Linux (RANDOM - 50%)