Ability to use physical drive instead of ext4.vhdx
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 33.7k
- Forks
- 1.8k
- Avg merge
- 3d 17h
- Merged PRs (30d)
- 116
Description
Background
Back in Windows Insiders preview build 20211, you added a wonderful feature: accessing Linux filesystems on a physical drive by mounting them. This is great for mounting separate drives and accessing Linux filesystems.
Currently the base WSL2 image is located in AppData\Local\<Distribution Directory>\LocalState\ext4.vhdx (at least with the Ubuntu distro).
The location for this directory is currently specified in the Computer\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Lxss\<Distribution Registry Key>
Proposal
To get even better I/O performance, it would be fantastic to have the option of using a Physical Drive instead. For example, VirtualBox has this feature and it made a huge difference in I/O performance:
https://www.virtualbox.org/manual/ch09.html#rawdisk
From Section 9.7.1 in their user guide:
"With Oracle VM VirtualBox, this type of access is called raw hard disk access. It enables a guest operating system to access its virtual hard disk without going through the host OS file system. The actual performance difference for image files compared to raw disk varies greatly depending on the overhead of the host file system, whether dynamically growing images are used, and on host OS caching strategies. The caching indirectly also affects other aspects such as failure behavior. For example, whether the virtual disk contains all data written before a host OS crash. Consult your host OS documentation for details on this."
I used to use that feature all the time when using a Windows host with Linux guest VMs, but admittedly this is something only a small percentage of expert users would be interested in.
High-level Implementation
I could imagine that an advanced user could use a program that does the opposite of SysInternals disk2vhd to copy the existing ext4.vhdx to a physical drive.
There are many ways to do something like this (here are two quick examples):
- EaseUS Easy VHD to Physical Disk Solution
- qemu-nbd + ddrescue in Linux
After that, the user could modify the Lxss registry key to point to the appropriate \\.\PHYSICALDRIVE%d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by investigating how the Lxss registry key selects the distribution storage location and how ext4.vhdx is mounted. The issue names no source files or tests; done would mean providing a supported way to use a physical drive instead of ext4.vhdx, including the relevant configuration path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- operating-systems
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100