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
- Single
ext4.vhdx - VHDX stored on shared data partition
- Each Windows registers distro locally pointing to the same VHDX via
--vhd - Strict shutdown protocol to avoid concurrent writes
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
- close Linux workloads
- run
wsl --shutdown - reboot with hibernation disabled
- boot second Windows
- 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
- removed duplicated environments
- reduced setup and drift
- preserved consistent Linux workspace across both systems
- improved reliability with shutdown + backup discipline
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.
This post is licensed under CC BY-NC.
Comments
Join the discussion below.
Comments are not configured yet. Add Cusdis settings in /assets/json/config/blog-comments-config.json.