Persistence - Thinstation/thinstation GitHub Wiki
Persistent Files and Mount Points
Version 7.0 introduces a new persistent-files service, enhancing how configurations and data persist across boots. This addition requires a dedicated mount point for /var/prstnt, alongside traditional mount points such as /boot and /home. Below, we outline the differences between earlier versions and 7.0, and provide clear instructions for setting up persistent storage.
Differences Between Versions
Prior to Version 7.0:
- Mount Points:
- The typical setup included mount points for
/bootand/home. - These mount points functioned as expected, but there was no service to specifically manage persistence for individual files.
- The typical setup included mount points for
- Persistence:
- Files persisted implicitly based on the contents of the
/homedirectory or other user-defined partitions.
- Files persisted implicitly based on the contents of the
New in Version 7.0:
- Persistent-Files Service:
- Introduces fine-grained control over file persistence. Specific files must be explicitly listed in configuration files under
/etc/persistent-files.d/. - Files not explicitly listed are not retained across boots, even if they reside in
/var/prstntor other monitored directories.
- Introduces fine-grained control over file persistence. Specific files must be explicitly listed in configuration files under
- New Mount Point for
/var/prstnt:- A dedicated EXT4 partition mounted at
/var/prstntis required to store persistent files managed by thepersistent-filesservice. - Existing mount points for
/bootand/homeremain unchanged.
- A dedicated EXT4 partition mounted at
Step 1: Setting up Mount Points
To configure the required mount points, update your thinstation.conf.buildtime file as follows:
MOUNT_0="LABEL=boot /boot auto x-mount.mkdir,defaults 0 0"
MOUNT_1="LABEL=home /home auto x-mount.mkdir,defaults 0 0"
MOUNT_2="LABEL=prstnt /var/prstnt auto x-mount.mkdir,defaults 0 0"
- Explanation:
LABEL=boot: For the boot partition (FAT32). Needed if booting from flash or hdLABEL=home: For the home partition (EXT4). Needed if you want user settings to persistLABEL=prstnt: A new EXT4 partition dedicated to the persistent-files service.
Partitioning the Drive
- Example, create three partitions:
- FAT32 labeled
boot. - EXT4 labeled
home. - EXT4 labeled
prstnt.
- FAT32 labeled
- The
/ts/bin/flashscript can automate this process if the drive is installed in the build system.
Step 2: Configuring the Persistent-Files Service
-
File-Based Persistence:
- The
persistent-filesservice requires explicit definitions of files to persist. - Create configuration files under
/build/packages/mypackage/etc/persistent-files.d/, naming them descriptively (e.g.,mypackage.conf).
Example:
/build/packages/mypackage/etc/persistent-files.d/mypackage.conf/etc/myapp/config.ini - The
-
Granular File Control:
- Persistence is determined by file paths listed in the configuration files.
- Directory monitoring does not persist all contents by default; only the explicitly listed files will persist.
-
Verify Setup:
- After setup, ensure
/var/prstntis mounted and files specified in/etc/persistent-files.d/persist across reboots.
- After setup, ensure
Step 3: Testing the Configuration
-
Mount Points:
- Confirm
/var/prstnt,/boot, and/homeare correctly mounted using themountcommand or inspecting/etc/fstab.
- Confirm
-
File Persistence:
- Reboot the system and verify that only the files listed in
/etc/persistent-files.d/are retained across boots.
- Reboot the system and verify that only the files listed in
Notes and Recommendations
-
Backward Compatibility:
- For systems upgraded from earlier versions, ensure that a
/var/prstntpartition is created and configured. - Without this mount point, the
persistent-filesservice will not function correctly in version 7.0.
- For systems upgraded from earlier versions, ensure that a
-
Advanced Mount Points:
- Additional partitions can be defined using the same syntax in
thinstation.conf.buildtime.
- Additional partitions can be defined using the same syntax in
-
Legacy Behavior:
- Mount points like
/bootand/homestill operate as they did in prior versions, but persistence for specific files now depends on thepersistent-filesservice.
- Mount points like
With these instructions, you can seamlessly transition from earlier versions to 7.0 while taking advantage of the enhanced persistent file management system.