How to Move a WSL Linux Distro to Another Drive in Windows 11 (and Free Up Space on C:)

11 min read

Help Desk Geek is reader-supported. We may earn a commission when you buy through links on our site. Learn more.

If your WSL Linux distro (ext4.vhdx) is filling up your C: drive in Windows 11, you can move it to another drive with a staged VHD export, verification, and --import-in-place workflow—or in one step with wsl --manage <Distribution> --move <Location> if your installed WSL build lists --move in wsl --help.

What Is the WSL Virtual Disk?

A WSL 2 distribution stores its Linux files in a virtual disk, usually named ext4.vhdx. As you install packages and create files in Ubuntu or another distro, that disk can grow on C:. Moving the distribution places its virtual disk on another drive; it does not automatically shrink an oversized disk. Microsoft explains the difference between WSL 1 and WSL 2 in its WSL version comparison.

Prerequisites

  • An installed distribution shown as VERSION 2 by wsl --list --verbose. These steps focus on WSL 2 in Windows 11 and also apply to Windows 10 systems with WSL 2.
  • A local destination drive with enough free space for the exported disk. The examples use D: and a distribution named Ubuntu; replace both with your actual values.
  • Time to close Linux terminals and apps while the export runs.
  • Ideally, space for a second copy of the export on an external SSD or another drive. The exported disk becomes the live disk after the move, so a separate copy gives you a recovery option.

Step-by-Step Guide

Step 1: Identify the Distribution and Check WSL

  • Open Start, type PowerShell, and select Windows PowerShell or PowerShell.
Start search results with PowerShell selected
  • Run:
   wsl --list --verbose

Find the distribution you want to move. Copy its exact NAME, including any version suffix, and confirm its VERSION is 2. For example, Ubuntu-24.04 and Ubuntu are different names. An asterisk marks the current default distribution; it is not part of the name.

PowerShell output from wsl --list --verbose with the distribution NAME and VERSION 2 highlighted
  • Check the installed WSL package and available commands:
   wsl --version
   wsl --help

Check whether wsl --help lists --export (--vhd or --format vhd), --import-in-place, and --manage <Distribution> --move <Location>. Microsoft’s WSL export and import workflow lets you verify a separate backup VHD on the destination drive before removing the original registration, while --manage --move (when listed by wsl --help on your installed build) relocates the distribution’s ext4.vhdx into an existing destination directory in one step.

PowerShell showing wsl --version and the installed WSL command help

Expected result: You know the exact distribution name, have confirmed VERSION 2, and can see which commands your WSL installation supports. If wsl --version or a needed option is unrecognized, see Tips and Troubleshooting before continuing.

Step 2: Check Free Space and Prepare the Destination

  • Open File Explorer > This PC. Check the available space on C: and on your destination drive. Note the figures so you can compare them after the move.
File Explorer This PC showing available space on C: and the destination drive
  • In PowerShell, create a folder for the distro’s new virtual disk. Replace D: and Ubuntu if needed:
   New-Item -ItemType Directory -Path "D:\WSLDistros\Ubuntu" -Force
  • Open that folder in File Explorer to confirm you can access it:
   explorer.exe "D:\WSLDistros\Ubuntu"
File Explorer showing the empty D:\WSLDistros\Ubuntu destination folder

Expected result: The destination folder opens, and the drive has room for the export. A local drive with adequate free space is the straightforward choice; do not count on an unavailable removable drive or network location for a distro you need every day.

Direct Move Option (When Supported by wsl --help): Use wsl --manage --move

If wsl --help on your PC lists --manage <Distribution> --move <Location>, you can relocate the distribution into the existing destination folder you created in Step 2 (D:\WSLDistros\Ubuntu) after stopping WSL:

wsl --shutdown
wsl --manage "Ubuntu" --move "D:\WSLDistros\Ubuntu"

Here the <Location> argument is the destination directory (D:\WSLDistros\Ubuntu, created in Step 2), and WSL moves the distribution’s ext4.vhdx file into that folder automatically. Wait for the command to finish, then jump to Step 6 to launch the distro and confirm that C: space was recovered. Because Microsoft’s core WSL command reference and FAQ focus on export/import and --import-in-place, follow Steps 3–5 below if you want a staged workflow that verifies an exported ext4.vhdx file and hash on D: before removing the C: registration, or if your installed WSL build does not list --move.

