banner
Matrix

Matrix

Abyss
email
github

Extend WSL2

When creating a Linux distribution through WSL2, it defaults to 1T of space. Yesterday, while creating a dataset, it filled up directly. Using df -h to check:

Filesystem      Size  Used Avail Use% Mounted on

/dev/sdc       1007G  956G     0 100% /

Expansion#

Windows Operation#

Open PowerShell as an administrator and open Disk Management:

diskpart

After entering DISKPART >, select the disk:

Select vdisk file = "Z:\Ubuntu\ext4.vhdx"

Expand allocation (in MB):

expand vdisk maximum=248000

Exit

exit

Linux Operation#

Mount devtmpfs to /dev to manage device files:

sudo mount -t devtmpfs none /dev
List the ext4 device mount points:

mount | grep ext4
Obtain the ext4 disk mount point, similar to the format of /dev/sdc.

Adjust the disk space size, in MB:

sudo resize2fs /dev/sdc 2048000M
Check again and find that it has been successfully expanded with df -h.

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.