# Files and Volumes

---

# Filesystem Layout

_Peios / Using Peios / Files and Volumes_

> Locate software, configuration, state, and boot files while distinguishing runtime views from backing storage.

The base layout separates packaged files, local overrides, generated output,
and mutable state. Images and local mounts can differ. A path alone does not
prove persistence, a separate storage budget, a backup policy, or permission
to remove its contents.

| Location | Purpose |
|---|---|
| `/usr` | Packaged executables, libraries, helpers, shared files, and defaults. |
| `/lcl` | Operator-managed software and file-based overrides. |
| `/system/retc` | Generated configuration projected into the runtime `/etc` view. |
| `/var/state` | Persistent service and identity state, including protected secrets. |
| `/var/cache`, `/var/log`, `/var/crash` | Component-managed caches and diagnostic data; event records need not be text files here. |
| `/home` | Human home directories. Services use their configured state paths. |
| `/data`, `/srv`, `/opt` | Bulk data, served content, and software with its own layout. |
| `/run` | Runtime sockets, service directories, and locks. |
| `/tmp`, `/var/tmp` | Temporary work; check the actual mount and cleanup policy. |
| `/boot`, `/system/boot` | Boot inputs, the EFI mount, and generated boot artifacts. |
| `/mnt`, `/media` | Mount locations; creating a directory does not attach storage. |
| `/proc`, `/sys`, `/dev` | Kernel and device interfaces. |

## Follow the runtime view

The conventional `/bin`, `/sbin`, `/lib`, `/libexec`, `/share`, `/include`,
and `/conf` views place local directories above vendor directories. The
real-root `/etc` view additionally puts `/system/retc` above `/lcl/etc` and
`/usr/etc`. An existing generated name can therefore hide a local override.
Find the owning registry setting before editing generated output.

The `+ro` flag protects a stratum through that view; it does not make direct
access to the backing `/usr` path universally read-only. On the reviewed
x86-64 base, `/lib64` is a relative link to `usr/lib/x86_64-linux-peios`, not
a
StrataFS mount. The `/lib` view still covers modules and firmware. Temporary
boot views can differ from real-root views.

Use [StrataFS inspection](/peios/using-peios/files-and-volumes/inspecting-stratafs.md)
to identify the actual provider before changing a file. Removing a local
override can reveal a vendor file; it does not create a whiteout.

## Default policy is not a live inventory

The retained fsbase recipe supplies these policy intentions. Later package,
service, installer, or administrator changes can narrow them further.
Inspect the deployed descriptors rather than assuming a path proves access.

| Scope | Intended baseline |
|---|---|
| Public software and selected local configuration trees | SYSTEM and Administrators manage; other users receive read/traverse access where specified. |
| `/var/state`, caches, logs, crash data, `/data`, and `/srv` | Administrative control with traversal where specified; no universal read grant to service contents. |
| `/home` | Traversal without a general directory-list grant; each home supplies its own policy. |
| `/tmp` and `/var/tmp` | Shared creation with creator-specific child policy, not inherited public access to every temporary file. |
| `/var/state/secrets` | SYSTEM-only baseline. |
| Identity stores | The owning service and SYSTEM; for example, lpsd's credential store has its own narrower policy. |

These are not interchangeable repair templates. In particular, applying a
public system-tree descriptor recursively to private state exposes data.
`/lcl/policy` holds privileged boot policy and is not ordinary override
storage.

The retained installed layout uses a disk-backed `/tmp` without automatic
boot clearing in fsbase. A live image's volatile layer has a different
lifetime. Check actual cleanup and mount configuration before relying on
reboot to erase a file. Check which EFI filesystem is mounted before replacing
boot artifacts; generating an image elsewhere does not activate it.

---

# Identifying Devices

_Peios / Using Peios / Files and Volumes_

> Match a saved storage reference to the intended filesystem, partition, or physical disk.

Before a mount or destructive operation, compare the selected device's size,
model, partition layout, and live use. Kernel names such as `/dev/sda` and
`/dev/nvme0n1` can change with discovery order.

