Can you Side load your Linux distro from your HDD using WSL2
On 6/16/2020 at 6:36 PM, Joe Jackman said:
Basically i don't wanna do all my Configure from the beginning and i really don't wanna delete (dual booting) it to make way.
Actually, you can (I think).
On your Linux system:
$ sudo su -
# cd /
# tar -cpzf backup.tar.gz --exclude=/backup.tar.gz --exclude=/proc --exclude=/tmp --exclude=/mnt --exclude=/dev --exclude=/sys /
Then copy the backup.tar.gz to your windows system. Now, here's the thing I am not entirely sure. I know for a fact you can import this file into a docker container and run it. I also know for a fact you can export a docker container and sideload it as a distribution into WSL2. So my assumption is you can import this directly into WSL2 as well.
gunzip the file so you end up with the file backup.tar (you can also omit the z flag in the tar command above, but you will end up with a huge file to move around)
Then open a CMD window and issue:
wsl --import "<Your_Distro_Name>" "<Location_to_store_your_Distro>" "PATH/TO/<archive.tar>" --version 2
This _should_ work. If it doesn't, the quick solution would be to import the tar.gz into a new Docker container, en then export it from Docker so you can then import the resulting file into WSL2.
Hope this helps. I have no tested this, but I have used Docker exports to create and sideload my own Slackware distribution for WSL2 that is not available otherwise.
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 accountSign in
Already have an account? Sign in here.
Sign In Now