Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wsl --manage Alpine --set-sparse true # No result for auto disk space clean up (Set sparse VHD) #10703

Open
1 of 2 tasks
kryszek opened this issue Nov 1, 2023 · 11 comments
Open
1 of 2 tasks

Comments

@kryszek
Copy link

kryszek commented Nov 1, 2023

Windows Version

Microsoft Windows [Version 10.0.22621.2428]

WSL Version

2.0.6.0

Are you using WSL 1 or WSL 2?

  • WSL 2
  • WSL 1

Kernel Version

Linux version 5.15.133.1-microsoft-standard-WSL2 (root@1c602f52c2e4) (gcc (GCC) 11.2.0, GNU ld (GNU Binutils) 2.37) #1 SMP Thu Oct 5 21:02:42 UTC 2023

Distro Version

Alpine distribution, MINI ROOT FILESYSTEM, x86_64, "alpine-minirootfs-3.18.4-x86_64.tar.gz"

Other Software

No response

Repro Steps

WSL - Automatic disk space clean up (Set sparse VHD)

I followed the topic:

Import any Linux distribution to use with WSL
https://learn.microsoft.com/en-us/windows/wsl/use-custom-distro

  1. Obtain from "https://alpinelinux.org/downloads/" a tar file for the Alpine distribution, MINI ROOT FILESYSTEM, x86_64, alpine-minirootfs-3.18.4-x86_64.tar.gz.

  2. Import the tar file into WSL

wsl --import Alpine D:\wslDistroStorage\Alpine .\alpine-minirootfs-3.18.4-x86_64.tar.gz

  1. Then, based on page "Windows Subsystem for Linux September 2023 update"
    https://devblogs.microsoft.com/commandline/windows-subsystem-for-linux-september-2023-update/#automatic-disk-space-clean-up-set-sparse-vhd

Update WSL to pre-release:

wsl --update; wsl --update --pre-release

  1. Close running WSL distros:

wsl --shutdown

  1. Set sparse vhd:

wsl --manage Alpine --set-sparse true

Where Alpine is an example distribution.

  1. Create .wslconfig file in %UserProfile% directory

C:\Users\UserName\.wslconfig

and add its content:

[wsl2]
[experimental]
sparseVhd=true

Now, test:

  1. Go into distro

wsl -d Alpine

  1. Go into linux home directory

cd ~

  1. Copy into it some large file from Windows system

cp /mnt/c/tmp/some-file-about-3GB-size .

  1. The distro

D:\wslDistroStorage\Alpine\ext4.vhdx

increased the size from about 100 MB to 3.5GB.

  1. Remove that file

rm some-file-about-3GB-size

  1. Wait several minutes and see if the distro reduced its size

D:\wslDistroStorage\Alpine\ext4.vhdx

Nothing happened.

Expected Behavior

Automatic disk space clean up

Actual Behavior

No disk space clean up

Diagnostic Logs

No response

@OneBlue OneBlue assigned ghost Nov 1, 2023
@dons20

This comment was marked as resolved.

@junxiant
Copy link

has there been any updates? when running my wsl2 i still get unused storage not cleaned out

image

@saydemr
Copy link

saydemr commented Jan 1, 2024

Any updates please?

@PeterTucker
Copy link

Bump

@itsklimov
Copy link

+1

1 similar comment
@bar10dr
Copy link

bar10dr commented Jan 22, 2024

+1

@memetrusidovski
Copy link

any fix yet? same issue

@Just-Like
Copy link

+1

@deaw0003
Copy link

I have the same issue wait for help.

@Shayens
Copy link

Shayens commented Mar 7, 2024

+1, and set sparse true leads the opend window blurred,
image

@ChGen
Copy link

ChGen commented Mar 18, 2024

I used wsl updates from --pre-release channel with sparseVhd turned on. I also called sudo fstrim -av there. And I've got filesystem corruptions in both, the WSL2 vhd ext4 filesystem and host NTFS filesystem. I'll stick to old combination of fstrim inside + compact vdisk on the host.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests