Docker Disk Space not sufficient in WSL2 (Solution)

Hi there,
I process large datasets (1.500-2.500 images, 48MP) and have run into this problem: The default 250GB of disk space in WSL2 is not enough to run even one project! Unlike WSL however there is no obvious way to increase that.
Caution! This will probably cause you to lose any work in progress.
WSL commands run in Powershell tab, the rest in a linux tab in windows terminal.

Let me get to it:

  • First thing you need to do is install a linux distribution from the windows app store i.e. Ubuntu 20.04 LTS.
  • Next install “windows terminal” because it can do it all.
    Now make it a WSL2 distro:
  1. Find out the name of your distro:
    wsl --list --verbose
Result

NAME STATE VERSION

  • docker-desktop-data Running 2
    docker-desktop Running 2
    Ubuntu-20.04 Stopped 2
  1. If your distro Version is 1, then run
    wsl --set-version <distro_name> 2

Quit Docker and run wsl --shutdown

Open Hyper-V Manager > Edit disk
Browse to C:\Users\[Your User]\AppData\Local\Docker\wsl\data
Select ext4.vhdx and follow the wizard to increase it to whatever size you like. It will not take all that space up from your drive, it will increase as it need to. Note down the new size in MB.

  • Start Docker (may need to run wsl --start first)

On windows terminal open a tab of your linux distro. This is where we run the rest of the commands.

  • sudo mount -t devtmpfs none /dev
    mount | grep /docker-desktop-data/isocache

The first result should start with /dev/sdX (X usually b or c, i.e. /dev/sdb)

  • sudo resize2fs /dev/sdb <sizeInMegabytes>M

You now have more space to process your flights. Diagnostics should show the new size as available disk space.

P.S.1 If you run multiple large projects, a dedicated drive of 1TB or more comes useful, especially if you want to keep them for a while.
P.S.2 Spilt projects take up huge space while running, almost 100GB per submodel and can fill up the space well before completing.

3 Likes

Hi, I just figured this is wrong, you need to run
wsl
instead

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.