WSL vDisk
WSL2 vdisk management.
WSL 2 uses a Virtual Hard Disk (VHD) to store your Linux files. In WSL 2, a VHD is represented on your Windows hard drive as a .vhdx file. The WSL 2 VHD uses the ext4 file system. This VHD automatically resizes to meet your storage needs and has an initial maximum size of 256GB.
ncdu
du -h --max-depth=1 . | sort -h
or
sudo apt install ncdu
ncdu
Then press ?
for shortcuts.
“ncdu” stands for “NCurses Disk Usage”, where “NCurses” stands for “new curses”, where “curses” is a pun on the term “cursor optimization”, which is a library for TUI. - https://en.wikipedia.org/wiki/Ncdu - https://en.wikipedia.org/wiki/Ncurses - https://en.wikipedia.org/wiki/Curses_(programming_library)
detail vdisk
wsl --shutdown
diskpart
DISKPART> select vdisk file="C:\Users\songzy\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu20.04onWindows_79rhkp1fndgsc\LocalState\ext4.vhdx"
Windows use first 5 letters of our e-mail addresses as the name of our user account folders.
DISKPART> detail vdisk
Device type ID: 0 (Unknown)
Vendor ID: {00000000-0000-0000-0000-000000000000} (Unknown)
State: Added
Virtual size: 256 GB
Physical size: 141 GB
Filename: C:\Users\songz\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu20.04onWindows_79rhkp1fndgsc\LocalState\ext4.vhdx
Is Child: No
Parent Filename:
Associated disk#: Not found.
compact vdisk
# DISKPART> attach vdisk readonly
DISKPART> compact vdisk
# DISKPART> detach vdisk
DISKPART> exit
expand vdisk
https://docs.microsoft.com/en-us/windows/wsl/vhd-size
DISKPART> expand vdisk maximum=<sizeInMegaBytes>
DISKPART> exit
wsl.exe -l -v
sudo mount -t devtmpfs none /dev
mount | grep ext4
sudo resize2fs /dev/sdb <sizeInMegabytes>M