3

I have a dual boot set up with two separate hard drives: one for Windows and one for Linux. I also use WSL for light development work. I want to know if it is possible for me to access the WSL files from the Linux hard drive. Ordinarily, I could mount the C drive to navigate the Windows file system, but I don't know how to also (?) mount the WSL image.

5
  • 2
    Without more information, this is a bad idea. PERHAPS if it were mounted READ ONLY. WSL controls metadata for files virtualized under root and not mnt. Editing them WILL result in corruption. @michal.fied (below) gives you the path.. but don't EDIT anything in it. Commented Sep 9, 2020 at 16:04
  • is it wsl 1 or 2? Commented Sep 9, 2020 at 17:55
  • @SenorCMasMas I actually corrupted the file when trying to mount it with guestmount in read only, so I think you are correct.
    – geoffrey
    Commented Sep 10, 2020 at 17:25
  • @MichaelHarvey wsl 2
    – geoffrey
    Commented Sep 10, 2020 at 17:26
  • Try \\wsl$ but beware as has been said. Commented Sep 10, 2020 at 17:34

2 Answers 2

0

You can find WSL file in this path: C:\Users\YourAccount\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgsc\LocalState\rootfs so maybe if you mount this path then you should have access to the WSL files.

4
  • Not for me; I have a Debian 10 WSL2 instance. Commented Sep 10, 2020 at 17:30
  • Did you tired find here C:\Users\YourAccount\AppData\Local\Packages ? I think it should be in this path. In my last comment I put path to the Ubuntu instance. Commented Sep 10, 2020 at 19:43
  • Isn't that just for WSL version 1? Commented Sep 10, 2020 at 20:09
  • Okay so I'm look deeper about path and found this: 1. Run the distribution 2. Press Win+R 3. Type \\wsl$ which opens File Explorer 4. Double click on the distribution folder. This should work. I checked on WSL v1 and after running my Ubuntu it's shows me folder with Ubuntu 18.04 Commented Sep 11, 2020 at 9:18
1

Take a look at this blog. I think it will tell you how to do.

TL;DR

  1. (PWSH) wmic diskdrive list brief to get disk info
  2. (PWSH admin) wsl --mount <hard device> --partition <part id> to mount your ext4(default) FS
  3. you can access it in your WSL

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .