microsoft / microsoft/WSL

WSL2 --mount is caching/buffering with no chance of flushing immediately

Open
#9,299 3 comments 0 reactions 0 assignees View on GitHub
feature
Dominant language
C++
Stars
33.7k
Forks
1.8k
Avg merge
3d 17h
Merged PRs (30d)
116

Description

Hi all,
As the title suggests this seems to be important feature request.
I want to mount ext2 partition which is inaccessible from Windows. Yes, you discovered the --mount option but it is lacking the ability to disable caching. If I edit text file from wsl shared path from windows it does not get reflected until some kind of buffer fills up. Because I edit only text files this buffer will fill up in a year time in order to flush it to the disk - just unusable. That's why I tried to mount the drive from within WSL with the mount statement (plus -o sync) but since the disk in windows is detected as unformatted it wants me to initialize it first before be able to assign a drive letter (which will format the disk unwantedly). A drive letter which is a must inside WSL mount.
So I am stuck with the --mount option without a chance to remove the buffer/cache.
Does anyone know if it is possible to use mount() which is as I can see the base function behind the linux mount and use it, by providing hard disk address etc but not drive letter?
I played around with (linux) mount statement and a hacky driver that enforces a drive letter in windows but after trying to apply it I get ERROR: MountWithRetry:306: mount(drvfsa, /mnt/e, 9p, 0x00000010, cache=mmap,msize=262144,trans=virtio,aname=drvfs;path=e:;uid=0;gid=0;metadata;symlinkroot=/mnt/) failed: Invalid argument
which makes me think that mount really can accept hard disk address (in this case broken from hacky driver - 0x00000010) one ?

Thanks

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the reported behavior with WSL2 `--mount` and compare it with the Linux `mount()` options described in the issue. Inspect the `MountWithRetry:306` failure context and determine the supported scope for disabling buffering or flushing immediately; the issue is done when the requested behavior is defined and verified.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, linux
Domain
operating-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.