Increase WSL2 container size

Hi,
I have looked everywhere but I cannot find something useful.
I am using docker on W10.
My problem is that docker assigns a max of 251G to my container (webodm worker) despite assigning 400G to the Docker ext4.vhdx. I need the container to expand to the maximum available to docker.
What command can I use to increase the container disk size? Is it possible to guide docker to use the whole vhdx?

I am most certainly the wrong guy to answer that question, as I am only aware of the WSL2 side of the story - I don’t use DDfW, but I do use docker-ce on WSL2.

Is this realy a contraint given by docker for containers? Or did you grow the vhdx, and the partition size or filesystem size remained unchanged?

Inside the wsl distro you could check if this is the case:
– check the filesysten size: df
– check the blockdevice/partition size: sudo parted -l /dev/hd? and/or lsblk

If the sizes differ, you will need to grow the filesystem or even both. Before you ask: I don’t know the exact commands to grow a partition/filesystem in-place - though if what I suspect is the issue, then you should have the right keywords to google on it :slight_smile:

Hi,
Thanks for the answer but from what I understand docker is using the virtual disk to create volumes within it.
The virtual drive size was set before creating any image/container.
I need to increase the allowed size for a specific container but despite it having ample space to grow, it seems stuck.
On previous attempts, for smaller allocated size (less that 256G) the container grew automatically.

I think @meyay was right. I checked the size of the filesystem of two WSL distribution. Each of them has the root filesystem with the size of 251GB. Even though the size of my phisycal partition is less then that. So it looks like it is not a Docker specific issue, but WSL. The maximum "size of the container is the size of your disk on which you installed the Docker data folder. Of course it depends on the docker storage driver but this is the default.

If you could set a custom image to store docker data, the filesystem on that image could be smaller. Since the size of the particion is probably right inside the image (growpart could help if not), resize2fs could resize the filesystem to match the partition size.

I did not realize the way WSL works and holds the Docker root down. 256 is indeed a hard default in WSL2.
The command I used was wsl df -h and indeed /dev/sdb is only at 251GB. However, while the containers are well over 100GB the drive shows 238G as free!
Regardless, I think this should work: Expand the size of your WSL 2 Virtual Hard Disk | Microsoft Docs however I have no idea how to “launch the WSL Distro” as MS recommends or how to make Docker aware it can expand to finally resize it.
Any ideas?
Thanks

You don’t have to do anything special. WSL distros are automatically “launched” when you log in the distro. So just try to work on it as always. In case of docker desktop you could just start that and it starts the WSL distros.

Hi again,
So I did manage the commands
wsl -t devtmpfs none /dev
wsl mount
however, I find no way to grow the /dev/sdb size. The command:
(wsl) resize2fs /dev/sdb 500000M
does not work, with or without wsl nor does growfs
Can you help?