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
2) Shut down wsl
wsl --shutdown
3) Export Debian to your desired location
In my case its E :
wsl --export Debian E:\wsl_export\debian-ex.tar
4) Now unregister your old Debian from wsl
wsl --unregister Debian
5) Now import Debian to the Disk
wsl --import Debian "E:\wsl\Debian" "E:\wsl_export\debian-ex.tar"
6) 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
Top comments (2)
Question: Isn't there something similar but in Linux, to be able to install Windows programs?
I don't want the wine program
Not that I am aware of if wine is not an option ! Wondering about the usecase though