Expand description
Repack — copy file trees from one source into a freshly-formatted destination filesystem.
Three kinds of sources, exposed as Source:
- A host directory (
Source::HostDir) — the originalfstool createflow, walks a directory tree. - A tar archive on disk (
Source::TarArchive), with optional compression codec. Compressed archives go through a two-pass stream-index → replay flow; plain.tarfalls through to theImagepath (the regular tar reader sits on top of aBlockDevice). - An existing image (
Source::Image) — a raw or qcow2 file, optionally with a:Npartition selector. Walks the source FS throughAnyFsand copies entries straight through without host-filesystem intermediation.
The two main entry points — populate_ext_from_source and
populate_fat32_from_source — take an already-formatted
destination filesystem and stream the chosen source’s contents
into it. Auto-sizing helpers (ext_build_plan_for_source,
fat32_min_bytes_for_source) let callers right-size the
destination geometry up-front.
Used by both the fstool repack CLI command and by the
spec layer when a TOML source = "..." value
points at a tar / image instead of a directory.
Enums§
- Source
- Where to draw a filesystem’s contents from when building or populating it. See module docs.
Functions§
- build_
ext_ plan_ through_ trait - Public counterpart of
build_ext_plan_innerfor the binary crate’sbuild_ext_plan. Walks the source through thecrate::fs::Filesystemtrait, no AnyFs match. - ext_
build_ plan_ for_ source - Build a
BuildPlansized for the source. Walks the source once and feeds entry counts + byte totals into the plan; the resultingto_format_opts()is ready to driveExt::format_with. - fat32_
min_ bytes_ for_ source - Compute the minimum FAT32 byte capacity needed to fit
source. Bumps to the FAT32 cluster-count minimum + rounds up to a 512-byte sector boundary. - open_
tar_ stream_ index - Open the tar source (optionally codec-wrapped) and build a random-access index over it. Shared entry point for the streaming-tar inspector commands.
- populate_
ext_ from_ source - Populate
dst(a freshly formatted ext{2,3,4}) with the contents ofsource. The destination is assumed to already exist. - populate_
fat32_ from_ source - Populate
dst(a freshly formatted FAT32) with the contents ofsource. The destination is assumed to already exist. - populate_
fs_ from_ source - Populate any
crate::fs::Filesystemfromsource, dispatching through the trait for every entry create. Works for HFS+, NTFS, F2FS, SquashFS, XFS — whatever implements the trait — though ext/FAT32 callers should preferpopulate_ext_from_source/populate_fat32_from_sourcewhich preserve xattrs and use the per-FS fast paths. - populate_
fs_ from_ source_ dyn - Trait-object form of
populate_fs_from_source. Used by code paths (e.g.crate::inspect::AnyFsdispatch helpers) that have a&mut dyn Filesystemrather than a known concrete type.