nix-community / nixos-install-scripts

collection of one-shot scripts to install NixOS on various server hosters and other hardware. [maintainer=@happysalada]
123 stars 68 forks source link

Why does the hetzner script only allocate 95% of available HDD space? #21

Open ISibboI opened 11 months ago

ISibboI commented 11 months ago

See this line:

https://github.com/nix-community/nixos-install-scripts/blame/5dc786009cf8595090bfa8e337df2ff1693e825a/hosters/hetzner-dedicated/hetzner-dedicated-wipe-and-install-nixos.sh#L133

Why is it not 100%FREE, but just 95%FREE?

happysalada commented 11 months ago

@nh2 might be able to help on this one. I personally use zfs, so no idea.

nh2 commented 11 months ago

The # 5% slack space are a simple safety mechanism:

Tools such as nix-collect-garbage need additional space before they can free up memory (because it adds info to nix's sqlite DB before deleting data). Hacing some slack space allows to have an easy way out of such situations.

Separately, it can also be useful if you need to install another OS, e.g. for testing an upgrade that cannot be rolled back.

ISibboI commented 11 months ago

I understand. Do you think this is still necessary, since hetzner dedicated servers have at least two times half a terabyte nowadays, even in the serverbörse?

If yes, I'd propose to add a fixme there explaining what the slack space is for.

And maybe change it from 5% to 20GB or so, because with an e.g. 4TB server, the 5% amount to 200GB of unused space, which is much more than needed for garbage collection, right?

On Wed, 9 Aug 2023, 12.48 Niklas Hambüchen, @.***> wrote:

The # 5% slack space are a simple safety mechanism:

Tools such as nix-collect-garbage need additional space before they can free up memory (because it adds info to nix's sqlite DB before deleting data). Hacing some slack space allows to have an easy way out of such situations.

Separately, it can also be useful if you need to install another OS, e.g. for testing an upgrade that cannot be rolled back.

— Reply to this email directly, view it on GitHub https://github.com/nix-community/nixos-install-scripts/issues/21#issuecomment-1671011593, or unsubscribe https://github.com/notifications/unsubscribe-auth/AASATXSWYWNCMONWBWQ2F6LXUNMFLANCNFSM6AAAAAA3JQ2G2I . You are receiving this because you authored the thread.Message ID: @.***>

nh2 commented 2 months ago

Do you think this is still necessary, since hetzner dedicated servers have at least two times half a terabyte nowadays, even in the serverbörse?

Yes, the issue can arise no matter how large the HDD is. All it needs is that some program writes too many log files.

explaining what the slack space is for

Explaining is always good, we should have that as an explanation indeed.

And maybe change it from 5% to 20GB or so

There are still servers with 250 GB disks in the Server Auction.

Overall 5% seems quite sane to me though, especially for the "install another OS, e.g. for testing an upgrade that cannot be rolled back" use case: 5% are enough for most distros on most disks, and because it's a ratio it will likely will continue to be so as OSs and grow.