Full Windows on USB Drive

While I am primarily a Linux user these days, I do need Windows occasionally. And on my Framework laptop, I find using Storage Expansion Card (essentially an USB drive) a perfect medium for it. I already wrote about Windows To-Go installation. But what if I wanted something more substantial? A full installation maybe?

Well, we can do that with the help of a few manual commands.

To start, we boot Windows 11 (or 10) off the USB as we normally would. However, instead of proceeding with the normal install, we press Shift+F10 to get into the command prompt.

First, we start with partitioning using the diskpart utility. I opted for a bit simpler partition setup than what Windows would generate normally. Most notably, there is no recovery partition. If you want one, you can just follow Microsoft's instructions once system is up and running.

Within diskpart, the first task is to select the disk. Make sure it is the USB disk on which you want to install Windows. Failure to do so will surely damage something. Once the disk is cleaned, we follow with the creation of a few basic partitions before exiting the tool back to the command prompt.

LIST DISK
SELECT DISK <NUM>

CLEAN
CONVERT GPT

CREATE PARTITION EFI SIZE=100
FORMAT QUICK FS=fat32
ASSIGN LETTER S

CREATE PARTITION MSR SIZE=128

CREATE PARTITION PRIMARY
FORMAT QUICK FS=ntfs
ASSIGN LETTER W

LIST VOLUME
EXIT

Now we can install Windows using a combo of dism (to copy the Windows image) and bcdboot (to sort out EFI boot). Please note that if you already have Windows installed, the source files will most probably be on drive D: instead of C:. Depending on how the bootable USB was created, you might also need to change install.wim to install.esd. If the installation contains multiple editions, you can select which one you want using the /Index:N parameter.

DISM /Get-WimInfo /WimFile:C:\Sources\install.wim
DISM /Apply-Image /ImageFile:C:\sources\install.wim /Index:1 /ApplyDir:W:\
BCDBOOT W:\Windows /s S: /f UEFI

Once both commands are done, exit the installation process and reboot into our new installation. If it's not a default boot location, make sure to press F12 to select it.

And that's it - now you have Windows on a completely separate drive without any intermingling with the Linux installation.

Leave a Reply

Your email address will not be published. Required fields are marked *