Gabriel Tavares
Posted on September 1, 2024
Introduction
I'm writing this post to help when I forget how to do this or if someone else needs a little help with this kinda of issue.
Motivation
I use more than one SSD. My main SSD was being filled with my development files from WSL and Docker. So I wanted find a way to move this data to another disk. Testing and searching I found a way to do so.
Getting Things Done
First of all you need to check if your WSL is running:
wsl -l -v
You might get something like this:
NAME STATE VERSION
* Ubuntu Running 2
docker-desktop-data Running 2
docker-desktop Running 2
if STATE
is Running
you have to shutdown WSL:
wsl --shutdown
Now we will export the WSL data to another place:
wsl --export docker-desktop-data "<your-new-wsl-data-location>\docker-desktop-data.tar"
Exporting data maybe will take a while. When finished, we need to unregister the distro by using this command:
wsl --unregister docker-desktop-data
WARNING: your ext4.vhdx
data will be removed as well from the original file destination.
wsl --import docker-desktop-data "<new-data-location-folder>" "<new-data-location-folder>\docker-desktop-data.tar" --version 2
WARNING: you see we put a flag --version 2
, this is the version of WSL distro.
Conclusion
You can delete ONLY the <your_docker_path>\wsl\data\docker-desktop-data.tar
file. Don't delete others files the might be in the folder!
Thanks for read until right here and I hope this help.
Posted on September 1, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.