| Identity | What it follows |
|---|---|
| Filesystem UUID | The filesystem; a clone can duplicate it. |
| Partition UUID | The partition table entry, independently of its filesystem. |
| Hardware ID | The device's advertised serial or worldwide identity. |
| Bus path | The device's position in the hardware topology. |
| Label or partition label | A human-selected name that need not be unique. |
| Disk sequence | An instance in this boot, not a persistent reference. |

The device manager exposes applicable links under `/dev/disk/by-*`. Check the
resolved target, especially when clones are attached. A stable name does not
prove that erasing the target is appropriate.

Do not assume those links exist in an initramfs without the device manager.
A boot hook can resolve `root=UUID=` by probing devices directly. Check the
image's actual discovery path. A real-root service depending on the links
needs the appropriate device-manager dependency, plus handling for removal
or discovery failure.

Device naming does not authorize opening the node. Its security descriptor
and operation-specific checks still apply. Interface renaming similarly
provides a configuration name, not proof of network identity or trust.

---

# Mounting Storage

_Peios / Using Peios / Files and Volumes_

> Choose missing-descriptor behavior, verify the filesystem instance, and distinguish attachment from policy conversion.

Inspect the device, existing mounts, and intended target before attaching
storage. Use `lsblk`, `part list`, and `mount`, retaining diagnostics
alongside
the listings. Limited visibility does not prove a disk is unused.

## Choose the missing-descriptor behavior

| Policy | Purpose |
|---|---|
| Deny missing | Use provisioned storage with valid stored descriptors. |
| Ephemeral synthesis | Derive missing descriptors without saving those derived values. |
| Persistent synthesis | Adopt missing descriptors incrementally through deferred write-back. |

A valid stored descriptor remains authoritative. A corrupt one is refused
rather than replaced through synthesis. Unmanaged policy is reserved for
kernel-owned cases; it is not an administrative way to disable file security.
StrataFS has a fixed policy.

Synthesis considers parent inheritance, then the mount template, then the
kernel fallback. Omitting a template does not mean private access. Persistent
synthesis is not a whole-tree conversion, and a readable cached descriptor
does not prove it reached storage. Before moving to deny-missing, verify the
stored descriptors of rarely used files as well as ordinary working files.

The [kernel mount reference](/kernel/internals/kacs/file-security/mount-classes-and-bootstrap-descriptors.md)
owns defaults and administration, while
[descriptor storage](/kernel/internals/kacs/file-security/descriptor-storage-and-caching.md)
owns synthesis, corruption, deferred write-back, and repair. tmpfs, devtmpfs,
and boot images do not all default to ephemeral synthesis.

## Verify the attachment boundary

Policy belongs to the superblock, not the mountpoint. Bind paths can share it;
a second mount of the same device need not create an independent policy.
A policy change neither rewrites stored descriptors nor revokes cached rights
on existing handles. Other filesystems mounted below it remain separate.

`mount(1)` documents attach-time policy and template options. Policy is set on
the detached mount before attachment, so failure at that step does not expose
a mount with unintended policy. Other setup can still have happened before a
later failure. A nonzero status is not proof that no state changed.

Remount and bind operations are not policy-change interfaces. Disk Manager's
inspection does not make its unimplemented privileged commit workflow usable.
Changing policy on an existing instance requires a supported integration with
the kernel API. The narrower volume-management privilege can satisfy that
API's gate; do not add TCB merely because a command diagnostic names it.

Read-only mounting and ephemeral synthesis are separate choices. An ext
filesystem can replay its journal even on a read-only mount. For preservation,
use an inspection method that also prevents journal and device writes, such
as the installer's documented read-only loop and `noload` procedure.

After attachment, verify source, target, filesystem, writable state, policy,
and template. Missing policy details leave verification incomplete. Reopen
files when checking a changed policy instead of testing through old handles.

## Arrange startup deliberately

Prelude's hooks mount the root before Peinit. Additional storage can use a
service with an explicit identity, privileges, dependencies, and failure
policy. A service using device-manager links must wait for those links, and
must still handle later device removal.

Define repeat-start and partial-failure behavior. A successful Oneshot service
can become inactive while its mount remains attached; service state is not
live mount state. Do not use an option that lacks an existing-mount guard as
proof of idempotence. Verify both the service result and the mount itself.

