1
1
mirror of https://github.com/NixOS/mobile-nixos.git synced 2024-12-17 04:51:31 +03:00
mobile-nixos/lib/image-builder
Samuel Dionne-Riel f777cbdadb image-builder: makeExt4: implements minimal resizing
The algorithms inside `make_ext4fs` can be followed, but it ends up
being a bit complex. I did not figure out all variables, but the amount
of them made me reluctant to implement it as a complte formula.

Instead, I looked at the actual usable space using `df` and mapped it in
a spreadsheet. With the knowledge from actively looking at the source
code, and other data, it is known that the lookup table will work, while
not be ideal.

The fudge factor starting at 256MiB is about stable, but there is a
slight downward deviation at 512MiB, which is why 512MiB was used. The
downward deviation was not observed in other values.

Here's the table as computed.

```
MIB	Fudge
5	0.84609375
8	0.5419921875
16	0.288818359375
32	0.1622314453125
64	0.09893798828125
128	0.067291259765625
256	0.0518646240234375
512	0.05208587646484375
1024	0.048187255859375
2048	0.04060554504394531
4096	0.03718090057373047
```

The difference from .52% to .37% is negligible for 0.5 vs. 4 GiB is
annoying me. The lookup table could be changed to include all known
values instead, I guess.
2019-09-04 20:11:12 -04:00
..
lib image-builder: Refactors the test mode... 2019-08-30 22:43:30 -04:00
tests image-builder: Adds alignment tests 2019-09-04 00:47:10 -04:00
default.nix image-builder: Refactors the test mode... 2019-08-30 22:43:30 -04:00
makeExt4.nix image-builder: makeExt4: implements minimal resizing 2019-09-04 20:11:12 -04:00
makeFAT32.nix image-builder: makeFAT32: Adjusts sizes 2019-09-04 00:49:13 -04:00
makeFilesystem.nix image-builder: makeFilesystem: prepares API for adjusting sizes 2019-09-04 00:48:58 -04:00
makeMBR.nix image-builder: makeMBR: work with tiny partitions 2019-09-04 00:47:10 -04:00
test.rb image-builder: Refactors the test mode... 2019-08-30 22:43:30 -04:00