Horizournal logo

Install Debian in Different Location -WSL Windows

Windows + WSL

I was trying to install Debian in different location rather than the C drive . Sharing the steps I took .

OS : Windows 11 WSL Version : Wsl 2

  1. First install Debian as by default in C
wsl --install -d Debian
  1. Shut down wsl
wsl --shutdown
  1. Export Debian to your desired location

In my case its E :

 wsl --export Debian E:\wsl_export\debian-ex.tar
  1. Now unregister your old Debian from wsl
wsl --unregister Debian
  1. Now import Debian to the Disk
wsl --import Debian "E:\wsl\Debian" "E:\wsl_export\debian-ex.tar"
  1. Cleanup You can remove your backup now and set Debian as default
wsl --set-default Debian

Extra tips

  • To make your user in debian superuser : After migrating you might loose your default login using username you created before .

Login to Debian , By default you will be logged in as root and hit following

sudo usermod -aG sudo username
  • Change default user
nano /etc/wsl.conf

Replace username with your username

[user]
default=username

Now wsl --shutdown and login debian again you should be logged in as your default user with sudo access