- CLI: add topology selection (-t/--topology), preview flags (--show/--report), and removable policy override (--allow-removable) (src/cli/args.rs) - Config: built-in sensible defaults; deterministic overlays for logging, fstab, removable, topology (src/config/loader.rs) - Device: discovery via /proc + /sys with include/exclude regex and removable policy (src/device/discovery.rs) - Idempotency: detection via blkid; safe emptiness checks (src/idempotency/mod.rs) - Partition: topology-driven planning (Single, DualIndependent, BtrfsRaid1, SsdHddBcachefs) (src/partition/plan.rs) - FS: planning + creation (mkfs.vfat, mkfs.btrfs, bcachefs format) and UUID capture via blkid (src/fs/plan.rs) - Orchestrator: pre-flight with preview JSON (disks, partition_plan, filesystems_planned, mount scheme). Skips emptiness in preview; supports stdout+file (src/orchestrator/run.rs) - Util/Logging/Types/Errors: process execution, tracing, shared types (src/util/mod.rs, src/logging/mod.rs, src/types.rs, src/errors.rs) - Docs: add README with exhaustive usage and preview JSON shape (README.md) Builds and unit tests pass: discovery, util, idempotency helpers, and fs parser tests.
185 lines
5.9 KiB
YAML
185 lines
5.9 KiB
YAML
# zosstorage example configuration (full surface)
|
|
# Copy to /etc/zosstorage/config.yaml on the target system, or pass with:
|
|
# - CLI: --config /path/to/your.yaml
|
|
# - Kernel cmdline: zosstorage.config=/path/to/your.yaml
|
|
# Precedence (highest to lowest):
|
|
# kernel cmdline > CLI flags > CLI --config file > /etc/zosstorage/config.yaml > built-in defaults
|
|
|
|
version: 1
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# Logging
|
|
# -----------------------------------------------------------------------------
|
|
logging:
|
|
# one of: error, warn, info, debug
|
|
level: info
|
|
# when true, also logs to /run/zosstorage/zosstorage.log in initramfs
|
|
to_file: false
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# Device selection rules
|
|
# - include_patterns: device paths that are considered
|
|
# - exclude_patterns: device paths to filter out
|
|
# - allow_removable: future toggle for removable media (kept false by default)
|
|
# - min_size_gib: ignore devices smaller than this size
|
|
# -----------------------------------------------------------------------------
|
|
device_selection:
|
|
include_patterns:
|
|
- "^/dev/sd\\w+$"
|
|
- "^/dev/nvme\\w+n\\d+$"
|
|
- "^/dev/vd\\w+$"
|
|
exclude_patterns:
|
|
- "^/dev/ram\\d+$"
|
|
- "^/dev/zram\\d+$"
|
|
- "^/dev/loop\\d+$"
|
|
- "^/dev/fd\\d+$"
|
|
allow_removable: false
|
|
min_size_gib: 10
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# Desired topology (choose ONE)
|
|
# single : Single eligible disk; btrfs on data
|
|
# dual_independent : Two disks; independent btrfs on each
|
|
# ssd_hdd_bcachefs : SSD + HDD; bcachefs with SSD as cache/promote and HDD backing
|
|
# btrfs_raid1 : Optional mirrored btrfs across two disks (only when explicitly requested)
|
|
# -----------------------------------------------------------------------------
|
|
topology:
|
|
mode: single
|
|
# mode: dual_independent
|
|
# mode: ssd_hdd_bcachefs
|
|
# mode: btrfs_raid1
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# Partitioning (GPT only)
|
|
# Reserved GPT names:
|
|
# - bios boot : "zosboot" (tiny BIOS boot partition, non-FS)
|
|
# - ESP : "zosboot" (FAT32)
|
|
# - Data : "zosdata"
|
|
# - Cache : "zoscache" (only for ssd_hdd_bcachefs)
|
|
# Reserved filesystem labels:
|
|
# - ESP : ZOSBOOT
|
|
# - Data (all filesystems including bcachefs): ZOSDATA
|
|
# -----------------------------------------------------------------------------
|
|
partitioning:
|
|
# 1 MiB alignment
|
|
alignment_mib: 1
|
|
|
|
# Abort if any target disk is not empty (required for safety)
|
|
require_empty_disks: true
|
|
|
|
bios_boot:
|
|
enabled: true
|
|
size_mib: 1
|
|
gpt_name: zosboot
|
|
|
|
esp:
|
|
size_mib: 512
|
|
label: ZOSBOOT
|
|
gpt_name: zosboot
|
|
|
|
data:
|
|
gpt_name: zosdata
|
|
|
|
# Only used in ssd_hdd_bcachefs
|
|
cache:
|
|
gpt_name: zoscache
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# Filesystem options and tuning
|
|
# All data filesystems (btrfs or bcachefs) use label ZOSDATA
|
|
# ESP uses label ZOSBOOT
|
|
# -----------------------------------------------------------------------------
|
|
filesystem:
|
|
btrfs:
|
|
# Reserved; must be "ZOSDATA"
|
|
label: ZOSDATA
|
|
# e.g., "zstd:3", "zstd:5"
|
|
compression: zstd:3
|
|
# "none" | "raid1" (raid1 typically when topology.mode == btrfs_raid1)
|
|
raid_profile: none
|
|
|
|
bcachefs:
|
|
# Reserved; must be "ZOSDATA"
|
|
label: ZOSDATA
|
|
# "promote" (default) or "writeback" if supported by environment
|
|
cache_mode: promote
|
|
# Compression algorithm, e.g., "zstd"
|
|
compression: zstd
|
|
# Checksum algorithm, e.g., "crc32c"
|
|
checksum: crc32c
|
|
|
|
vfat:
|
|
# Reserved; must be "ZOSBOOT"
|
|
label: ZOSBOOT
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# Mount scheme and optional fstab
|
|
# Default behavior mounts data filesystems under /var/cache/<UUID>
|
|
# -----------------------------------------------------------------------------
|
|
mount:
|
|
# Base directory for mounts
|
|
base_dir: /var/cache
|
|
# Scheme: per_uuid | custom (custom reserved for future)
|
|
scheme: per_uuid
|
|
# When true, zosstorage will generate /etc/fstab entries in deterministic order
|
|
fstab_enabled: false
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# Report output
|
|
# JSON report is written after successful provisioning
|
|
# -----------------------------------------------------------------------------
|
|
report:
|
|
path: /run/zosstorage/state.json
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# Examples for different topologies (uncomment and set topology.mode accordingly)
|
|
# -----------------------------------------------------------------------------
|
|
|
|
# Example: single disk (uses btrfs on data)
|
|
# topology:
|
|
# mode: single
|
|
# filesystem:
|
|
# btrfs:
|
|
# label: ZOSDATA
|
|
# compression: zstd:3
|
|
# raid_profile: none
|
|
|
|
# Example: dual independent btrfs (two disks)
|
|
# topology:
|
|
# mode: dual_independent
|
|
# filesystem:
|
|
# btrfs:
|
|
# label: ZOSDATA
|
|
# compression: zstd:5
|
|
# raid_profile: none
|
|
|
|
# Example: SSD + HDD with bcachefs
|
|
# topology:
|
|
# mode: ssd_hdd_bcachefs
|
|
# partitioning:
|
|
# cache:
|
|
# gpt_name: zoscache
|
|
# filesystem:
|
|
# bcachefs:
|
|
# label: ZOSDATA
|
|
# cache_mode: promote
|
|
# compression: zstd
|
|
# checksum: crc32c
|
|
|
|
# Example: btrfs RAID1 (two disks)
|
|
# topology:
|
|
# mode: btrfs_raid1
|
|
# filesystem:
|
|
# btrfs:
|
|
# label: ZOSDATA
|
|
# compression: zstd:3
|
|
# raid_profile: raid1
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# Notes:
|
|
# - Never modify devices outside include_patterns or inside exclude_patterns.
|
|
# - Idempotency: if expected GPT names and filesystem labels are already present,
|
|
# zosstorage exits success without making changes.
|
|
# - --force flag is reserved and not implemented; will return an "unimplemented" error.
|
|
# - Kernel cmdline data: URLs for zosstorage.config= are currently unimplemented.
|
|
# ----------------------------------------------------------------------------- |