Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Svetoslav92 opened this issue Dec 9, 2022 · 3 comments
Labels

Comments

@Svetoslav92
Copy link

Svetoslav92 commented Dec 9, 2022

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

@Svetoslav92 Svetoslav92 changed the title WSL --mount is caching/buffering with no chance of flushing imidiately WSL2 --mount is caching/buffering with no chance of flushing imidiately Dec 9, 2022
@Svetoslav92 Svetoslav92 changed the title WSL2 --mount is caching/buffering with no chance of flushing imidiately WSL2 --mount is caching/buffering with no chance of flushing immediately Dec 10, 2022
@OneBlue
Copy link
Collaborator

OneBlue commented Dec 13, 2022

@Svetoslav92: You can specify mount options via --options. See: Specifying mount options

Sadly the 'sync' option isn't supported at the moment so another way you can do this is via:

sudo mount -o remount,sync <device>

After mounting the disk

@Svetoslav92
Copy link
Author

Svetoslav92 commented Dec 18, 2022

"isn't supported at the moment" - well that's why it is important feature request lol
Anyway the remount seems smart workaround option. I will try it and report back. But chances are high :)

@Svetoslav92
Copy link
Author

Svetoslav92 commented Dec 30, 2022

I didn't had the chance to test it but I trust that it works this way as it seems logical.
The bigger issue is now that my VirtualBox doesn't work as expected because of WSL2 by Hyper-V bug already listed. You can close this if you wish or retain it as feature request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants