# Resize VHD
# ###############
# see: https://docs.microsoft.com/en-us/windows/wsl/vhd-size
#
#1 open powershell as admin
#Terminate WSL
wsl --shutdown#find your distribution installation packageGet-AppxPackage -Name "*Ubuntu*" | Select PackageFamilyName#Copy the path to that file, it should look something like %LOCALAPPDATA%\Packages\CanonicalGroupLimited.Ubuntu20.04onWindows_79xxxx\LocalState\ext4.vhdx# This path will be called "<pathToVHD>" below# -------------------------#start diskpartdiskpart# ----------#inside diskpart console#select diskDISKPART> Select vdisk file="<pathToVHD>"#check detailsDISKPART> detail vdisk#expand for example to 512GB <sizeInMegaBytes>=512000DISKPART> expand vdisk maximum=512000 #exitDISKPART> exit# ----------#start WSL from powershellsudo mount -t devtmpfs none /dev# "/dev: none already mounted on /dev." warning can be ignoredmount | grep ext4#resize fs to 512GB <sizeInMegaBytes>=512000Msudo resize2fs /dev/sdb 512000M |