Step 3: Stop WSL and Export the Virtual Disk

  • Save work in Linux apps and close their terminals.
  • Stop running WSL distributions:
   wsl --shutdown
  • Export the chosen distro as a VHD. Use the exact name from Step 1:
   wsl --export "Ubuntu" "D:\WSLDistros\Ubuntu\ext4.vhdx" --vhd

(Note: Microsoft’s basic-commands reference documents --vhd, while newer WSL releases and the WSL FAQ also accept --format vhd: wsl --export "Ubuntu" "D:\WSLDistros\Ubuntu\ext4.vhdx" --format vhd.)

Wait until PowerShell returns to its prompt. Match whichever flag (--vhd or --format vhd) appears in wsl --help on your PC. If your WSL build predates VHD export support entirely, update WSL first (see Fix #1) or use the TAR workflow in the Configuration section instead. Do not unregister the distro yet.

Expected result: The export finishes without an error, and D:\WSLDistros\Ubuntu\ext4.vhdx exists. Exporting creates a copy; your original distro is still registered on C:.

Step 4: Check the Export Before Removing the Original

  • Inspect the exported file:
   Get-Item "D:\WSLDistros\Ubuntu\ext4.vhdx"

Confirm the file name, location, and a size that makes sense for your distro. An empty or unexpectedly tiny file is a reason to stop and investigate.

PowerShell Get-Item output showing the completed ext4.vhdx export, path, and file size
File Explorer showing the completed ext4.vhdx file in the destination folder with its size visible
  • For a separate recovery copy, copy the exported VHD to a different drive, such as an external SSD. Adjust E: to match your backup drive:
   New-Item -ItemType Directory -Path "E:\WSLBackups" -Force
   Copy-Item "D:\WSLDistros\Ubuntu\ext4.vhdx" "E:\WSLBackups\Ubuntu-before-move.vhdx"
  • If you made that copy, compare the two files’ hashes:
   Get-FileHash "D:\WSLDistros\Ubuntu\ext4.vhdx"
   Get-FileHash "E:\WSLBackups\Ubuntu-before-move.vhdx"

The Hash values should match. This checks that the copied files have the same contents. It does not prove that a VHD will import and boot, so keep the separate copy until you have launched and checked the moved distro.

Safety checkpoint: Continue only if the export command completed without an error, Get-Item finds a plausible VHD file, and any backup copy you made matches. wsl --unregister deletes the original distribution’s Linux files from its current registration. Microsoft’s WSL installation documentation warns that unregistering a distribution permanently removes its data.

Step 5: Unregister the Original and Register the VHD on the New Drive

  • Confirm once more that no Linux app has reopened, then run:
   wsl --shutdown
  • Unregister only the distribution you exported. Replace Ubuntu with the exact name you checked:
   wsl --unregister "Ubuntu"

This is the destructive step. If the name is wrong, stop and check wsl --list --verbose again before running it.

  • Register the exported VHD where it sits on the destination drive:
   wsl --import-in-place "Ubuntu" "D:\WSLDistros\Ubuntu\ext4.vhdx"

Do not move or delete that VHD afterward: it is now the distribution’s working disk.

Expected result: WSL accepts the import without an error. The original registration has been removed, and the distribution is registered from the VHD on D:.

Step 6: Launch the Distro and Confirm the Move

  • List distributions again:
   wsl --list --verbose

Confirm your distro appears under its expected name with VERSION 2.

  • Launch it:
   wsl --distribution "Ubuntu"

Check that familiar files and installed tools are present. In the Linux shell, these basic checks show your current user and home directory:

   whoami
   pwd
   ls /home
PowerShell showing the imported distro listed as VERSION 2 and a successful Linux launch
  • Type exit to return to PowerShell. Then open File Explorer > This PC and compare free space on C: and D: with the figures from Step 2.
File Explorer This PC showing available space on C: and the destination drive after the move

Expected result: The distro launches with your files, its VHD remains on D:, and C: shows more available space once the original distribution’s storage has been removed. Keep your separate backup until you have used the imported distro long enough to trust it.

Configuration: Choose the Right Import Method

The VHD method keeps the exported virtual disk in place. That makes the destination path important: D:\WSLDistros\Ubuntu\ext4.vhdx is the live disk after wsl --import-in-place.

If VHD export or import in place is unavailable on your WSL installation, Microsoft also documents a TAR export and import workflow. A TAR file is an archive used to create a new distro installation folder. Use a separate export folder so the archive does not sit inside the installation folder:

New-Item -ItemType Directory -Path "D:\WSLExports" -Force
New-Item -ItemType Directory -Path "D:\WSLDistros\Ubuntu" -Force
wsl --shutdown
wsl --export "Ubuntu" "D:\WSLExports\Ubuntu.tar"
Get-Item "D:\WSLExports\Ubuntu.tar"

Check that the export completed and that the TAR file has a plausible size. If you can, keep a separate copy. Only then unregister and import:

wsl --unregister "Ubuntu"
wsl --import "Ubuntu" "D:\WSLDistros\Ubuntu" "D:\WSLExports\Ubuntu.tar" --version 2
wsl --list --verbose
wsl --distribution "Ubuntu"

The TAR archive is a backup artifact, while the imported distro uses files in D:\WSLDistros\Ubuntu. Check your Linux files and user after import before deleting the TAR. See Microsoft’s WSL FAQ for the export and import commands.

Tips and Troubleshooting

Fix #1: Update WSL When an Option Is Missing

  • Run wsl --version and wsl --help again to confirm what your installed package supports.
  • Update WSL:
   wsl --update
  • If the normal update route is unavailable, Microsoft also documents:
   wsl --update --web-download
  • Reopen PowerShell and check wsl --help. Use the TAR workflow above if the VHD options remain unavailable.

Fix #2: Stop a Distro That Is Still Running

  • Close Linux terminals, editors connected to WSL, and Linux programs.
  • Run:
   wsl --shutdown
  • Retry the export. If it still reports that the distro is busy, check wsl --list --verbose for its state before proceeding.

Fix #3: Correct a Distribution Name or File Path

  • Copy the name exactly as wsl --list --verbose displays it. Do not include the asterisk that marks the default distro.
  • Confirm the export file exists at the path you plan to import:
   Get-Item "D:\WSLDistros\Ubuntu\ext4.vhdx"
  • Keep paths in quotes when they contain spaces. If the destination drive letter changed, correct the path before trying the import.

Fix #4: Use a Folder You Can Write To

  • In File Explorer > This PC, confirm the destination drive is connected and has space.
  • Open the destination folder in File Explorer. If Windows reports access denied, choose a local folder your Windows account can write to and repeat the export with that path.

Fix #5: Check Your Linux User After Import

  • Launch the imported distro and run whoami and ls /home.
  • If whoami says root (common after a TAR --import), check that your regular username appears under /home, then restore it as the default user in /etc/wsl.conf inside the Linux shell:
   sudo tee -a /etc/wsl.conf << 'EOF'
[user]
default=your_username
EOF

Replace your_username with the folder name from /home, exit the shell, run wsl --terminate "Ubuntu" in PowerShell, and launch the distro again so whoami returns your normal account.

Fix #6: Check Why C: Is Still Full

  • In File Explorer > This PC, compare C: free space with the amount you noted before the move. Windows 11 also shows categories under Settings > System > Storage.
Windows 11 Settings System Storage showing C: storage categories
  • Run wsl --list --verbose to see whether another distro remains on C:. Confirm that the moved distro launches from its new registration before removing any other files.
  • Remember that moving ext4.vhdx relocates the virtual disk without shrinking unused blocks inside it. To reclaim unused internal space after deleting files in Linux (and confirming your backup copy is safe), shut down WSL (wsl --shutdown) and either enable sparse VHD mode when supported by wsl --help (wsl --manage "Ubuntu" --set-sparse true), run Optimize-VHD -Path "D:\WSLDistros\Ubuntu\ext4.vhdx" -Mode Full from an elevated PowerShell prompt on Windows editions where the Hyper-V PowerShell module is installed, or use built-in diskpart (select vdisk file="D:\WSLDistros\Ubuntu\ext4.vhdx" -> attach vdisk readonly -> compact vdisk -> detach vdisk) on editions without Hyper-V.

Wrapping Up

The staged --export --vhd and --import-in-place workflow lets you verify a backup ext4.vhdx file on your destination drive before removing the C: registration, while wsl --manage <Distribution> --move <Location> provides a one-command folder relocation when listed by wsl --help on your installed build. If your WSL build does not support VHD options, update WSL first or use the TAR export/import workflow and set [user] default= in /etc/wsl.conf if needed.