[Guide] Updating ssd firmware using windows .vhd + ventoy

I finally went through the hassle of getting my WD drivers updated. The basic idea is I have a USB stick and want to get a working copy of windows on it just long enough to run the firmware update. Windows doesn’t like to install to USB’s, so we install to a VM first, and then boot straight off the vm disk image.

Here’s how I did it:

Prerequisites

Set up Ventoy

Warning: This erases your entire USB disk
Warning: If you choose the wrong disk you’ll erase things you don’t intend to erase
Plug in your USB stick and figure out what the device name is. You can use your OS’s partition manager GUI, or look at the output of lsblk. My USB is at /dev/sda but it’ll depend on your OS.

Then, we need to install Ventoy and leave enough room for the VM. Normally, Ventoy makes two partitions - an exfat partition where you can put your ISO images, and a second partition where it installs the boot magic. For this to work, we need a third partition that’s NTFS formatted for the image to boot from.

The command to run is
sudo ventoy -I /dev/YOUR_PATH_HERE -r NUMBER_OF_MB_FOR_VM

For example, on my machine, I ran:
sudo ventoy -I /dev/sda -r 50000
Which installed ventoy with 3 partitions: The normal ventoy partition, the hidden 30mb ventoy partition, and 50gb of unallocated space at the end.

You can pick whatever number you want but it needs to be bigger than the max size of the .vhd you create for Windows. By max size I mean that the .vhd dynamically grows, but even if it’s say 10Gb but you created it with a max size of 40gb, then this partition has to be > 50gb. Otherwise windows won’t boot.

There’s an optional step below to reduce the install size so this will fit on a smaller footprint (< 30 gb). If you don’t want to worry about it, just make it 40gb and it’ll work without any issues.

Now, you need to allocate the 50gb partition to be NTFS formatted. I suggest doing this in your distro’s partition manager gui otherwise search around for the CLI commands.

I’ve labeled this partition as VentoyWin, and will reference it as such in the rest of the tutorial.

Now we need to mount the Ventoy partition and the VentoyWin partitions in our newly initialized USB drive. Refer to your distro for how to do this, or you can use sudo mount to do so manually.

Then, create a new folder called ventoy
Unzip the ventoy_vhdboot.zip file you downloaded, and locate the .img file (ventoy_vhtboot.img)
Copy the ventoy_vhdboot.img into this folder.
Make a new text file named ventoy_grub.cfg and also place it in the ventoy folder, with these contents:

menuentry "Boot My Windows VHD" {    
    set my_vhd_path="/windows10.vhdx"
    
    if search -n -s vdiskhd -f "$my_vhd_path"; then
        vhdboot_common_func "($vdiskhd)$my_vhd_path"
    else
        echo "$my_vhd_path not found"
    fi
}

For example, if your USB drive is mounted to /mnt/usb/Ventoy, then you should now have the two following files:
/mnt/usb/Ventoy/ventoy/ventoy_vhdboot.img and /mnt/usb/Ventoy/ventoy/ventoy_grub.cfg

Finally, copy over the intel wifi drivers, and the wd dashboard.exe to the VentoyWin partition. That way you can use them later.

Create a windows vm

First, create the disk. This file eventually needs to live at /mnt/usb/VentoyWin/windows10.vhdx (or wherever you’re going to mount that ntfs partition)
I suggest keeping the im
You can put it there now, or keep it on your local FS and then copy it later to make things install a bit faster.

Either way, the command is this: qemu-img create -f vhdx YOUR_FILENAME_HERE 40G
For example: qemu-img create -f vhdx windows10.vhdx 40G

Now, we can launch Windows using the VM we downloaded earlier. The command to use is:
qemu-system-x86_64 -cdrom PATH_TO_YOUR_windows10.iso -boot order=d -drive file=PATH_TO_YOUR_windows10.vhdx,format=vhdx -m 2G -smp 8 -cpu host,hv_relaxed,hv_spinlocks=0x1fff,hv_vapic,hv_time -enable-kvm -nic none

The arguments come from here, and here

Now we can go through the install phase.
First it will ask for a product key. Click the “I don’t have a product key”
(Tip using the keyboard for these steps (tab/space/enter) is much faster)

Then, choose Windows 10 Pro. The reason is we’re going to use group policy to nuke windows updates so we don’t pull in unwanted drivers later. Accept the license, then click “Custom: Install Windows only”. You don’t need to manually partition the 40g drive, just hit next.

Now it’ll take some time, and then reboot into OOBE.

For OOBE, it’s gotten more annoying since the last time I used windows. Now it won’t let you make a local account, unless there’s no internet access. This is why we’re running with -nic none

When it says let’s connect you to a network, choose “I don’t have internet” at the bottom. Then it tries to whine more, so you have to click “Continue with limited setup” at the bottom left again.

Continue and set your username/password. There’s no complexity requirements so my password is wd for everything including the security questions.

Now go and uncheck every privacy-stealing-by-default checkbox. No we don’t want cortana…

And now we’ve created the VM!

Optional: Disabling windows updates

You don’t have to do this of course, but tl;dr: adding the fingerprint driver to windows messes up things nice and solidly for our linux installs so I’d just rather be safe and have windows never try to update.
Follow these instructions to use group policy to disable driver updates:

Windows Central – 30 Aug 18

