Live data from Hacker News

How to free up and automatically manage disk space for WSL

freecodecamp.org

41–50 of 55 posts

Re: How to free up and automatically manage disk space for WSL

#41
post #3

I'm done with WSL. It just makes life too hard, dual disk is a problem, two network endpoints two firewalls, two different hypervisors you can choose from where some things expect one some the other. I used to think a windows laptop would be better for hardware management, maybe it is but I just gave up and installed Linux. My life is so much easier.

i'm the opposite of you, i'm so done with Linux on my laptop. I can't count how many time my machine cooks itself inside my bag when using Linux. Windows also has the same problem, but much less frequently. Now if i want linux, WSL2, and if i want linux graphic, Vmware or something similar

I have seen that with both Linux and Windows. And there are bugs like this https://bugzilla.mozilla.org/show_bug.cgi?id=1808039 that prevents sleep on Windows, but somehow does not exist on Chrome, or when you use Linux/Mac. I have determined that if battery is really important for a certain occasion, I just manually power the laptop off. Thankfully, these days laptops are fast enough to start make it tolerable.

Of course, I can't understand why Microsoft or Linux distribution contributors along with software vendors never manage to truly "fix" such important usability issues.

Re: How to free up and automatically manage disk space for WSL

#42
post #7

Earlier quoted context omitted.

It seems like just using a sparse file would make things simpler. I guess there would be potential inefficiency when you try to move the VM to another drive, but for just storing and using the VM in place it doesn't seem like this has to be hard: a TRIM inside the VM gets translated into a hole punch in the disk image file, which gets translated into a TRIM sent to the underlying storage.

rsync in Linux can move sparse files as efficiently as possible, but I don't know if there's an equivalent in Windows. It'd be very strange if there is not.

as far as i know robocopy should

Re: How to free up and automatically manage disk space for WSL

#43
post #3

I'm done with WSL. It just makes life too hard, dual disk is a problem, two network endpoints two firewalls, two different hypervisors you can choose from where some things expect one some the other. I used to think a windows laptop would be better for hardware management, maybe it is but I just gave up and installed Linux. My life is so much easier.

i bite the bullet, and moved to msys2. it requires a little more porting, but leads to better code in the long run IMHO

Re: How to free up and automatically manage disk space for WSL

#44
post #40

Earlier quoted context omitted.

Windows RDP used to be great, but now they figured they'd put animations and transparencies all over the place, so it's become very frustrating to use. Even over a local Gigabit network.

You can turn off effects to restore amazing performance (I know on the Mac version it’s the “optimize for retina displays” option).

I'm talking about effects on the server side. Launching edge for the first time is a major pain, for example.

Re: How to free up and automatically manage disk space for WSL

#45

Earlier quoted context omitted.

I’m also doing WSL-centric development and I’m not even really gaming on that machine, I just appreciate the comforts that come with competent multi monitor support and reliable wake from sleep. My biggest frustration with WSL at present is that 1Password won’t properly support proxying their ssh agent into it. (Though in googling it again just now, I see a suggestion to try something called npiperelay, so I’ll spend…

You can actually run the windows ssh.exe binary directly from WSL, no extra setup needed. Give it a try.

I’m aware that 1P themselves recommend this but I don’t like it; a lot of my usage is other things like git or docker or ansible calling ssh and I don’t want to deal with those things having to also be steered to an alternative ssh implementation.

Re: How to free up and automatically manage disk space for WSL

#48
post #10

Someone should really make a utility to make this easy if Microsoft won't do it.

There are two options mentioned out there: - https://github.com/brooks-code/WSL-VHDX-Compact - https://github.com/okibcn/wslcompact and probably (much) more on GitHub :)

Re: How to free up and automatically manage disk space for WSL

#49

I recently used https://github.com/okibcn/wslcompact to shrink a couple of WSL VHDX files, and it worked great. Looking at the source, it seems to use a `wsl --export` option rather than `diskpart`.

Exporting and re-importing the WSL distro is simpler and usually preferred. The tutorial and script are based on this conversation: https://superuser.com/questions/1606213/how-do-i-get-back-un... which mentions some issues with the re-import that includes the need to reset the default username.

Re: How to free up and automatically manage disk space for WSL

#50
post #38

Earlier quoted context omitted.

Throw-And-Exit is a custom function in the script @ https://github.com/brooks-code/WSL-VHDX-Compact/blob/main/ws...

Well in that case, a regular throw can be used. Don't see a need for custom function. From docs: > The throw keyword causes a terminating error. You can use the throw keyword to stop the processing of a command, function, or script.

good point
Post reply on HN