---

# Mount Operations and Their Boundaries

_Peios / Using Peios / Files and Volumes_

> Understand attachment, policy, and partial failure before changing the mount tree.

`mount` attaches a filesystem or changes an existing mount. With no operands,
it reads live mount state rather than attaching anything.

## Source, target, and policy are separate choices

A source identifies the storage or filesystem being mounted. A target is where
its contents become visible. A mount policy controls how the Peios access
model treats objects on that filesystem.

A new filesystem's policy is set before attachment. Failure to set that policy
prevents attachment with an unintended policy. This does not make the whole
command transactional: target creation or later propagation changes have their
own effects.

Bind mounts share a source filesystem rather than copying it. Superblock
options can affect shared state, while per-mount attributes concern the
selected view. The command rejects superblock changes in a bind remount
instead of silently changing every view of the filesystem.

## Inspect live state before and after a change

This implementation does not use `/etc/fstab` to supply missing operands or
`/etc/mtab` as its source of truth. It reads the kernel's mount table. Listing
and attachment are different modes, so a listing filter is not necessarily a
valid attachment type expression.

A filesystem probe can refuse an ambiguous device rather than choosing between
conflicting signatures. Inspect the source and resolve ambiguity before
attempting an attachment.

## Failure is not a rollback report

A propagation change can fail after a filesystem has been attached. A nonzero
status therefore does not establish that the target stayed unchanged. Retain
diagnostics and inspect the live mount before retrying.

The accepted `--onlyonce` flag is not enforced by the executor. It does not
make repeated invocation idempotent. Check existing attachments explicitly.

Fake mode skips mount syscalls, but target preparation can still create
directories. It does not prove that a real operation will pass authorization
or filesystem checks. A requested mkdir mode is not a verified Peios security
descriptor; establish the target's security separately.

## Keep storage lifecycle visible

Regular-file images can need loop devices. The command can allocate or reuse
suitable loop backing, and newly allocated loops use automatic cleanup. That
mechanism does not make an image safe to modify through uncoordinated
concurrent access.

`mount(1)` defines source syntax, policy restrictions, loop handling,
namespace selection, and status codes. The filesystem's own documentation owns
its specific parameters.

---

# Detaching a Mounted Filesystem

_Peios / Using Peios / Files and Volumes_

> Understand target selection, busy mounts, and deferred cleanup.

`umount` detaches a filesystem from the mount tree. Its operand can name a
mount point or a source resolved through live mount state.

## Name the intended attachment

A source mounted at several locations is ambiguous. Name the particular mount
point when only that attachment should be removed. All-targets mode is an
explicit request to expand the operation to every matching mount.

Recursive mode expands beneath a target and works from deeper mounts upward.
Expansion can stop on a failure, leaving a partially changed tree. Inspect
what remains before retrying.

## Detachment and final cleanup can differ

An ordinary unmount can fail while resources are busy. Lazy unmount removes
the attachment from the visible tree while deferring cleanup until references
are released. It is not a guarantee that every user has stopped using the
filesystem or that a device is ready to remove.

Forced unmount is another distinct request whose meaning depends on the
filesystem. Read-only fallback changes state instead of proving a detach. Use
the mode that matches the recovery task, rather than escalating flags until a
command returns success.

## Check the resulting state

The command reads `/proc/self/mountinfo`, including after entering a selected
mount namespace. A query in another namespace can show a different set of
attachments.

An aggregate failure can coexist with successful top-level operands.
`umount(1)` defines ambiguous-source handling, expansion stopping rules, loop
cleanup, and the status distinctions.

---

# Inspecting Storage Devices

_Peios / Using Peios / Files and Volumes_

> Read the block-device hierarchy before selecting storage for another operation.

`lsblk` shows block devices and their relationships. It helps distinguish a
whole disk, a partition, and a layered device before an operation uses one of
those objects.

## Before you start

Use a terminal with Peiosutils installed. For examples that create files,
start in a disposable working directory without existing example names.

## Perform the task

Run the command:

```sh
lsblk -o NAME,SIZE,TYPE,MOUNTPOINTS
```

