Filesystem and Overlay Management
The cube:evk uses a fail-safe filesystem layout for embedded systems. It supports atomic software updates with rollback, and isolates user-level changes from the base system.
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 lets the cube:evk 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; the underlying root filesystem stays untouched.
Read-only System Partitions
The cube:evk uses dual read-only system partitions (A/B scheme) and a writable overlay partition. This layout supports rollback and isolates user-level changes from the base system.
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, the operations affect only the overlay layer. From the user's perspective the system appears writable; in practice, changes are stored separately and can be 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 (for example, 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 useful for automation scripts or before running irreversible operations.
Overlay Control
cube-overlay provides visibility and control over the writable overlay layer. Developers can inspect, audit, and restore changes 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.
Updates are atomic, fail-safe, and reversible, including during power loss or interruption.
Software Updates
The A/B update scheme combined with OverlayFS and cube-overlay supports safe software updates on the cube:evk while preserving user modifications.

