NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.28k stars 14.26k forks source link

Figure out and clean up fsck and auto-resizing options #39934

Open copumpkin opened 6 years ago

copumpkin commented 6 years ago

We have https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/system/boot/grow-partition.nix that resizes partitions, but also https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/system/boot/stage-1-init.sh#L301-L312 which attempts to resize filesystems. The logic in the latter also appears to call fsck twice on resized filesystems. Regardless, auto-fsck'ing is a bad idea, at least on fresh booted images (like in EC2), where the disk is pristine and doesn't need a check before a resize.

dezgeg commented 6 years ago

Regardless, auto-fsck'ing is a bad idea, at least on fresh booted images (like in EC2), where the disk is pristine and doesn't need a check before a resize.

If the disk is clean the fsck should be a no-op. The real problem is the -f flag passed to fsck in https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/system/boot/stage-1-init.sh#L308.

dezgeg commented 6 years ago

And for completeness, there is a third implementation in https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/installer/cd-dvd/sd-image.nix#L130 which should probably be switched to use one of the other two.

https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/system/boot/grow-partition.nix should learn a thing or two from the sd-image.nix implementation though, as in not determining the root device by string processing. I don't see a way to get the partition number from lsblk (sd-image.nix just hardcodes the partition number 2). Maybe it can be queried from udev.

stale[bot] commented 4 years ago

Thank you for your contributions.

This has been automatically marked as stale because it has had no activity for 180 days.

If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.

Here are suggestions that might help resolve this more quickly:

  1. Search for maintainers and people that previously touched the related code and @ mention them in a comment.
  2. Ask on the NixOS Discourse.
  3. Ask on the #nixos channel on irc.freenode.net.