DEV Community

Cover image for Move WSL2 Distro To Other Driver
Jenuel Oras Ganawed
Jenuel Oras Ganawed

Posted on • Originally published at brojenuel.com

3 1 1 1 1

Move WSL2 Distro To Other Driver

So, I get ask a lot on how to move a WSL2 distro to other drive. And this is the easiest I found.

First let us check what distros are we going to move to other drive by running this command:

wsl -l -v
Enter fullscreen mode Exit fullscreen mode

image right here

Next, we need to make sure distributions are not running by running.

wsl --shutdown
Enter fullscreen mode Exit fullscreen mode

Its optional but having a backup is important. You can create a directory where you want to put the backup on your system. In my case I will create a wsl folder iny my D drive. And then run wsl export to export the distribution.

mkdir D:/backup
wsl --export Ubuntu-20.04 D:\backup\ubuntu.tar
Enter fullscreen mode Exit fullscreen mode

Wait till the WSL export is over (it may take much time). A TAR archive with your WSL ext4 file system will appear in the target directory.

Then you may remove the WSL files on the source disk:

wsl --unregister Ubuntu-20.04
Enter fullscreen mode Exit fullscreen mode

Set up a new folder on a different drive for your Linux files and use a command to bring those files into the folder. In my case I will create WSL folder in my D drive.

mkdir D:\WSL
Enter fullscreen mode Exit fullscreen mode

Then Let us run the import to import it in our WLS directory.

wsl --import Ubuntu-20.04 D:\WSL\ D:\backup\ubuntu.tar
Enter fullscreen mode Exit fullscreen mode

There you go. You have now moved your distro to your other drive.


Donate To BroJenuel image

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more

Top comments (0)

👋 Kindness is contagious

Immerse yourself in a wealth of knowledge with this piece, supported by the inclusive DEV Community—every developer, no matter where they are in their journey, is invited to contribute to our collective wisdom.

A simple “thank you” goes a long way—express your gratitude below in the comments!

Gathering insights enriches our journey on DEV and fortifies our community ties. Did you find this article valuable? Taking a moment to thank the author can have a significant impact.

Okay