These are some of the frequently asked questions regarding WSL 2 (Windows Subsystem for Linux). WSL 2 is a massive improvement over WSL 1. WSL 2 brings Full System-Call Compatibility and Much Faster I/O Performance. If you want to know about how to install/upgrade to WSL 2, check out THIS link.

How to set Default Username in your distro ?

    Method 1: Using PowerShell
  • Open PowerShell and type the command: distroName config --default-user username


  • Method 2: Using your distro
  • Command: cd
  • Command: touch /etc/wsl.conf
  • Command: nano /etc/wsl.conf

  • Edit the wsl.conf file with the following:
    [user]
    default=username
    Save and Exit

  • Open PowerShell and type command: wsl --shutdown
  • Open your wsl distro to verify change.

How to MOVE your WSL distro (Version 1 or 2) to another drive (outside of C:) ?

Here I am MOVING my Ubuntu distro from C: drive to a folder in D: drive named "Ubuntu_20.04_LTS"

  • Open PowerShell
  • Command: cd D:\
  • Command: wsl --export Ubuntu ubuntu-wsl.tar
  • [This exports the curent wsl distro (Ubuntu) as a .tar file (ubuntu-wsl.tar in this case)]
  • Command: wsl --unregister Ubuntu
  • [This deletes/unregisters the current wsl distro (Ubuntu)]
  • Command: wsl --import Ubuntu .\Ubuntu_20.04_LTS\ .\ubuntu-wsl.tar
  • [This imports/creates a new wsl distro named "Ubuntu" inside the folder "Ubuntu_20.04_LTS" using the ubuntu-wsl.tar file]
  • Copy all your files into your home/username/ directory of your wsl distro
  • Command: wsl --set-version Ubuntu 2
  • [Converts the wsl distro from version 1 to 2]

How to increase the capacity of the wsl 2 distro (the vhdx capacity) ?

  • First check the current capacity of your distro with Command: df -h
  • Locate your vhdx file

    • It's (Ubuntu in my case) default location can be found by:
    • Open PowerShell to get the PackageFamilyName
    • Command: Get-AppxPackage -Name "*Ubuntu*" | Select PackageFamilyName
    • Locate the vhdx file: Open RUN > appdata > Local > Packages > PackageFamilyName > LocalState > disk.vhdx
  • Open PowerShell and type command: diskpart
  • Command: Select vdisk file="PathToVHDX"
  • Command: expand vdisk maximum="SizeInMB"
  • Command: Exit
  • Open PowerShell and type command: wsl --shutdown
  • Open your wsl distro (Ubuntu in my case)
  • Command: sudo mount -t devtmpfs none /dev
  • Command: mount | grep ext4 [Copy the name of the entry: /dev/sdXX]
  • Command: sudo resize2fs /dev/sdXX
  • If resize2fs is not installed then install by command: sudo apt install resize2fs
  • Open PowerShell and type command: wsl --shutdown
  • Open your wsl distro and type following command to verify the change: df -h

How to change Ownership and Write Permissions of a directory/folder in linux ?

  • Command: sudo chown -R username pathToDirectory
  • [Changes the Ownership]
  • Command: sudo chmod -R 755 pathToDirectory
  • [Changes the Write Permissions]

How to uninstall a wsl distro ?

  • Open PowerShell and type: wsl --unregister distroName
  • Then manually Uninstall the Microsoft Store App from the Start Menu or Windows Settings.