placeholderMove WSL to Another Drive

··

Move WSL to Another Drive

Move an installed WSL distribution to another drive by exporting, unregistering, importing, and restoring the default user.
—

Steps

# List installed WSL distributions$ wsl -l -v  NAME                   STATE           VERSION* docker-desktop-data    Stopped         2  Ubuntu-24.04           Running         2  docker-desktop         Stopped         2  Arch                   Running         2# Export the current distribution$ wsl --export Arch E:\wsl\Arch.tarExport in progress, this may take a few minutes.The operation completed successfully.# Unregister the original distribution$ wsl --unregister ArchUnregistering.The operation completed successfully.# Import it to the new location$ wsl --import Arch e:\wsl\Arch e:\wsl\Arch.tarImport in progress, this may take a few minutes.The operation completed successfully.# Set the default user and start Arch$ Arch config --default-user efterklang$ wsl -d Arch fastfetch                            gjx@Efterklang OS             ➜   Arch Linux 20240101.0.204074 x86_64│ ├ Kernel      ➜   Linux 5.15.146.1-microsoft-standard-WSL2│ ├󰏖 Packages    ➜   190 (pacman)│ └ Shell       ➜   fish 3.7.1󰧨 LM             ➜   login (TTY)│ ├ Terminal    ➜   WezTerm 20240203-110809-5046fc22 PC             ➜   Windows Subsystem for Linux - Arch│ ├ CPU         ➜   AMD Ryzen 7 5800H (16) @ 3.19 GHz│ ├󰍛 GPU         ➜   NVIDIA GeForce RTX 3060 Laptop GPU (5.87 GiB) [Discrete]│ ├󰍛 GPU         ➜   AMD Radeon(TM) Graphics (1.98 GiB) [Integrated]│ ├󰋊 Disk        ➜   2.09 GiB / 1006.85 GiB (0%) - ext4│ ├󰋊 Disk        ➜   165.95 GiB / 200.00 GiB (83%) - 9p│ ├󰋊 Disk        ➜   101.74 GiB / 275.69 GiB (37%) - 9p│ ├󰋊 Disk        ➜   166.97 GiB / 475.45 GiB (35%) - 9p│ ├ Memory      ➜   793.43 MiB / 6.71 GiB (12%)│ ├󰓡 Swap        ➜   0 B / 2.00 GiB (0%)│ ├󰅐 Uptime      ➜   7 seconds󰩟 Local IP       ➜   113.54.240.64/19󰩟 Public IP      ➜   89.116.88.203 (Tokyo, JP)