Mount repeat fixes, update docs

This commit is contained in:
2025-10-10 14:11:52 +02:00
parent cc126d77b4
commit 5746e285b2
4 changed files with 4 additions and 189 deletions

View File

@@ -20,7 +20,7 @@ Key modules
- [src/partition/plan.rs](src/partition/plan.rs) - [src/partition/plan.rs](src/partition/plan.rs)
- Filesystem planning/creation and mkfs integration: - Filesystem planning/creation and mkfs integration:
- [src/fs/plan.rs](src/fs/plan.rs) - [src/fs/plan.rs](src/fs/plan.rs)
- Mount planning and application (skeleton): - Mount planning and application:
- [src/mount/ops.rs](src/mount/ops.rs) - [src/mount/ops.rs](src/mount/ops.rs)
Features at a glance Features at a glance

View File

@@ -1,185 +0,0 @@
# 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.
# -----------------------------------------------------------------------------

View File

@@ -7,13 +7,13 @@
// REGION: API-END // REGION: API-END
// //
// REGION: RESPONSIBILITIES // REGION: RESPONSIBILITIES
// - Implement mount phase only: plan root mounts under /var/mounts/{UUID}, ensure/plan subvols, and mount subvols to /var/cache/*. // - Implement mount phase only: plan root mounts under /var/mounts/{UUID} for data, mount ESP at /boot, ensure/plan subvols, and mount subvols to /var/cache/*.
// - Use UUID= sources, deterministic primary selection (first FsResult) for dual_independent. // - Use UUID= sources, deterministic primary selection (first FsResult) for dual_independent.
// - Generate fstab entries only for four subvol targets; exclude runtime root mounts. // - Generate fstab entries covering runtime roots (/var/mounts/{UUID}, /boot when present) followed by the four subvol targets.
// REGION: RESPONSIBILITIES-END // REGION: RESPONSIBILITIES-END
// //
// REGION: SAFETY // REGION: SAFETY
// - Never mount ESP; only Btrfs/Bcachefs data FS. Root btrfs mounts use subvolid=5 (top-level). // - Mount ESP (VFAT) read-write at /boot once; data roots use subvolid=5 (btrfs) or plain (bcachefs).
// - Create-if-missing subvolumes prior to subvol mounts; ensure directories exist. // - Create-if-missing subvolumes prior to subvol mounts; ensure directories exist.
// - Always use UUID= sources; no device paths. // - Always use UUID= sources; no device paths.
// - Bcachefs subvolume mounts use option key 'X-mount.subdir={name}' (not 'subvol='). // - Bcachefs subvolume mounts use option key 'X-mount.subdir={name}' (not 'subvol=').