|
| 1 | +--- |
| 2 | +title: Persistent storage |
| 3 | +sidebar_position: 4 |
| 4 | +--- |
| 5 | + |
| 6 | +EigenCompute provides a persistent storage volume that survives application upgrades. The boot disk is replaced during image updates, but user data lives on an independent persistent disk that is reattached to the new VM. This means your workload state persists across upgrades, not just reboots. |
| 7 | + |
| 8 | +## Storage path |
| 9 | + |
| 10 | +All persistent data should be written to: |
| 11 | + |
| 12 | +``` |
| 13 | +/mnt/disks/userdata |
| 14 | +``` |
| 15 | + |
| 16 | +This path is also available via the environment variable `USER_PERSISTENT_DATA_PATH`: |
| 17 | + |
| 18 | +```bash |
| 19 | +echo $USER_PERSISTENT_DATA_PATH |
| 20 | +# /mnt/disks/userdata |
| 21 | +``` |
| 22 | + |
| 23 | +Use this environment variable in your application code to stay forward-compatible if the mount path ever changes. |
| 24 | + |
| 25 | +## Example usage |
| 26 | + |
| 27 | +Write any data you need to persist (databases, configuration, caches) under the persistent storage path: |
| 28 | + |
| 29 | +```python |
| 30 | +import os |
| 31 | + |
| 32 | +data_dir = os.environ.get("USER_PERSISTENT_DATA_PATH", "/mnt/disks/userdata") |
| 33 | + |
| 34 | +# Store a SQLite database |
| 35 | +db_path = os.path.join(data_dir, "myapp.db") |
| 36 | + |
| 37 | +# Store application state |
| 38 | +state_path = os.path.join(data_dir, "state.json") |
| 39 | +``` |
| 40 | + |
| 41 | +```go |
| 42 | +dataDir := os.Getenv("USER_PERSISTENT_DATA_PATH") |
| 43 | +if dataDir == "" { |
| 44 | + dataDir = "/mnt/disks/userdata" |
| 45 | +} |
| 46 | +dbPath := filepath.Join(dataDir, "myapp.db") |
| 47 | +``` |
| 48 | + |
| 49 | +## How it works |
| 50 | + |
| 51 | +The persistent storage volume is encrypted and managed automatically by the platform: |
| 52 | + |
| 53 | +- **With a secondary disk attached** — The volume uses a LUKS-encrypted disk that is formatted on first boot and reopened on subsequent boots. |
| 54 | +- **Without a secondary disk** — The platform falls back to a directory on the boot disk that is already encrypted by the platform. |
| 55 | + |
| 56 | +In both cases, the data is available at the same `/mnt/disks/userdata` path and your application code does not need to change. |
| 57 | + |
| 58 | +For more details, see the [Persistent Storage Design Spec](https://github.com/Layr-Labs/go-tpm-tools/blob/main/specs/design-persistent-storage.md). |
0 commit comments