Automatic driver updates can cause problems — here’s how to turn them off

In this guide, we’ll show you the steps to disable updates for drivers through Windows Update using Group Policy and Registry.

and I’ve found in the past that sometimes even that isn’t enough. So later, we’ll set our wifi connection to be metered to stop any downloading as well

Optional: Reduce the size of the image

(From @Fadalf)
If your USB disk is < 40 gb, or you just want to save as much space as possible, here’s how you can shrink your VM size down:

  • Remove Windows recovery partition with diskpart (link)
    **diskpart** > **list disk** > **select disk #** > **list partition** > **select partition #** > **delete partition override**
  • Resize Windows partition to < 25GB using disk manager
  • Now, turn off your VM and do these remaining steps in your linux environment
  • Convert the VM to raw :
    qemu-img convert -O raw windows10.vhdx raw_win10.raw
  • Shrink the VM to 25 GB :
    qemu-img resize --shrinked raw_win10.raw 25G
  • Convert it back to vhd(x) :
    qemu-img convert -f raw raw_win10.raw -O vhdx windows10.vhdx

Time to boot off the USB

Copy your windows10.vhdx into the root of your VentoyWin partition. (It needs to be named windows10.vhdx to match the boot entry you made in ventoy_grub.cfg earlier).

Now, we’re almost all ready to go. Make sure you’ve copied over the intel drivers and the Dashboard.

Now, turn off your computer. If you’ve enabled secure boot, you’ll need to go to your settings (f10) and turn it off temporarily. Otherwise, hit f12 and boot from the usb.

It should pop open the ventoy screen. Now you need to hit f6 to load the additional menu. Now, you should see “Boot my Windows VHD” from the grub config earlier. Select it and boot.

If it works, you can install the wifi drivers and the WD dashboard program. Connect to the internet, hit that sweet update firmware button. Then, when finished, just reboot back into linux and re-enable secure boot.

7 Likes

Excellent guide! Far better than my off-the-cuff cobbled together guide.

You’re using Manjaro, correct?

1 Like

@Fraoch: Ah nice!! Yeah it’s basically the same idea. Hopefully without nuking fingerprints and such. I’m using manjaro but the nice thing is that most of the steps should be fairly distro-independent

2 Likes

Argh, all my USB sticks are 32GB max, guess I’ll just install the damn thing and nuke it right after.

1 Like

@Jason_Hottelet I’ve successfully installed Windows 10 on a 32GB USB.

Just follow the steps of the main post only installing the VM on your main drive first and then :

  • In the VM : Remove Windows recovery partition with diskpart (link)
    **diskpart** > **list disk** > **select disk #** > **list partition** > **select partition #** > **delete partition override**
  • In the VM : Resize Windows partition to < 25GB using disk manager
  • Convert the VM to raw :
    qemu-img convert -O raw win10.vhdx raw_win10.raw
  • Shrink the VM to 25 GB :
    qemu-img resize --shrinked raw_win10.raw 25G
  • Convert it back to vhd(x) :
    qemu-img convert -f raw raw_win10.raw -O vhdx win10.vhdx

Then just move the VM to the Ventoy Windows partition as explained by Anil_Kulkarni. I hope this will help.

If you do not have a VM yet I suppose juste changing the initial size should work too :

qemu-img create -f vhdx win10.vhdx 25G
4 Likes

Thanks for your help! I’m kind of in the middle of installing it because I am just now reading this, but it might help someone more patient than me!

1 Like

@BeeAPeach : After the bulk edits to this topic I can no longer edit the original post - I get 403’s trying to save the edit. Can you fix the permissions

1 Like

thank you for your great tutorial. I just have one question.
what are the benefits of this tutorial compared to guides like this: How to Run Windows From a USB Drive | PCMag
when i understand it correctly i should also be able to install the SSD firmware and bios update with this method?
the only downside i can see is that i need an activition key. i have a windows 10 education key, i think that should work?
(and of course i would need a windows computer for this tutorial, but i also have that)

1 Like

It was my impression from reading elsewhere on the forum that you could use Hiren’s BootCD PE via ventoy or the like for installing the updated firmware.

Don’t suppose anybody could confirm/refute? (I do not own the WD NVMe SSD in question)

Both methods work, so it’s kind of a “pick the usecase that suits you”

Some benefits of this guide:

  • Win10 is just another image for ventoy, so you can use the same solution to boot your linux live ISO’s
  • It’s an image file, so you can save the .vhdx, restore back to it, manage it without booting into windows etc.

Some downsides:

  • It’s in this liminal space where it’s kinda a VM, but kinda not because you can boot to it.
  • It’s definitely not a “supported” workflow from Windows (although now that Windows has removed USB-to-go…)

My 2 cents: If you actually want to use windows somewhat regularly, I wouldn’t use either guide. Instead, I would properly dual-boot it from the main SSD (there are many guides around there for dual booting Windows/Linux)

If you just need to limp along into Windows long enough to update the firmware, then my 2 cents are it doesn’t really matter as long as it gets the job done

2 Likes

I created a Windows 10 USB portable boot stick. I have the Intel WIFI drivers installed, but cannot get the Western Digital Dashboard to work. It installs, but when I go to open it the screen loads, freezes then crashes.

Any ideas?

That happens very often to me. Just keep rebooting and trying. It loads and works properly about once out of every 4 tries.