Skip to content

Storage Backup and Recovery

alexphillips-dev edited this page Nov 4, 2026 · 1 revision

Storage, backup, and recovery

Location Purpose
/boot/config/plugins/dvm/dvm.cfg Persistent plugin settings.
/boot/config/plugins/dvm/vnstat/ Persistent supported configuration/action files.
/etc/vnstat/ Runtime configuration and action scripts.
/etc/vnstat.conf Standard configuration link used by vnStat tools.
Effective DatabaseDir + /vnstat.db Active SQLite database; default /var/lib/vnstat/vnstat.db.
/boot/config/plugins/dvm/vnstat.db Database backup when persistence is enabled.
/boot/config/plugins/dvm/vnstat.db.path Source path and SHA-256 metadata for new backups.
/boot/config/plugins/dvm/vnstat.previous.tar Previous verified database generation and its path/checksum metadata.
/var/run/dvm/outcomes/ Temporary per-rule automation outcomes; cleared by Reset All and uninstall.
/usr/local/emhttp/plugins/dvm/ Installed web UI, scripts, and assets.
/etc/rc.d/rc.vnstat Service, configuration, and backup entry point.

Reboot persistence

When enabled, the service installs and verifies its own marked shutdown hook. It supports shell-script layouts without relying on a particular host comment, preserves unrelated host content, and reports an error if the hook cannot be installed safely. Backup failure is logged without interrupting the host's remaining shutdown steps. Disabling persistence or uninstalling removes the exact managed hook (or its recognized legacy line), leaving unrelated host hooks and commands intact.

The service restores a matching backup when the configured runtime database is missing. Existing runtime data is retained. Configuration restore excludes database/SQLite companion files, preventing a stale configuration mirror from replacing current traffic history.

New backups bind their source path to a checksum. Before publishing a new backup, the previous valid generation is retained as one archive. Restoration tries the current backup first and then the retained generation; each must match the configured path and its checksum. An invalid current backup cannot replace a valid retained generation. A restore is staged and checked before the runtime database is created, so a failed copy does not leave a partial database there.

Older untagged backups are treated as belonging to the default database location. Persistence preserves successfully backed-up data; it cannot reconstruct traffic lost before a successful backup. An older fallback naturally omits traffic recorded after that generation.

Keep an independent copy before migration, reset, or removal. The plugin's flash backups, including the retained generation, are deleted during Reset All and uninstall.

Custom locations and manual backups

Stop the service before editing DatabaseDir or PidFile in vnstat.conf. The editor checks effective configuration and rejects changes to those paths while running. Status detection does not assume the default PID filename.

Changing DatabaseDir does not move history. With the service stopped, move/copy the database deliberately, set appropriate ownership/permissions, and verify configuration before starting. An old-path backup is not silently restored into a different location. Both resets retain the selected database directory.

On an installed Unraid host, a manual plugin backup uses:

/etc/rc.d/rc.vnstat backup_db

This command stops the service and respects the persistence setting. Check its exit status/output and restart explicitly when ready:

/etc/rc.d/rc.vnstat start

Clone this wiki locally