Skip to content

Instantly share code, notes, and snippets.

@Codes-Lab
Last active May 16, 2023 12:38
Show Gist options
  • Save Codes-Lab/1e7e35fc5da068447d30112a8d2a1729 to your computer and use it in GitHub Desktop.
Save Codes-Lab/1e7e35fc5da068447d30112a8d2a1729 to your computer and use it in GitHub Desktop.
Expand Docker Storage on WSL2

Identify the path to virtual disk of the docker

  • (default location: %LOCALAPPDATA%/Docker/wsl/data).

Start diskpart from the command line.

  • diskpart

Select disk by using the command

  • select vdisk file=

Grow the image by running expand command

  • expand vdisk maximum=

Shut down WSL2 by executing

  • wsl --shutdown

Restart Docker Desktop

Start WSL2 Linux shell (this automatically restarts WSL2 again) and execute the lsblk command

  • sudo lsblk

Identify the resized virtual disk (/mnt/wsl/docker-desktop-data/isocache, e.g. /dev/sdd in my case)

Grow the filesystem on the resized virtual disk by running resize2fs command

  • sudo resize2fs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment