Running a Windows virtual machine on Linux using an Existing Windows Installation

I’ve been a Linux user for years. At home I’ve kept a file server which runs off Linux, but that was “classic Linux” — without a graphical user interface, using the command line, and doing things the “hard way”. My main desktop PC was still running Windows, and had to because the one game I play regularly, Fortnite, was not available on Linux.

Well, someone recommended that I check out GeFORCE NOW, which is a virtualized environment you can use within Linux to play a large number of games in the cloud. I’ve always been skeptical about that type of play, largely because the capacity of the system to provide a good gaming experience had not previously been available. However since I live alone and have a good broadband connection I tried it out and loved it. It’s indistinguishable from playing the game from your own computer.

So, since most of the apps I use are open-source or otherwise available for Linux, I decided to switch from Windows to Ubuntu 24.04. My PC has two hard drives as well as a NVME drive which hosts the Windows system, so I decided to delete and transfer what I could from a 1TB drive and installed Ubuntu on there. It was a breeze and I was quickly up and running. Ubuntu has very good hardware support so most things just worked, and the only thing I had to hunt down was a driver for the Logitech G13 gamepad I constantly use. I’ve been running this for about 3 weeks now and I have no desire to go back.

However, today I came up against an obstacle. On Windows I used Bitvise SSH client to connect to this server, and Bitvise saves its files in its own binary format. I found myself in a situation where I would have to go back to Windows to use Bitvise to connect to my server. Also while my current situation does not require that I have access to a Windows machine, that can change all too easily. So I decided to create a Windows virtual machine (VM from now on), but instead of using a virtual hard drive file, I would simply use the disk on which Windows is already installed. That makes a lot more sense. It’s just more efficient.

I found one set of instructions to help me do that, but it dates back to 2021 and hasn’t been updated more recently, so I spend some time figuring out the more current way to go about it.

How to run a Windows VM from an existing Windows disk

For this you will naturally need a computer running Linux, preferably something Debian-based like Ubuntu. You will also need to install VirtualBox on that computer (downloads here). You should also disable Bitlocker encryption from your Windows drive before proceeding. I didn’t have it enabled on my drive so I don’t know how that would affect the installation.

Set up your user

Your user will need to be part of two groups: “disk” (to enable raw disk access) and “vboxusers”.

sudo usermod -aG disk,vboxusers [user]

Also let’s create a folder “vms” in your home directory in which you will keep your VMs:

mkdir vms

Set up your Windows disk

First, find out where your Windows drive is mounted. By default when you install Ubuntu on a computer with FAT32 or NTFS drives, they will be accessible to Linux.

lshw -short -class disk,volume

This will show you a list of your hard disks and their partitions. Look for a disk that contains a “Windows FAT volume”, a “reserved partition” and one or more “Windows NTFS volumes” and note the entry in the Device column for the disk (not partition). Usually this will be “/dev/nvme0” (if you have a NVME disk) or “/dev/sda”.

Next, we’re going to create a special file that points to that disk using a utility that is installed with VirtualBox. Enter this as your regular user (not root):

VBoxManage createmedium disk --filename=vms/[disk file].vmdk --variant=RawDisk --format=VMDK --property RawDrive=[Windows drive]

This file points at the location of the Windows drive.

Create a VM

Now we’ll start using VirtualBox itself. But before we do, let’s install the VirtualBox Extension Pack (download from here). To install the file just double-click on it on the file. It will launch VirtualBox and the installation will take place.

In the VirtualBox dashboard, click on the Create a new virtual machine (VM) link.

  1. In the VM Name field, enter a name for the virtual machine
  2. The VM Folder should be “/home/[user]/vms”
  3. In the OS field select Microsoft Windows
  4. In the OS Version field select the version of Windows installed on your Windows disk.Win12
  5. Click on the Next button at the bottom right of the New Virtual Machine window.
  6. Under Specify virtual hardware, adjust the Base Memory and Number of CPUs. Bring the Disk Size slider to the lowest value. Note that using 16GB (or more) of RAM is highly recommended otherwise you’ll find the VM experience very taxing, but keep in mind that this memory will not be available to your Linux apps while the VM is running.
  7. Select Use EFI
  8. Click on the Next button.
  9. Click on the Finish button.

Attach The Windows Disk to the VM

Now we’ll attach the pointer file we created in step 1 to the VM.

  1. In the Machines tab of VirtualBox Manager, right-click on the new VM and click on Settings.
  2. In the [VM]-Settings window, select the Storage tab.
  3. You’ll see a .vdi file which we won’t be using. Click on the Add Attachment button at the bottom right of the Devices box (see below) and select Hard disk from the dropdown menu. Attach Disk
  4. In the Hard Disk selector window, click the Add button.
  5. Select the .vmdk file you created earlier in the file selection dialog box.
  6. With the .vmdk file selected, click on the Choose button.
  7. In the [VM]-Settings window, select the .vdi file, and click on the Remove Attachment button (next to the Add Attachment button).
  8. Click OK to save your VM configuration.

Run Your VM

Nothing left to do but to run the VM and make sure it works, so in the Machines tab of VirtualBox Manager, right-click on the VM you just edited and select Start > Start with GUI.

You should be able to log into your Windows installation.

If you have tried in the past to install Linux and modified the UEFI partition of your boot disk… well, you will then have to navigate around the disk using the GRUB CLI to fix your boot sequence. This is beyond the scope of this particular tutorial, but instructions are easily found online. I had to do this myself.

Something else that came to mind as I was writing this was to try and see if I can do the same thing using QEMU instead of VirtualBox, which I will also write a tutorial for if I can manage to do it.

Keep in mind that virtualization at the local level can be a bit tricky and resource-intensive. It’s also one of the rare things that can completely freeze up your system and force you to reboot it — that’s called a kernel panic.