Skip to content

Persistence

Donald A. Cupp Jr. edited this page Dec 10, 2024 · 1 revision

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 /boot and /home.
    • These mount points functioned as expected, but there was no service to specifically manage persistence for individual files.
  • Persistence:
    • Files persisted implicitly based on the contents of the /home directory or other user-defined partitions.

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/prstnt or other monitored directories.
  • New Mount Point for /var/prstnt:
    • A dedicated EXT4 partition mounted at /var/prstnt is required to store persistent files managed by the persistent-files service.
    • Existing mount points for /boot and /home remain unchanged.

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 hd
    • LABEL=home: For the home partition (EXT4). Needed if you want user settings to persist
    • LABEL=prstnt: A new EXT4 partition dedicated to the persistent-files service.

Partitioning the Drive

  • Example, create three partitions:
    1. FAT32 labeled boot.
    2. EXT4 labeled home.
    3. EXT4 labeled prstnt.
  • The /ts/bin/flash script can automate this process if the drive is installed in the build system.

Step 2: Configuring the Persistent-Files Service

  1. File-Based Persistence:

    • The persistent-files service 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
    
  2. 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.
  3. Verify Setup:

    • After setup, ensure /var/prstnt is mounted and files specified in /etc/persistent-files.d/ persist across reboots.

Step 3: Testing the Configuration

  1. Mount Points:

    • Confirm /var/prstnt, /boot, and /home are correctly mounted using the mount command or inspecting /etc/fstab.
  2. File Persistence:

    • Reboot the system and verify that only the files listed in /etc/persistent-files.d/ are retained across boots.

Notes and Recommendations

  • Backward Compatibility:

    • For systems upgraded from earlier versions, ensure that a /var/prstnt partition is created and configured.
    • Without this mount point, the persistent-files service will not function correctly in version 7.0.
  • Advanced Mount Points:

    • Additional partitions can be defined using the same syntax in thinstation.conf.buildtime.
  • Legacy Behavior:

    • Mount points like /boot and /home still operate as they did in prior versions, but persistence for specific files now depends on the persistent-files service.

With these instructions, you can seamlessly transition from earlier versions to 7.0 while taking advantage of the enhanced persistent file management system.

Clone this wiki locally