Mount a Linux image on Windows and access to it from File Explorer with WSL2
Stefano Giraldi
Posted on October 30, 2021
Requisites
A Windows system with WSL2 and an installed distro.
1. Downlaod linux distro image
wget __linux_image_url
2. Run wsl console
$ wsl
3. Check disk image sectors
$ partx --show __linux_image_filepath__
NR START END SECTORS SIZE NAME UUID
1 8192 532479 524288 256M 9730496b-01
2 532480 3661823 3129344 1.5G 9730496b-02
3. Calculate offset
$ bc
bc 1.07.1
Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006, 2008, 2012-2017 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
> 532480 * 512
> 272629760
> quit
4. Mount Image
Create mounting point
$ sudo mkdir /mnt/other
Mount image
$ sudo mount -v -o offset=272629760 -t ext4 /_path_to_file_image/__filename__.img /mnt/other
mount: /dev/loop0 mounted on /mnt/other.
Check mounted image
$ ls /mnt/other
5. Access to Filesystem through File Explorer
- Open File Explorer
- Type
\\wsl$
in the address bar - Installed distros will be shown up. Click on it and navigate in the file system into the mounted path.
References
💖 💪 🙅 🚩
Stefano Giraldi
Posted on October 30, 2021
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.