31 October 2023 11:30
WSL2 File System Goes Into Read Only Mode Without Warning · Issue #8340 · microsoft/WSL
Shutdown WSL
In powershell as administrator, run:
Write-Output ".PhysicalDrive$((Mount-VHD -Path ./ext4.vhdx -PassThru | Get-Disk).Number)"
Then attach without mounting in another WSL distro, e.g.:
wsl -d Ubuntu-22.04 --mount .PhysicalDrive1 --bare
Launch this distro:
wsl -d Ubuntu-22.04
Find the block device using command `lsblk` (e.g. /dev/sdb)
Run e2fsck: `sudo e2fsck -f /dev/sdb`
Detach the file from WSL: `wsl --unmount .PhysicalDrive1`
Detach the VHD file from Windows: `Dismount-VHD -Path ./ext4.vhdx` or from Disk Management GUI
If at any point, there are some errors, try stopping Hyper-V service from Hyper-V Manager GUI, then launching Hyper-V Management Service from Windows Services GUI.
1
(1 marks)