This is an old revision of the document!
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
pushd "%~dp0"
dir /b %SystemRoot%\servicing\Packages\*Hyper-V*.mum >hyper-v.txt
for /f %%i in ('findstr /i . hyper-v.txt 2^>nul') do dism /online /norestart /add-package:"%SystemRoot%\servicing\Packages\%%i"
del hyper-v.txt
Dism /online /enable-feature /featurename:Microsoft-Hyper-V -All /LimitAccess /ALL
pause
sudo apt update sudo apt upgrade
sudo apt install vim sudo apt install wget sudo apt install zip sudo apt install rsync
sudo mkdir /run/sshd
C:\Users\user\AppData\Local\Microsoft\WindowsApps\debian.exe
C:\Users\bco\AppData\Local\Packages\TheDebianProject.DebianGNULinux_76v4gfsz19hv4\LocalState\rootfs
C:\Users\<username>\AppData\Local\Packages\<distribution>\LocalState\ext4.vhdx (replace 'ext4' with the filesystem of your distribution)ext4.vhdx to another location and open it with 7zip.wsl.exe --shutdown
Mount-VHD -Path "<pathToVHD>"
diskpart
select vdisk file="<pathToVHD>"
attach vdisk
Mount the Disk in WSL: Open your WSL distribution (e.g., Ubuntu) and mount the disk path identified in the previous step. Replace <diskPath> with the actual disk path (e.g., /dev/sdb) and <mountPoint> with your desired mount point within WSL (e.g., /mnt/ext4). Code
sudo wsl --mount <diskPath> --bare sudo mkdir -p <mountPoint> sudo mount <diskPath> <mountPoint>
Access Files within WSL: Once mounted, you can navigate to the <mountPoint> within your WSL environment and access the files stored on the ext4.vhdx. Code
cd <mountPoint> ls -l
Unmount and Detach (after use): When you are finished, unmount the disk within WSL and detach the VHDX from Windows. Code
sudo umount <mountPoint> wsl --unmount <diskPath>
If you used Mount-VHD: Code
Dismount-VHD -Path "<pathToVHD>"
If you used diskpart: Code
diskpart select vdisk file="<pathToVHD>" detach vdisk
Alternative Method (for viewing only): For simply viewing the contents of an ext4.vhdx file without mounting, you can use tools like 7-Zip. 7-Zip can open and browse the contents of various disk image formats, including ext4.vhdx, allowing you to extract files without needing to mount the entire disk.
sudo apt install openssh-server
sudo visudo %sudo ALL=(ALL:ALL) ALL <user> ALL=(root:root) NOPASSWD: /etc/init.d/ssh
#!/bin/bash sudo /etc/init.d/ssh start
<QueryList>
<Query Id="0" Path="Microsoft-Windows-TaskScheduler/Operational">
<Select Path="Microsoft-Windows-TaskScheduler/Operational">*[EventData[@Name='TaskSuccessEvent'][Data[@Name='TaskName']='\Mount']]</Select>
</Query>
</QueryList>
mkdir /mnt/f mount -t drvfs f: /mnt/f