MntWatch

Hot reload for WSL 2 projects on /mnt/c

Your code lives on C:\, your dev server runs in WSL 2, and saving a file does nothing. MntWatch is a free Windows tray app that makes Linux file watchers (Vite, webpack, nodemon, Python reloaders, anything on inotify) see the files you edit in Windows. No polling, and no moving your code into the Linux filesystem.

Windows 10 and 11 with WSL 2 · one ~100 KB exe, nothing to install in Linux · open source (MIT) · nothing is uploaded

MntWatch self-test in a terminal: without MntWatch, Linux heard nothing in 2 seconds; with MntWatch, a Windows edit reached a Linux watcher after 32 ms, Linux saw the new size, and a new file was heard after 33 ms

The built-in self-test: the bug first, then the fix. Real output on an Alpine test distro, user name shortened.

Why saving does nothing, and what MntWatch changes

WSL mounts your drives with a cache mode where the Linux kernel creates a new inode every time a file is looked up. inotify watches are attached to inodes, so the watch sits on one while every change goes through another. No event ever arrives, whether Windows or Linux made the change. It's been microsoft/WSL#4739 since 2019.

1One folder, remounted

Only the folders you add get an overmount with the same owner and permission settings plus one cache bit that keeps one inode per file. Now inotify works for Linux-side changes.

2Windows changes forwarded

The exe hears each change through Windows' own notifications and tells a small helper in your distro which paths changed.

3A harmless nudge

The helper writes each file's own mode back to it. Linux refreshes size and time from Windows and raises IN_ATTRIB, which your watcher reports as a change.

You do this in WindowsLinux watchers see
Edit and saveA change on that file, typically 10–30 ms later
Create a fileA change on the file and its folder; Node's fs.watch reports it as new
Atomic save (temp file + rename)A change on the file and its folder
DeleteA change on the folder (a real delete event can't be faked)
Create a folderA change on its parent; tools that rescan pick it up, see the limits

What you get

inotify, not polling

Leave CHOKIDAR_USEPOLLING and usePolling off. Changes arrive as real events, with no CPU spent re-reading big trees.

Linux writes fire too

Inside a MntWatch folder, changes made from Linux (codegen, git checkout) fire events again. Without it, they don't either.

Scoped and reversible

Only the folders you pick are touched, and each goes back to normal the moment MntWatch stops, even if it's killed.

Never starts WSL

It waits for your distro to run, attaches, and steps aside on wsl --shutdown. Pick a distro or use your default.

Self-test

MntWatch.exe --self-test reproduces the bug on a temp folder, then shows the fix with timings, using whatever inotify tool your distro has.

Small and open

One exe plus a ~90-line shell script you can read. No driver, no service, MIT-licensed, built by GitHub Actions.

Get started

  1. Download MntWatch.exe, put it somewhere permanent and run it. It lives in the tray.
  2. Click the icon → Add folder... and pick your project, for example C:\dev\my-app.
  3. Restart your dev server once, and cd back into the folder in open shells.
  4. Optional: Start with Windows, or Run self-test to see it work.

The exe isn't code-signed yet, so SmartScreen may say "Windows protected your PC". Click More info → Run anyway, or build it yourself. Each release has a SHA-256 checksum.

Or from a terminal

MntWatch.exe --run C:\dev\my-app
MntWatch.exe --run C:\dev\app D:\site --distro Ubuntu --verbose
MntWatch.exe --self-test

Needs WSL 2 with a current kernel (wsl --update). Any distro: the helper only uses sh, stat, chmod, xargs, awk and mount.

Limits, honestly

FAQ

Why not just turn on polling?

Polling works, but it costs CPU on big trees, adds delay, and has to be configured in every tool, often in every project. With MntWatch, the default inotify mode works.

Why not move the project into the Linux filesystem?

That's Microsoft's advice and the fastest setup, so do it if you can. MntWatch is for when the files have to stay on Windows: Windows-only tools, an editor without remote mode, sync folders, backups, or a repo shared with Windows builds.

It runs a script as root in my distro. Is that safe?

Mounting needs root, and wsl.exe --user root needs no password. The script is in the repo and is sent fresh each time. It only mounts and unmounts the folders you added, runs stat and chmod (each file's own mode back, symlinks skipped) on paths Windows reported, and find if Windows reports lost events. It never writes file contents and never deletes anything.

Does it work with Vite, webpack, nodemon, Next.js, uvicorn?

Node's fs.watch (what chokidar, and so Vite, webpack and nodemon, are built on) and Python's watchdog were tested and got every edit, including 20,000-file bursts. The dev servers themselves weren't tested one by one yet. If yours doesn't reload, run the self-test and open an issue with the output.

What has it been tested on?

Windows 11, WSL 2.7.13, kernel 6.18, an Alpine 3.24 distro: edits, new files and folders, atomic saves, deletes, bursts, Linux-side writes, metadata mounts, symlinks, and MntWatch being killed. Not yet: Ubuntu or Debian, and older kernels. Kernels too old to accept the cache flags are refused with a "run wsl --update" message.

Why this exists

"Hot reload doesn't work in WSL 2" is one of the oldest open WSL complaints, and the answers are always polling or "move your files".