DEV Community

Installing WSL on another drive in Windows

AW A RE on May 09, 2022

The only way to do that is to move the linux distrubition you installed on wsl. I installed Ubuntu on windows as wsl and I showed how to move it st...
Collapse
 
ahmed2m profile image
Ahmed Mohamadeen •

Thanks!
I'd like to add a reference to some steps mentioned in the default documentation like setting up a default user, because by default --import always starts the image in the root user.
learn.microsoft.com/en-us/windows/...

Collapse
 
legion2004 profile image
Milinda Barua •

if you get a root user after exporting and if you happen to make a user or had a user already before exporting then go to settings and at the profile of the exported linux distro in the command line tab add the line : wsl.exe -d -u . the part till distro name will be same but pass the -u flag with your username and you will get the previous user that was being used

Collapse
 
luizvnasc profile image
Guto •

life saver

Collapse
 
marvinxu profile image
Marvin •

Can I set path on initial install?

Collapse
 
cristianorc profile image
Cristiano Raffi Cunha •

Thank You! <3

Collapse
 
kogordev profile image
kogordev •

Thank you very much.

Collapse
 
diwakardayal profile image
Diwakar dayal •

thank you!!

Collapse
 
funny2code profile image
Dejan •

That works fine for me. Thank you a lot.

Collapse
 
kauefraga profile image
Kauê Fraga Rodrigues •

Kinda useful! 🔥 Thanks for sharing!!!

Collapse
 
iretex profile image
Iretioluwa Olawuyi •

Thanks very much for sharing. This is super helpful!

Collapse
 
duonghb53 profile image
Maintain •

Thank you for sharing

Collapse
 
nguyentai2002 profile image
NguyenTai2002 •

saved my life, thank you so much, 2025 check

Collapse
 
georgeleao profile image
George Leão •

Thanks my friend!!

Collapse
 
dashdamirli profile image
Asad •

Can wsl_export be deleted after running the last command?

Collapse
 
guther profile image
GuTheR •

No!! Don't do that!

Collapse
 
wheatfox profile image
wheatfox •

THANK YOU!!!!

Collapse
 
alma profile image
Alan Ma •

Super solution! Thank you @mefaba

Collapse
 
shilohooo profile image
shiloh •

Great Post!!!

Collapse
 
loribas profile image
Luis Otavio Ribas •

Thank you !

Collapse
 
alexisnorthcoders profile image
Alexis Creoulo •

2 years later still useful. Legend.

Collapse
 
mamad_jufry_1a31b40d48a95 profile image
mamad jufry •

thank you

Collapse
 
zenitk profile image
Zenit Kovačević •

That worked, mostly. The WSL2 distro that I imported can't run GUI application anymore for some reason.

Collapse
 
sb_tv profile image
Sokhib Tukhtaev •

If I want to move my ubuntu distro on wsl from C drive to say, F, does the F drive have to be empty? I have nearly half of it used on my native Windows OS.

Collapse
 
federicoromeo profile image
Federico Romeo •

Amazing thanks! Just want to point out:

2.0: Go to D:\ and create a directory wsl_export