Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nixos/swap: always allocate with dd #102068

wants to merge 1 commit into from


Copy link

@buckley310 buckley310 commented Oct 29, 2020

Motivation for this change

Allocating swap files with fallocate is not garunteed to work.
I have a few machines configured using swap files, and one of them is refusing to mount any swaps allocated with fallocate. I needed to go into that machine and manually allocate the swap with dd for that machine to work.

The article calls out xfs specifically, but all the machines I have with swap files are ext4, and only one seems affected.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits
@buckley310 buckley310 force-pushed the buckley310:swap branch from 134cbba to 8625ba4 Nov 11, 2020
Copy link

@jtojnar jtojnar commented Nov 11, 2020

xr #91986

@buckley310 buckley310 marked this pull request as draft Nov 11, 2020
Copy link
Contributor Author

@buckley310 buckley310 commented Nov 12, 2020

Marking as a draft for now.
If the kernel is going to get an ext4 patch instead, then this should be closed.
It sounds like this is also a non-issue on sufficiently modern XFS as well, a detail which I didn't pick up on before.

Copy link
Contributor Author

@buckley310 buckley310 commented Nov 23, 2020

It looks like the kernel fix patch is the right path, so I'm closing this. It can be reopened later if needed.

@buckley310 buckley310 closed this Nov 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants