Skip to content

WSL2 Instance Migration (Fedora 43)

To move a WSL2 distro from C: to another drive, export it to a tar file with wsl --export, unregister the original, then re-import it at the new location with wsl --import. After import you'll need to fix the default user — WSL always resets it to root on import, which you patch via /etc/wsl.conf.

The Short Answer

wsl --terminate Fedora-43
wsl --export Fedora-43 D:\fedora_backup.tar
wsl --unregister Fedora-43
mkdir D:\WSL\Fedora43
wsl --import Fedora-43 D:\WSL\Fedora43 D:\fedora_backup.tar --version 2

Then fix the default user — see Steps below.

Background

WSL2 stores each distro as a VHDX on whatever drive it was installed to, which is C: by default. If you're running Unsloth fine-tuning runs or doing anything that generates large files in WSL2, C: fills up fast. The migration is straightforward but the import resets your default user to root, which you have to fix manually.

Steps

  1. Shut down the instance cleanly
wsl --terminate Fedora-43
  1. Export to the destination drive
wsl --export Fedora-43 D:\fedora_backup.tar
  1. Remove the C: instance
wsl --unregister Fedora-43
  1. Create the new directory and import
mkdir D:\WSL\Fedora43
wsl --import Fedora-43 D:\WSL\Fedora43 D:\fedora_backup.tar --version 2
  1. Fix the default user and enable systemd — edit /etc/wsl.conf inside the distro
[boot]
systemd=true

[user]
default=majorlinux
  1. Restart WSL to apply
wsl --shutdown
wsl -d Fedora-43

Gotchas & Notes

  • Default user always resets to root on import — this is expected WSL behavior. The /etc/wsl.conf fix is mandatory, not optional.
  • Windows Terminal profiles: If the GUID changed after re-registration, update the profile. The command line stays the same: wsl.exe -d Fedora-43.
  • Verify the VHDX landed correctly: Check D:\WSL\Fedora43\ext4.vhdx exists before deleting the backup tar.
  • Keep the tar until verified: Don't delete D:\fedora_backup.tar until you've confirmed the migrated instance works correctly.
  • systemd=true is required for Fedora 43 — without it, services (including Docker and Ollama in WSL) won't start properly.

Maintenance Aliases (DNF5)

Fedora 43 ships with DNF5. Add these to ~/.bashrc:

alias update='sudo dnf upgrade --refresh'
alias install='sudo dnf install'
alias clean='sudo dnf clean all'

See Also

  • [[Managing disk space on MajorRig]]
  • [[Unsloth QLoRA fine-tuning setup]]