Live data from Hacker News

All my servers have an 8 GB empty file on disk

brianschrader.com

221–230 of 715 posts

Re: All my servers have an 8 GB empty file on disk

#221

All my servers have an alarm when disk space goes above 70%. It sends an email every hour once the disk usage goes above 70%. Never had a server go down because of disk space issue after adopting this practise. Also one of the main reasons server disks go full is generally log files. Always remember to "logrotate" your log files and you will not have this issue that much. Yes one more thing, for all user uploaded fil…

Disk space for an active server is so cheap; why not alert at 30%?

Re: All my servers have an 8 GB empty file on disk

#222
post #166

The real question... Why does Linux or at least the common filesystems get stuck so easily running out of disk space? Surely normal commands like `rm` should still function.

> Surely normal commands like `rm` should still function They do. In my experience, the only disruption to most terminal operations is that tab completion will fail with an error.

They sometimes don't. The article even acknowledges this:

> Copy commands and even deletions can fail

I've had that happen too many times, so I don't know why would fill up my disk with a hacky spacer file, which surely can also fail to be deleted when the disk is already full.

Re: All my servers have an 8 GB empty file on disk

#224
post #190

Earlier quoted context omitted.

I still know people that pre-emptively buy toilet paper "because hoarders might buy the rest of it" with absolutely no introspection.

Hoarders will buy the rest of it. During the 2-month lockdown a year ago, I would purchase 4 frozen pizzas at a time when I had a chance to buy them, because I was so upset that I could not buy one when I wanted a single one during the 2 previous weeks, because of hoarders who had been faster than me. People think of toilet papers, but it is not just that. Pasta, rice, flour, yeast, plenty of useful things went missi…

This is a really perfect illustration of both parts of the parent comment.

Re: All my servers have an 8 GB empty file on disk

#225
post #37

This is like carrying around a pound of beef because you refuse to look up the address of a McDonald's 7 minutes away. Setup quotas or implement some damn monitoring -- if you're not monitoring something as simple and critical as disk usage, what else are you not monitoring?

Monitoring doesn't prevent random things from spiking, and something like this makes it easier to recover.

Quotas are tricky to set up when things are sharing disk space, and that could easily give you a false positive where a service unnecessarily runs out of space.

Re: All my servers have an 8 GB empty file on disk

#226

A lot of tips in this thread are about how to better alert when you get low on disk space, how to recover, etc. but I'd like to highlight the statement: "The disk filled up, and that's one thing you don't want on a Linux server—or a Mac for that matter. When the disk is full nothing good happens." As developers, we need to be better at handling edge cases like out of disk space, out of memory, pegged bandwidth and pe…

It doesn't help that the base model of many phones had ridiculously undersized storage for so many years.

"I have an unlimited data plan, I'll just store everything in the cloud." only to discover later that unlimited has an asterisk by it and a footnote that says "LOL it's still limited".

Re: All my servers have an 8 GB empty file on disk

#227
Lots of comments assailing this approach as a poor replacement for monitoring miss the point. Of course monitoring and proactive repair are preferable - but those are systems that can also fail!

This is a low cost way to make failure of your first line of defense less painful to recover, and seems like a Good Idea for those managing bare-metal non-cattle systems.

Re: All my servers have an 8 GB empty file on disk

#228
post #190

Earlier quoted context omitted.

I still know people that pre-emptively buy toilet paper "because hoarders might buy the rest of it" with absolutely no introspection.

Hoarders will buy the rest of it. During the 2-month lockdown a year ago, I would purchase 4 frozen pizzas at a time when I had a chance to buy them, because I was so upset that I could not buy one when I wanted a single one during the 2 previous weeks, because of hoarders who had been faster than me. People think of toilet papers, but it is not just that. Pasta, rice, flour, yeast, plenty of useful things went missi…

The meat situation was kind of interesting actually. At the beginning of the lockdown I remember going shopping for lots of shelf-stable foods. Very perishable stuff like meat or fresh veggies were out or hard to find (and yes freezing meat works fine I know). However, lots of stores had tons of shelf stable boxed and canned goods and for meat jerky and other dried meats which are simple to boil and turn into simple soups in case of emergencies -- and yet nobody was really buying them at that time.

I think I "prepped" for the worst by buying a 10 lb bag of flour, 40 lb of rice, 5 lbs of oatmeal, a sack of potatoes and a few bags of beef jerky and trail mix. Even if the worst didn't come to pass I figured we'd eventually eat it all anyways and it wouldn't really be hoarded, but in pinch we could ration it and it would last a few months and give us nutritious meals. It's basically what ships crews used to survive on during the age of sail as they spent months at sea. Not a ton of variety but it will keep you alive.

Re: All my servers have an 8 GB empty file on disk

#229
if you are on an ext filesystem, reducing the reserved percentage on the full filesystem can save the day. its more or less this same trick built in to the filesystem

IIRC 5% is reserved when the filesystem os created, and if it gets full you can run:

tune2fs -m 4 /dev/whatever

which will instantly make 1% of the disk available.

of course should be used sparingly and restored when finished

Re: All my servers have an 8 GB empty file on disk

#230
post #58
post #31

Same idea as this game development legend https://www.dodgycoder.net/2012/02/coding-tricks-of-game-dev... > he had put aside those two megabytes of memory early in the development cycle. He knew from experience that it was always impossible to cut content down to memory budgets, and that many projects had come close to failing because of it. So now, as a regular practice, he always put aside a nice block of memory to…

There's a difference between "The server is not responding right now. We're loosing customers.", and "Low resources during product development". Actually the latter may be a case of enforcing premature optimization. So no, it's not the same idea.

I think we are thinking of a different baseline. You are thinking along the lines of "this should run, we can reduce server costs later", I would suggest (if I may) "the app needs to run on any Android device with 2GB RAM". And then you develop a game to run on a 1.5GB RAM phone, expecting that it will eventually fit into 2GB RAM budget.
Post reply on HN