This feature is available on images newer than 2022.06.20
Sometimes advanced use of PiKVM requires storing some data on disk like API keys, config files, or something like that. For example, you want to have a script that will update SSL certificates once a week. However, the root file system is in a read-only state and does not involve remounting automatically by user scripts.
To solve this problem, new versions of PiKVM have a small 256MiB storage partition that can be used to store that data.
kvmd-pst daemon makes sure that this partition is mounted in read-only all the time, and remounts it to RW
only when some user script requires it. This also solves the problems of simultaneous access, so the RW mode will be
keeped as long as at least one client is working with the storage.
Below is an example of a script
/root/test.sh that wants to save a certain file in PST:
#!/bin/bash echo `date` + $@ > $KVMD_PST_DATA/foo cat $KVMD_PST_DATA/foo
To run it use:
# kvmd-pstrun -- /root/test.sh --some --script --args -- INFO -- Opening PST session ... -- INFO -- PST write is allowed: /var/lib/kvmd/pst/data -- INFO -- Running the process ... Mon Jun 20 04:23:14 MSK 2022 + --some --script --args -- INFO -- Process finished: returncode=0
So, what's going on here:
kvmd-pstrunconnects to the
kvmd-pstdaemon, which manages the mounting of the storage.
If everything is fine, the daemon will remount the storage to RW mode and report the data root to
kvmd-pstrunruns the script and pass the data root path using the environment variable
kvmd-pstdaemon stops or any other daemon error occurs, the script will be killed.
After the script is finished, the daemon will remount the storage to RO mode.
To be able to write to the storage, the user must be a member of
kvmd-pst group, or have to be
The return code will be equal to the script code if it was run, or 1 if a remount error occurred.