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)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs