I'm not going to try to understand the logic as to why APFS requires free space in order to delete files (via any method, including dd)
All my servers have an 8 GB empty file on disk
661–670 of 715 posts
Re: All my servers have an 8 GB empty file on disk
#662Earlier quoted context omitted.
Top management doesn’t “owe” them any money when they need it later. Say you budget $100 for dinner tonight and you go out and it costs $75. Do you owe the restaurant $25? While certainly some people might roll the $25 into the next day’s meals, some people might allocate that $25 to another cost center like buying a new car. Budgets are meant to estimate costs and manage cash flow. From a greedy team perspective it’…
> Say you budget $100 for dinner tonight and you go out and it costs $75. Do you owe the restaurant $25? No, but if you accurately forecast that dinner will cost $100 on average , and this time it only happened to cost $75, you should put most of the savings aside for the other times when it will cost $125 and not reallocate it to be spent on something else. Consistent over-budgeting is still an issue which would nee…
For example, if a team says they need $100 a year and comes in at $90 then I don’t think next year’s budget should be $110 while some people in this thread think it should be. That makes no sense. Neither do I think the budget should be cut to $90. Unless something has changed, the budget should stay the same.
Your point about average cost just means that you’re budgeting on the wrong timeframe. If you estimate your average dinner is $100 but you’re spending $75 most of the time except for one huge dinner every month then you should be budgeting $75 for dinner and then budget separately for one large dinner a month. Similarly, if a team says they need $10MM a year but half of that is them trying to amortize a $25MM cost over 5 years then they are budgeting incorrectly. Their budget should be $5MM with a $25MM side fund contributed to on a risk adjusted basis.
The worst case scenario is the team budgeting $10MM when they only need $5MM and losing control of their budget so that when the real charge comes due they’re fucked because they’ve been spending $10MM for the past 5 years without realizing the fixed charge is coming or, worse, realizing the fixed charge is coming but just ignoring it so they can buy new office furniture and exhaust their budget this year selfishly.
Re: All my servers have an 8 GB empty file on disk
#663A fun problem on a Mac is that if you're using APFS for your filesystem, if it fills up, you can't delete any files. It's caught me out a handful of times, and each time, the only way to recover is to reboot, and thankfully I've had more free disk space after a reboot. I'm not going to try to understand the logic as to why APFS requires free space in order to delete files (via any method, including dd)
They work by appending to the log then compacting sometime later, not modifying things in-place. As such, you always need a reasonable supply of free blocks so this can occur.
Re: All my servers have an 8 GB empty file on disk
#664Earlier quoted context omitted.
Have you ever thought of just accepting that you can't predict how long a project will take to complete? It's a revelation. You get to have some hard conversations with other managers. But in the end everyone finds it easier to deal with "it'll be ready when it's ready" rather than endless missed deadlines and overruns.
This never worked in 15+ years I've been working. The people who did try that went out the door very soon once management realised some other person could tell them a date and they could plan their business around that date even though that date half of the time got missed anyhow.
Re: All my servers have an 8 GB empty file on disk
#665Earlier quoted context omitted.
>You have an easy way to fix it, just delete the spacer file. But what good does that do? You solve the issue right then and there. Step 1. realize there is a space issue and get to terminal Step 2. free space so any solution has memory Step 3. Solve by doing
So if your alarm sounded when there was 8 GB of free disk space (instead of 0 GB), then you could still respond in the same amount of time and you would still have an additional 8 GB worth of padding while you determined the root cause. The only difference is that you wouldn't need to actually go in and delete the spacer file (and potentially have downtime in the time it takes you to delete the spacer file). Another…
Also, forcing manual intervention has a psychological effect. An alarm that goes off at 8 GB remaining? Eh, I'll get to it at some point. A "disk is full, error, error, everything is broken"? I will deal with it -right now-, especially since I know a fix. Do that, with an alarm at 16 GB (so I still get the early alert in the event I'm that good a citizen and actually prioritize getting to the bottom of it even though it's caused no issue yet), and I'm in a better position still.
Re: All my servers have an 8 GB empty file on disk
#666Basically it lets you knock 8 GB or more (although it's a percentage instead, 5% by default) off of the disk space available to non-root users.
When it hits 100% and things start breaking, that reserve can be used by root to do compression safely, move things around, and so on. Alternatively the reserve percentage can be changed with a single command (by root), to allow non-root processes more space while the admin contemplates what do do next.
One nice aspect of using the reserve instead of a file is that it prevents runs of "du" for including the file in their results. Another is that it's pretty much impossible to accidentally remove the reserve (or for some other admin to find it and decide it's superfluous).
This is less effective at sites that have a lot of services running as root, in which case only your approach is fully effective. I want to say "But who does that nowadays...", but it happens.
tune2fs apparently also supports allowing members of a certain unix group or user to have access instead of solely root.
The core command for all this is:
tune2fs -m
One other thing you might want to worry about: inode exhaustion. tune2fs has an inode reserve % as well - and trying to emulate this by creating a few hundred thousand files instead would be... inelegant.Re: All my servers have an 8 GB empty file on disk
#667Earlier quoted context omitted.
Motorboat fuel tanks have a reserve as well. It's just a raised area that splits the bottom of the tank into 2 separate concave areas. One of the concave areas contains the end of the fuel line, and the other doesn't. When you run out of gas, you tip the tank up to dump the remaining gas from the other basin into the main one, and then you restart the engine (or keep it from stopping at all if you're quick enough on…
Old SCUBA tanks didn't have gauges, they had a reserve tank with enough air to get you to the surface. You'd realize you were running low (which I'm sure was terrifying) then hit the switch and slowly surface (you don't want to surface quickly when diving).
Re: All my servers have an 8 GB empty file on disk
#668Earlier quoted context omitted.
Perfect example of the tragedy of the commons. If individuals don't create these balloon files then they won't be able to use the file server when they need it, yet by creating these balloon files the collective action depletes the shared resource of its main function.
This is similar to how some government agencies retain their budgets. At the end of the budget period they've only spent 80% of their allocated budget, so they throw out a bunch of perfectly good equipment/furniture/etc. and order new stuff so that their budget doesn't get cut the following year, rather than accepting that maybe they were over-budgeted to begin with. Rinse, repeat, thus continuing the cycle of wastin…
Re: All my servers have an 8 GB empty file on disk
#669Earlier quoted context omitted.
The difference is that market mechanisms are meant to allocate items to those that value them the most (assumed to be the same as their willingness to pay). Claiming a licence by contrast has little cost.
In reality it's not the person that values it the most, but the person willing to pay the most money. That's not the same even if we ignore the ability to afford something, because the marginal value of money isn't constant: To a millionaire $80 is much less than for someone earning minimum wage.
The millionaire just has a longer history of already having given things up to amass that much money which they can draw on in exchange for goods later. (Or, in the case of gifts/inheritance, others gave things up on their behalf and for their benefit—which amounts to the same thing.) That's exactly what money represents: more value provided to others than the owners have claimed for themselves.
Re: All my servers have an 8 GB empty file on disk
#670Earlier quoted context omitted.
> So log in as root and fix the issue. Simple. "just fix the issue" often takes longer than 'rm spacer.img', which allows non-root processes to begin working immediately. In practice, the 5% root reserve is not really an effective substitute for OP's technique.
Running `tune2fs -m 0 /dev/sdaX` as root instantly makes the reserved blocks available. You could even just lower it by 1% which would be more than sufficient in the meantime: `tune2fs -m 4 /dev/sdaX`. When you've fixed the issue and freed up space, you can increase it to 5% again. So why would you bother making a blank file? :)
but I'll absolutely have 'rm spacer.img' memorized.
(edit: also, if you truly set -m to zero, and you fill up again, now you can't even ssh in as root...)