## Check the result

The output shows available devices, sizes, types, and known mount points. The
device set depends on the running system.

## Missing information is not a negative finding

Columns come from several sources, including kernel device information,
filesystem probing, mount state, and device-node security. A source can be
unavailable or unreadable even when the device exists.

An empty filesystem identity does not prove that the device is blank. Probe
access can be denied, and missing optional libraries can limit the information
available.

The owner and mode columns describe the device node, not the files stored
inside its filesystem. Peios node security is not equivalent to a set of
traditional mode bits.

For scripts, choose explicit columns and a structured output mode. The human
tree is intended for inspection. `lsblk(1)` defines column sources and the
representation of incomplete information.

---

# Partitioning a Disk

_Peios / Using Peios / Files and Volumes_

> Inspect a disk, plan its GPT layout, and distinguish partition changes from formatting or installation.

`part` manages GPT partition tables. Begin with its read-only inventory and
verification commands, and identify the whole disk by more than its transient
device name. An unreadable inventory entry is not an empty disk.

Plan the EFI and root partitions, or the data layout required by the intended
consumer, before writing. Partition changes can destroy access to existing
filesystems. Preserve needed data and unmount the target's filesystems first.
The whole-disk and mounted-device guards remain relevant even when replacing
an unfamiliar table is explicitly allowed.

Creating a table, adding an entry, and deleting an entry are separate changes.
The tool does not resize filesystems, relocate data, install a bootloader, or
supply an undo transaction. A newly added partition is not yet a formatted
or secured filesystem.

After a successful write, verify the table and confirm that the kernel sees
the intended partition devices before formatting. A valid table does not
prove an existing filesystem fits an edited entry. Use the installer for its
supported whole-disk workflow rather than reconstructing that workflow from
isolated partition commands.

`part(1)` owns size units, type aliases, confirmation flags, alignment, table
recognition, and exit status. In particular, a bare size is a sector count;
use an explicit unit when expressing a byte-sized plan.

---

# Inspecting StrataFS

_Peios / Using Peios / Files and Volumes_

> Trace merged paths, review local overrides, and interpret write routing without changing the stack.

Use `stratafs` to inspect the current mount namespace before changing a merged
path. It does not elevate the caller or modify files. An incomplete protected
view fails rather than pretending to be a complete answer.

```sh
stratafs list
stratafs resolve /bin/sh
stratafs origin /bin/sh
```

The stack lists strata in precedence order. A path can have one provider,
merged directory participants, shadowed same-type objects, masked different
types, or an absent entry. The origin report names the actual providers;
write and delete reports explain routing, not authorization.

A write can happen in place, copy up to the create stratum, or create a new
object. Symlinks, immutable state, missing parents, and read-only strata can
change that answer. The attempted operation still performs its own checks.

## Review local overrides

Use `sweep` on a mount to find objects in its create stratum, then `diff` on a
selected override before deciding whether to retain it. A gap exists only
locally; an override has a lower counterpart; a shadowed entry is hidden by a
higher object or ancestor. Directory overrides can still merge contents.

Deleting a local object can reveal the lower object because StrataFS does not
use whiteouts. The `+ro` flag prevents modification through the view, not all
direct writes to the backing tree. Neither a sweep result nor a routing report
is permission to remove the listed paths.

## Diagnose a security or copy-up failure

StrataFS requires stored descriptors under its fixed deny-missing contract.
A lower mount's synthesis does not repair a missing stored descriptor for the
view. Copy-up preserves the source's full descriptor; ordinary creation uses
inheritance. A failed preservation step fails copy-up. Do not apply overlayfs
assumptions to this implementation.

A stale copy-up after provider changes can require reopening. A successful
open does not guarantee the first write succeeds. Use the kernel's
[StrataFS documentation](/kernel/internals/stratafs.md) for provider identity,
copy-up, and failure semantics. `stratafs(1)` owns output states, JSON limits,
and probe-oriented exit codes.

---

# Disk Manager

_Peios / Using Peios / Files and Volumes_

> Inspect storage while recognizing the unsupported mutation path.

