Filesystem and Overlay Management
The cube:evk uses a robust, fail-safe filesystem layout designed specifically for embedded systems. It ensures system reliability during software updates, provides rollback protection, and allows user-level customization without risking system integrity.
1. Filesystem Overview
The system is divided into multiple partitions, each serving a distinct purpose:
| Partition | Type | Description |
|---|---|---|
| rootfsA | Read-only | Active system partition |
| rootfsB | Read-only | Backup system partition |
| overlayfs | Read-write | Overlay partition mounted on top of the root filesystem to store modifications |
This configuration allows the cube:evk to safely update its software while keeping the base system partitions immutable. Changes made by the user or applications are stored in the read-write overlay layer, leaving the underlying root filesystem untouched.
Read-only System Partitions
The cube:evk uses dual read-only system partitions (A/B scheme) and a writable overlay partition. This structure provides reliability, easy rollback, and safe customization typical for embedded systems.
2. Overlay Filesystem (OverlayFS)
The overlay filesystem combines two layers:
- Lower layer: The immutable base filesystem (from rootfsA or rootfsB).
- Upper layer: The writable overlay partition.
When files are created, modified, or deleted, these operations occur only in the overlay layer. From the user’s perspective, the system appears fully writable — but in reality, changes are stored separately and can be easily inspected or reverted.
3. cube-overlay
To simplify inspection and management of the overlay filesystem, the cube:evk includes the command-line utility cube-overlay.
This tool allows you to:
- Inspect filesystem differences (
diff) - Get modification statistics (
status) - Restore specific files or directories to their original state (
restore)
Usage
cube:~$ cube-overlay --helpusage: cube-overlay [-h] [-n] {diff,status,restore} path
positional arguments: {diff,status,restore} path
options: -h, --help show this help message and exit -n, --dry-runInspecting Changes
The diff command lists all changes made under a specified path. Files are categorized as NEW, MOD, DEL, or UKN (unknown/inaccessible).
cube:~$ cube-overlay diff /etcNEW /etc/cniNEW /etc/docker/key.jsonMOD /etc/machine-idDEL /etc/systemd/system/cube.target.wants/led-setup.serviceUKN /etc/wireguardLegend:
- NEW — File or directory created in the overlay
- MOD — File modified relative to the base system
- DEL — File deleted from the overlay view
- UKN — Unknown or inaccessible file (e.g., permission or transient)
This helps developers understand exactly what has changed in the writable layer.
Summarizing Modifications
The status command provides a quick statistical overview of all modifications within a given directory.
cube:~$ cube-overlay status /etcUnmodified: 693Modified: 2Created: 19Deleted: 4Inaccessible: 5This is useful for tracking system drift over time or identifying unexpected changes.
Restoring Files
You can restore individual files or directories to their original state as they exist in the read-only base filesystem. This operation removes their modified or deleted versions from the overlay layer.
cube:~$ sudo cube-overlay restore /etc/ssh/sshd_configAfter restoration, the system will use the original version from the base root filesystem.
Wipe Everything
Use sudo cube-overlay restore / to perform a factory reset and wipe all your data and perform a reboot afterwards.
Dry Run Mode
Use the --dry-run (-n) option to preview what would happen without actually performing changes:
cube:~$ cube-overlay --dry-run restore /etcThis is especially helpful for cautious system administrators and automation scripts.
Fully File Control
cube-overlay provides full visibility and control over the writable overlay layer. It helps developers inspect, audit, and restore changes safely — ensuring system consistency while keeping the base OS untouched.
4. Update and Rollback Mechanism
The SWUpdate framework manages system updates on the cube:evk using the dual-partition scheme.
How it works:
- The active partition (e.g., rootfsA) runs the system.
- A new update is written to the inactive partition (rootfsB).
- After a successful integrity check, the system switches boot targets.
- If boot verification fails, it automatically rolls back to the last known good partition.
This mechanism ensures that updates are atomic, fail-safe, and reversible, even if a power loss or interruption occurs during installation.
Safe Software Updates
The A/B update scheme combined with OverlayFS and cube-overlay provides a resilient and developer-friendly foundation for maintaining the cube:evk. It guarantees safe software updates while preserving user modifications.

