Jump to content

So I got a new laptop with windows on it and I have a wsl installation with all my data for that distro on my pc. Is there a way I could move the folder from the pc to the laptop and WSL can detect the files etc. automatically on the laptop?

Thanks in advance.

Link to comment
https://linustechtips.com/topic/1547576-wsl/
Share on other sites

Link to post
Share on other sites

4 hours ago, goatedpenguin said:

Is there a way I could move the folder from the pc to the laptop and WSL can detect the files etc. automatically on the laptop?

Yes wsl instances can be moved. Check this guide out

https://github.com/LpCodes/Moving-WSL-Distribution-to-Another-Drive

for Step 4 copy the exported file to your new machine and change the paths to match yours.

Link to comment
https://linustechtips.com/topic/1547576-wsl/#findComment-16249400
Share on other sites

Link to post
Share on other sites

2 hours ago, goatedpenguin said:

can you be more specific?

Just to be sure I understand you. Where did you place your files? Under WSL or outside WSL?
WSL2 (I'll focus on "v2" of WSL), can be seen as a fancy VM (specialized for Linux based OSs) where it has deep ties with the OS, allowing you to cross both Linux based OS world and Windows. That said, it is still a VM.

 

If you have files IN WSL2 environment, you can access them through File Explorer, by clicking on the "Linux" item on the navigation bar.

If you don't have it, then you are probably under Windows 10. Under which case, you can type "explorer.exe ." (notice the space and the "." after "explorer.exe") under your WSL2 environment, and you'll open File Explorer exactly at that location. It should be a network location.

 

WSL2, as mentioned, is really a VM at the end of the day, that means it has a VHD of some kind. It means that you can export it and import the envirement. This avoids reinstalling/reconfiguring everything.

You can use these commands which you execute under Windows (Command Prompt or PowerShell) to do this: https://learn.microsoft.com/en-us/windows/wsl/basic-commands

 

If your files are outside of WSL2 envirement, meaning not under your Linux based distro env, then you can just treat them as any files of your system. The other system WSL envirement will see them just fine. You can view your Windows files under Linux via /mnt/ folder, where you'll have, your drive letters. So, if your files are under Documents, assuming a starts Windows install, it can be accessed via: /mnt/c/Users/<account name>/Documents

 

 

 

Link to comment
https://linustechtips.com/topic/1547576-wsl/#findComment-16249407
Share on other sites

Link to post
Share on other sites

21 hours ago, goatedpenguin said:

 wsl --import kali C:\wsl\kali-linux\ ext4.vhdx
The system cannot find the file specified.
Error code: Wsl/ERROR_FILE_NOT_FOUND

 

I have no idea whats happening now.

 

As per documentation:

wsl --import Kali --vhd "C:\wsl\kali-linux\ext4.vhdx" --version 2
Link to comment
https://linustechtips.com/topic/1547576-wsl/#findComment-16251067
Share on other sites

Link to post
Share on other sites

5 minutes ago, goatedpenguin said:

Nope not working just returns me the the wsl man page

Sounds like you don't have the latest version of WSL.

It should be fetched from the Store app.

 

OR, this is the first distro that you are installing on the system and so:

--import-in-place should be used.

wsl --import-in-place Kali "C:\wsl\kali-linux\ext4.vhdx"

 

Link to comment
https://linustechtips.com/topic/1547576-wsl/#findComment-16251076
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×