Disk Manager displays disks, partitions, mounts, and startup mounts. Use it
to inspect the machine's storage layout. Its change forms do not modify
storage because the privileged disk-service backend is not implemented.

## What is shown

A disk page lists its model, capacity, device, partition table, and
partitions. The bar represents each partition's share of the disk and
marks free space. Opening a partition shows available filesystem, label,
identifier, usage, and mount information.

**Mounts** lists active mounts, their options, and available access-policy
information. **At Startup** shows configured startup mounts. StrataFS
views include their constituent strata when readable.

Disk Manager samples every two seconds. It reads block information, the
kernel mount table, filesystem statistics, and permitted policy data.
Some raw-device and policy details need additional privileges. Unreadable
information is marked rather than invented.

Before choosing a separate command that changes storage, compare the device,
model, serial number, exact size, partition layout, and mount points.
**Not Readable** and **Contents unknown** report missing visibility; neither
means that a disk is empty or unformatted. Nonadministrative accounts can
still see kernel-listed partitions even when raw-device details are refused.

A later mount can cover an earlier mount at the same point or an ancestor.
Inspect the mount hierarchy when a filesystem seems to have disappeared.
StrataFS lists strata in precedence order. Startup entries identified by UUID
are distinct from system-managed mounts; displaying either does not enable
editing it.

## Reading a missing-permissions policy

The labels describe how the kernel handles a missing security descriptor:

| Label | Policy | Interpretation |
|---|---|---|
| Deny Access | `deny-missing` | Deny descriptor-based access until a valid descriptor is supplied |
| Give Permissions, Not Saved | `synth-ephemeral` | Derive a descriptor and retain it in memory |
| Give Permissions and Save Them | `synth-persist` | Derive a descriptor and schedule persistence |
| Not Managed | `unmanaged` | No filesystem access-control check from this policy; other kernel checks still apply |

An ephemeral descriptor can remain cached with the inode. Do not interpret
the UI description as a promise to derive a fresh descriptor on every open.
Corrupt stored descriptors are not equivalent to absent descriptors and are
not repaired by choosing synthesis. A filesystem without descriptor storage
cannot persist the synthesized result.

The mount's permissions view describes its fallback template, not the access
rules of every object already on that filesystem. Check the actual object
when diagnosing an access refusal.

## What cannot change storage

The forms for erasing a disk, adding or removing a partition, formatting,
mounting, unmounting, changing mount policy, startup configuration, and
ejecting all end by reporting that nothing changed. Passing validation or
confirming one of these forms is not a completed disk operation.

Use the separately documented storage tools when you need to perform an
actual operation. Their risks and access requirements belong to those
tools; do not infer them from this read-only inspection interface.
See `gxwi-disk-manager(1)` for data sources and limitations.

---

# Diagnosing Storage Pressure

_Peios / Using Peios / Files and Volumes_

> Identify the affected filesystem and distinguish block, inode, and visibility limits before choosing cleanup.

Keep the exact failing operation, path, error, and time. A read-only mount,
permission denial, or I/O failure is not automatically a space problem.
Start with an existing path involved in the failure, or its existing parent.

```sh
df -hT /affected/existing/path
df -i /affected/existing/path
```

Record the filesystem, type, mountpoint, available space, inode availability,
and diagnostics. Do not substitute the root filesystem's figures without
checking that the path belongs to it.

Measure a narrow, authorized directory with `du`, retaining its errors and
exit status. A partial walk understates what it could not read. Use the
command's filesystem-boundary option when appropriate and avoid treating
merged views as independent physical copies.

Filesystem usage and directory totals need not agree. Open-but-unlinked files,
metadata, reserved space, snapshots, compression, sparse allocation, hard
links, and stacked filesystems can affect the comparison. A pathname survey
cannot account for every allocated block.

Choose the owner's supported remedy: package cache cleanup, log retention,
service data maintenance, or removal of a known expendable build artifact.
A large file is not proof that deletion is safe. Do not delete package
transaction journals, live databases, or boot files merely to make space.

After the separately chosen remedy, repeat the same measurements and retry
the original operation. Removing a pathname can not release its storage until
an owning process closes it. Record that limitation instead of escalating to
broader deletion.
