Back to blog

Sharing a WSL 2 VHDX across dual-boot safely and predictably

3/2/2026 · 2 min · Infrastructure

Share

In dual-boot setups, running separate WSL distros on each Windows installation creates drift, duplicated dependencies, and wasted setup time. I implemented a shared-disk approach so both systems mount the same Linux filesystem.

Goal: boot Windows A or Windows B and keep the exact same WSL projects, packages, and user environment.

1) Target architecture

Example:

D:\WSL\Ubuntu-Shared\ext4.vhdx

2) Prerequisites

2.1 Confirm WSL supports --vhd

wsl --version
wsl --status
wsl --update

2.2 Ensure full shutdown on the other OS

Before rebooting into the second Windows:

wsl --shutdown

Disable Fast Startup / hibernation:

powercfg /h off

2.3 Validate data partition health

chkdsk D: /scan

3) Import existing VHDX on second Windows

wsl --import Ubuntu-Shared D:\WSL\Ubuntu-Shared D:\WSL\Ubuntu-Shared\ext4.vhdx --vhd

Validation:

wsl -l -v
wsl -d Ubuntu-Shared -- uname -a

4) Common failure and cleanup

If import conflicts with old registration:

wsl --unregister Ubuntu-Shared

Then re-run --import ... --vhd with correct paths.

5) UID/GID consistency to avoid permission issues

Inside distro:

id
getent passwd | head
ls -ln /home

If mismatch exists, align IDs:

sudo usermod -u 1000 myuser
sudo groupmod -g 1000 myuser
sudo find /home/myuser -uid OLD_UID -exec chown -h 1000 {} \;
sudo find /home/myuser -gid OLD_GID -exec chgrp -h 1000 {} \;

6) Keep kernel/runtime parity

wsl --update
wsl --version

Inside distro:

uname -r
cat /etc/os-release

7) Operational safety protocol

  1. close Linux workloads
  2. run wsl --shutdown
  3. reboot with hibernation disabled
  4. boot second Windows
  5. run quick health checks

Quick check:

wsl -d Ubuntu-Shared -- bash -lc "pwd && df -h && ls /home"

8) Backup and rollback

Periodic backup:

wsl --export Ubuntu-Shared D:\Backups\ubuntu-shared-$(Get-Date -Format yyyyMMdd).tar

Restore if needed:

wsl --import Ubuntu-Restore D:\WSL\Ubuntu-Restore D:\Backups\ubuntu-shared-YYYYMMDD.tar

9) Operational outcome

10) Final takeaway

Sharing one WSL 2 ext4.vhdx across dual-boot works reliably when treated as an operations process: correct --vhd import, no Fast Startup, UID/GID alignment, controlled shutdown, and scheduled backups.

CC BY-NC

This post is licensed under CC BY-NC.

Comments

Join the discussion below.