Live data from Hacker News

How to free up and automatically manage disk space for WSL

freecodecamp.org

31–40 of 55 posts

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

#31
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

Well, this just means PCs are all over the place and it's hard to know what you get beforehand.

My experience is the exact opposite. When I let my laptop running windows sleep overnight, in the morning it's warm. Under Linux, it's room-temperature. I rarely run Windows on it, so there's no checking for mail or whatever in the background, I only have 2-3 games, Prime Video and Lightroom installed. It's also kept up to date, so no updates to install.

But, at least it now wakes back up. Up until a few months ago, it would randomly freeze up or die and reboot and get stuck at the Linux ZFS decryption prompt (I dual boot, and Linux is first). This is a 2020 model laptop, which didn't work under a fresh Windows install out of the box. The webcam wasn't working for a good 3 years (apparently some USB chip wasn't detected). The only issue I have under Linux is that the mic mute LED sometimes turns off even though the mic is muted. It's a standard-fare HP Enterprise, no dual GPU or anything fancy.

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

#33
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 desperately doing it a different way. I managed to beat off our corporate IT overlords and kept hold of windows 10 for a long time. I'm using that, virtualbox with debian in it and PuTTY. Far more reliable than WSL. I will switch to windows 11 at the last moment and spend a week doing exactly the same there.

They won't let me have a Linux box because I'm supposed to be a windows desktop dev (now about 10% of my workload) and they don't like Linux because none of the invasive security and VPN crap they add works on it.

I use a Mac at home. Mostly proper Unix at your fingertips. Feels much less dirty than either solution.

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

#34
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

Yeah been there. My company issue laptop cooked itself to death once in my bag when I was on the train to a customer.

I was pleasantly surprised when I bought a Mac (M1 MBP) a few years ago. It doesn't have all the idiot behaviours that Windows and Linux seems to have. It's so boring. It just works. If the Linux/Windows folk can nail that quality down it'd be nice but I have my doubts it'll ever happen (after trying for about 30 years!)

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

#35
post #5

Earlier quoted context omitted.

At work I asked for a remote server and my pc is just a terminal to use ssh & xwindows.

I also considered this, but I was not able to solve the security problems. That remote server must (or not?) hold all my SSH keys, AWS creds, and other stuff, to even be useful. Secops guys would kill me for this. Until then, WSL is good enough.

Our secops guys broke most of our laptops so the engineering teams can't use them for development. They told them to use a Hyper-V VM. So they do. With a Hyper-V vswitch that talks directly to the ethernet adapter rather than the VPN connection. So effectively their policy leads to all those SSH keys, AWS credentials and other stuff to be stored on a virtual machine which is connected directly to the public internet and bypasses all DLP and security controls.

The more I work with secops people the more I fail to trust or respect them.

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

#36
post #30

Actually great intro for step-by-step powershell scripting. I thought I didn't know about "Throw-And-Exit" command, but no, my powershell doesn't have that and google also doesn't know a thing, so wonder what's up with that. And instead of manual confirmations, one can write script with ShouldProcess support to have support for builtin -Confirm/-WhatIf/-Force parameters. And it would actually be a great use case for…

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

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

#37

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…

No such thing needez, just alias ssh to ssh.exe and ssh-add to ssh-add.exe and it works out of the box.

aliasing the ssh.exe generally works, but not for all applications. I had issues with this approach while running ansible playbooks ("getsockname failed: Not a socket").

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

#38
post #30

Actually great intro for step-by-step powershell scripting. I thought I didn't know about "Throw-And-Exit" command, but no, my powershell doesn't have that and google also doesn't know a thing, so wonder what's up with that. And instead of manual confirmations, one can write script with ShouldProcess support to have support for builtin -Confirm/-WhatIf/-Force parameters. And it would actually be a great use case for…

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.

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

#39
post #7

I think Optimize-VHD will do the same thing as messing with diskpart. It's a shame you can't just turn on live TRIM support. This kind of disk image is a bunch of multi-megabyte blocks of data, plus a list of where each block goes on the virtual disk. Implementations can support TRIM by deleting the block that's zeroed and moving the block at the end of the file into that spot. VirtualBox can do this, shrinking the f…

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.

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

#40
post #8

Earlier quoted context omitted.

Hm, are you using native Windows RDP? That one has pretty low latency even in the default configuration (assuming a capable client).

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).
Post reply on HN