Move WSL2 to Another Drive Without Rebuilding Your Linux Setup

The C drive is almost full, and the WSL2 distro holding your projects is the biggest thing on it. How do you move it to D and test the new copy before the old one is gone?

Move WSL2 to Another Drive Without Rebuilding Your Linux Setup
TLDR
  • Use a supported move command to relocate the existing distribution while keeping its name.
  • Export and import under a different name when you want to test the new location before deleting the original.
  • Check the Linux user, project files, and Windows integrations before switching your default distribution.

A larger drive for the Linux environment you already use

Moving WSL2 to another drive does not require rebuilding your Linux setup. You can relocate the registered distribution, or export it and import a second copy. The useful distinction is whether you want one continuing environment or two environments you can compare before removing the original.

That choice matters when cleanup only buys a little time. In a Reddit question about moving Pengwin, the author said AI models and packages kept filling the C drive after earlier cleanup. Relocating the distribution changes where its future Linux files accumulate. Deleting a few caches leaves that storage destination unchanged.

ApproachWhat you keepStorage during the move
Move the registered distributionThe existing distribution name and registrationRoom at the destination plus a separate backup
Export, then import with a new nameThe original and an independently registered copyThe original, export archive, and imported disk coexist

The following commands use PowerShell and an example distribution named Ubuntu. Substitute the exact name shown on your computer. Follow the shared preparation, then choose one relocation method. These are alternative routes, not consecutive stages.

What a distribution move includes

WSL2 stores its Linux filesystem in an expanding virtual disk, usually named ext4.vhdx. Its maximum capacity is different from the space it currently occupies on Windows. A Linux filesystem showing a 1TB maximum does not mean Windows has already allocated that much physical storage.

Use the current VHDX file's Windows properties and the destination drive's free space to plan the transfer. If the export archive and imported distribution will both live on D, allow room for both. There is no universal multiplier here: the archive and virtual disk need not have the same physical size.

A project under /home/alex/projects lives inside the Linux filesystem. A project under /mnt/c/Users/Alex/projects is on the Windows C drive. Relocating the distribution does not relocate those Windows files. Microsoft recommends the Linux filesystem for projects used with Linux tools; Windows-hosted projects need their own storage decision.

Windows-side settings also remain outside a distribution export. The .wslconfig in your Windows user profile controls global WSL2 settings, while /etc/wsl.conf belongs to the individual Linux distribution. Preserve any Windows settings you need separately. Microsoft documents these two scopes, including the separately configured swap file location.

Record your user and export a stopped environment

Start by listing distributions and checking the installed WSL interface:

wsl --list --verbose
wsl --version
wsl --help

The VERSION column in the distribution list means WSL1 or WSL2; it is not the installed WSL application's release number. This procedure is for WSL2. Look for --manage and --move in your local help. If they are unavailable, update with wsl --update and check again, or use export and import.

In your usual Linux shell, run whoami and record your project paths. Save files, stop databases or development services through their normal shutdown procedures, and close editors connected to WSL. Then create D:\WSL-Backups in File Explorer and run:

wsl --shutdown
wsl --export Ubuntu "D:\WSL-Backups\Ubuntu-20261026.tar"

Shutdown stops every running distribution and the WSL2 virtual machine, so save work in other distributions too. Export defaults to a tar archive. Wait for a successful result before continuing, and check that the file exists at the intended location. Choose a new filename if an older backup already uses this path.

An export can contain private material from your home directory, including SSH keys. Store it accordingly. Its existence alone does not prove restoration works; importing it under a different name provides a way to test that while retaining the original environment.

Route one: move the existing registration

After making the backup, create the parent folder D:\WSL and choose an unused destination for this distribution. With the move option available in your local help, run:

wsl --manage Ubuntu --move "D:\WSL\Ubuntu"

The distribution remains named Ubuntu after the move. WSL uses the existing registration for the relocation, so you keep selecting the same name in your terminal. The operation was introduced in the 2.3.11 prerelease; your installed help determines whether it is available on this computer.

After success, launch wsl --distribution Ubuntu. Check whoami, open your project, and run the tools you normally use. Keeping the registration means you continue selecting Ubuntu. Do not use the old-distribution removal command later in this article: in this route, that name identifies the environment you just moved.

Route two: import a copy and restore the default user

For a trial copy, choose a new distribution name and destination. Here, Ubuntu stays on C while Ubuntu-D is imported on D. Create an empty D:\WSL\Ubuntu-D destination folder in File Explorer first.

wsl --import Ubuntu-D "D:\WSL\Ubuntu-D" "D:\WSL-Backups\Ubuntu-20261026.tar" --version 2

If import reports an error, resolve it before proceeding. After success, list the registrations and enter the new one as your existing Linux user. Replace alex with the username you recorded earlier.

wsl --list --verbose
wsl --distribution Ubuntu-D --user alex

The imported filesystem reflects the time of the export. If you restart the original Ubuntu and edit Linux files afterward, those changes do not automatically appear in Ubuntu-D. During the trial, keep track of which distribution you are using and transfer any later edits before deleting the original. A shared Windows path is different: both distributions can access the same files under a mount such as /mnt/c, so that location is not an independent test copy.

To inspect a Linux project, change into its recorded directory after launching Ubuntu-D. For example, use cd /home/alex/projects and ls -la before opening the actual project files. Replace the example path with your own; a successful shell launch alone does not establish that you imported the expected work.

Imported distributions start as root unless a default user is configured. An existing [user] entry in the exported /etc/wsl.conf comes with the filesystem. If you do get root, your home directory has not necessarily disappeared: the export already contains your existing account, so it does not need to be recreated.

If the distribution still opens as root without an explicit user argument, first verify the project as your existing user. Then edit /etc/wsl.conf inside the imported distribution with administrative privileges and set the following entry, preserving all other sections:

[user]
default=alex

If a user section already exists, update its default value rather than appending another copy. The Store launcher command ubuntu config --default-user is not the appropriate route for an imported distribution, which lacks that dedicated launcher. Exit Linux, terminate the imported distribution, and start it again to apply the configuration:

wsl --terminate Ubuntu-D
wsl --distribution Ubuntu-D

Run whoami again. Open the project and check hidden configuration files, application data, and the development commands you depend on. Update any editor or Windows Terminal entry that explicitly targets the old distribution name; otherwise, you may keep working in the original copy without realizing it.

Verify the location before reclaiming C drive space

Microsoft provides a registry lookup for the registered disk location. This PowerShell command only reads that information. Use Ubuntu after a direct move or Ubuntu-D after the separate import:

$DistroName = "Ubuntu-D"
(Get-ChildItem -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Lxss | Where-Object { $_.GetValue("DistributionName") -eq $DistroName }).GetValue("BasePath") + "\ext4.vhdx"

Check the resulting path and the drives' free space in Windows. Importing a second copy does not yet free the original's space on C. Relocation also does not promise to shrink the virtual disk or move every WSL-related file, such as a separately located swap file.

Once the imported environment works, make it the default for a plain wsl invocation:

wsl --set-default Ubuntu-D

This changes the default without deleting either distribution. Only after testing the new environment and retaining the backup should you consider the following separate cleanup action. It permanently removes the original Ubuntu distribution's data, settings, and software. Verify the name against your list. Do not run it if Ubuntu is the distribution you directly moved.

wsl --unregister Ubuntu

Microsoft's FAQ also describes migration using a VHD export and in-place import. An in-place import uses the specified VHDX itself; once it is your active disk, it is no longer an independent backup. The tar archive in the separate-import procedure remains a distinct file. Export the new distribution again when you want a backup containing work done after the move.