Easily move WSL distributions between Windows 10 machines with import and export!
My colleague Tara and I were working on prepping a system for Azure IoT development and were using WSL2 on our respective machines. The scripts we were running were long-running and tedious and by the time they were done we basically had a totally customized perfect distro.
Rather than sharing our scripts and having folks run them for hours, we instead decided to export the distro and import it on n number of machines. That way Tara could set up the distro perfectly and then give it to me.
For example, when using PowerShell I can do this:
C:\Users\Scott\Desktop> wsl --export PerfectWSLDistro ./PerfectWSLDistro.tar
Then I can share the resulting tar and give it to a friend and they can do this! (Note that I'm using ~ which is your home directory from PowerShell. If you're using cmd.exe you'll want to include the full path like c:\users\scott\Appdata\Local\PerfectDistro)
wsl --import PerfectDistro ~/AppData/Local/PerfectDistro ./PerfectWSLDistro.tar --version 2
You can list our your WSL distros like this:
C:\Users\Scott\Desktop> wsl --list -v
NAME STATE VERSION
* Ubuntu-18.04 Stopped 2
WLinux Stopped 2
Debian Stopped 1
PerfectDistro Stopped 2
It's surprisingly easy! Also, make sure you have the latest version of the Windows Terminal (and if you've got an old version and haven't deleted your profile.json, it's time to start fresh) it will automatically detect your WSL distros and make menu items for them!
Also be sure to check out my YouTube video on developing with WSL2!
Sponsor: Like C#? We do too! That’s why we've developed a fast, smart, cross-platform .NET IDE which gives you even more coding power. Clever code analysis, rich code completion, instant search and navigation, an advanced debugger... With JetBrains Rider, everything you need is at your fingertips. Code C# at the speed of thought on Linux, Mac, or Windows. Try JetBrains Rider today!
Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.
C:\Users\Phil\Documents> wsl --export Ubuntu ./WSL2UbuntuEoan.tar
The process cannot access the file because it is being used by another process.
I thought running wsl --shutdown Ubuntu first might help, but no dice. Any advice would be welcomed.
But that's a bit hacky. If I could use your way, and then update one of the two distros to WSL2, I think I'd like that better.
the reason that this this web site conations truly
nice funny data too.
my breakfast coming yet again to read further news.
Extremely helpful info specifically the last part :) I care for such
info a lot. I was seeking this certain info for a long time.
Thank you and best of luck.
mention that I have really enjoyed browsing your weblog posts.
After all I'll be subscribing on your feed and I am hoping you write
once more soon!
you for ones time due to this fantastic read!! I definitely loved
every little bit of it and i also have you book marked to look at new stuff on your blog.
year old daughter and said "You can hear the ocean if you put this to your ear." She placed the shell to her ear
and screamed. There was a hermit crab inside and it pinched her ear.
She never wants to go back! LoL I know this is totally off topic but I had to tell someone!
cash advance online
online payday loans no credit check
cash advance america near me now
no credit check payday loans instant approval
sharing information, that's genuinely excellent, keep
this onto a co-worker who has been conducting a
little homework on this. And he in fact bought me lunch because I stumbled upon it for him...
lol. So allow me to reword this.... Thanks for the meal!!
But yeah, thanks for spending time to discuss this subject here on your web page.
In any case I'll be subscribing to your rss feed and I am hoping you write once more soon!
de seu site. É um muito fácil sobre os olhos, que o torna muito mais agradável
para eu vir aqui e visitar mais vezes. Você contratou para fora um designer para criar seu
tema? Excepcional !
pay a visit this web page and be up to date everyday.
as I provide credit and sources back to your webpage? My blog is in the very same niche as yours and
my users would certainly benefit from some of the information you provide
here. Please let me know if this ok with you.
I will be sure to bookmark it and return to learn extra
of your helpful information. Thanks for the post. I'llcertainly return.
Anyway I'll be subscribing to your feeds and even I achievement you access
Comments are closed.