CHEMPUTE

A personal publication on computational chemistry/physics, AI-ML tools and different methods used…

Follow publication

Member-only story

Reclaiming Disk Space from WSL2: A Personal Experience

Image generated by Leonardo.Ai

As an avid user of the Windows Subsystem for Linux (WSL2), I often find myself working with large files and datasets within my Ubuntu environment. However, after deleting some of these files, I noticed that the disk space wasn’t being released, which was frustrating. Fortunately, I discovered a solution to reclaim the disk space from my WSL2 virtual disk, and I’m excited to share my experience with you.

The Problem

After working on a project that involved processing and analyzing large datasets, I ended up with several gigabytes of files stored within my WSL2 instance. Once the project was completed, I deleted these files to free up space. However, to my surprise, the disk space wasn’t being released, even after restarting WSL2.

This issue can occur because WSL2 uses a virtual hard disk (VHDX) file to store its file system. When you delete files within WSL2, the space is marked as available within the file system, but the VHDX file itself doesn’t shrink automatically. This means that the disk space isn’t actually reclaimed on your host machine.

The Solution: Compacting the VHDX File

After some research, I stumbled upon a solution that involved using the “diskpart” tool to compact the VHDX file. This process allows you…

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

CHEMPUTE
CHEMPUTE

Published in CHEMPUTE

A personal publication on computational chemistry/physics, AI-ML tools and different methods used in chemistry and materials science.

Aritra Roy
Aritra Roy

Written by Aritra Roy

PhD Student at LSBU, UK | Designing Future Materials Using AI-ML | Passionate about Computational Materials Science | Combining Science & Technology ⚛️💻📚

No responses yet

Write a response