Storage and recovery
This page explains where Gardience keeps its data, how to choose and change the disk it lives on, and what to do when a disk or the whole server is lost. For the backup and restore commands themselves, see Backup and restore.
Where the data lives
#Gardience keeps two kinds of files on its server.
The install folder (/opt/gardience unless you chose another with --dir) holds the configuration. It is small, usually a few megabytes, and changes rarely. It contains the users and roles, the license, the TLS certificate, the audit log key and checkpoint (in config/state), the generated Salt and web server settings, the pillar (srv/pillar, with system locks and drift rules), .env, and compose.yml.
The live data is what grows. By default it is in four Docker volumes named after the install (the project name, gardience-server unless you chose another with --name):
| Volume | What is in it | Kind of files |
|---|---|---|
gardience-server_gardiencedata | Everything the console knows: machines, runs, runbooks, workflows, schedules, groups, settings, API keys, the vault and its key, compliance results, the CVE and container vulnerability databases, and the audit log | JSON files written in one piece (a crash leaves the old file or the new one), SQLite databases, and the audit log as append-only files that are sealed every 50 MB and never written again |
gardience-server_saltpki | The Salt master's key and every accepted agent's key | Plain key files |
gardience-server_saltcache | The Salt job cache (kept one hour) and sign-in sessions | Plain files |
gardience-server_updatescache | The Linux update cache, when you turn it on | Package files, up to 50 GB by default |
Docker keeps volumes in its own folder, /var/lib/docker/volumes on most servers, which is usually on the same disk as the operating system.
How big it grows
#The data volume starts small and grows mostly with the audit log, run history, and the vulnerability databases. Plan on the disk sizes in Requirements: 40 GB for up to 1,000 machines, 100 GB for up to 5,000, and 200 GB for up to 10,000. Add up to 50 GB if you turn on the update cache. gardience doctor and the console warn you when the disk that holds the data is nearly full.
Choosing a disk
#A disk of its own for the live data is the better choice on any server you will keep:
- a full data disk cannot fill the operating system's disk, and the reverse
- the data disk can be grown, snapshotted, or moved to a new server on its own
- a failed operating system disk leaves the data disk whole
Live data must be on storage the server sees as a local disk. These are supported:
- a second local disk (SATA, SAS, or NVMe), or a RAID volume
- SAN storage over iSCSI or Fibre Channel
- AWS EBS volumes
- Azure managed disks, and the block disks of other clouds and hypervisors (VMware, Hyper-V, Proxmox)
These are not supported for live data, and Gardience refuses them:
- NFS, including AWS EFS
- SMB or CIFS shares, including Azure Files
- sshfs and other FUSE file systems
- shared folders of a virtual machine (9p, virtiofs, VirtualBox and Parallels shared folders)
- memory file systems (tmpfs and ramfs), and temporary folders (
/tmp,/var/tmp, and/dev/shm), which the system may empty at any restart - system folders, Docker's own folders, and the install's configuration folders
Gardience judges a folder by where it really leads: .. and links are resolved first, so /data/../etc/gardience, or a link that points into a system folder, is refused like the folder it leads to.
The reason is that the live data holds SQLite databases and lock files. Over a network file system, a short network drop, a cached write, or a lock the share does not honor can corrupt a database or let two writers in at once, and the damage often shows up days later. A network share is the right place for backups, which are written once and read back whole.
Put the data on another disk
#On a new install
#Mount the disk first and make the mount permanent in /etc/fstab, then give the installer the folder with --data-dir:
sudo mkfs.xfs /dev/nvme1n1
sudo mkdir -p /data
echo "UUID=$(sudo blkid -s UUID -o value /dev/nvme1n1) /data xfs defaults,nofail 0 2" | sudo tee -a /etc/fstab
sudo mount /data
sudo ./install/install.sh --data-dir /data/gardienceThe installer puts the four kinds of live data in folders under /data/gardience (gardiencedata, saltpki, saltcache, and updatescache) instead of Docker volumes, and writes a marker file, .gardience-data, next to them. It also tells Docker to start after the disk is mounted when the server boots. On a server with SELinux enforcing (Red Hat Enterprise Linux, Rocky, Alma, and Oracle Linux), it labels the folder for containers (container_file_t, kept with semanage fcontext when it is installed), as Docker's own volumes are.
If the disk is ever missing (a line missing from /etc/fstab, a detached cloud volume), Gardience does not start rather than start empty, and every gardience command that reads the data says the disk is not mounted. Starting empty would make a new Salt master key that none of your agents trust.
On an existing install
#gardience move-data moves the live data of a running install to a new folder:
sudo /opt/gardience/gardience move-data /data/gardienceIt does this, in order:
- Checks that the folder is on a local or block disk (it refuses a network file system, a memory file system, a temporary folder, or a system folder with the reason), that it is empty, and that the disk has room for the data plus a margin. With automatic failover on, it refuses a move that would stop the console for longer than failover waits: turn failover off on both servers first (
gardience autofailover off), move, then turn it on again. - Shows what it will move and asks you to confirm (
--yesskips the question). - Stops Gardience and copies the four kinds of live data, keeping owners, permissions, and links.
- Compares the copy with the original, file by file, by SHA-256 checksum.
- Switches the install to the new folder, starts Gardience, waits for the console to be ready, and checks that the audit log chain is intact with every entry it had before.
Gardience is stopped for the copy, about a minute for each gigabyte of data. If any step fails, it puts everything back as it was: the old location, the old settings, and Gardience running from them, and it removes the partial copy.
The old copy stays where it was. When you have checked that Gardience works from the new disk, make a backup (a scheduled one, Back up now on the Backups page, or gardience backup FILE), then remove the old copy:
sudo /opt/gardience/gardience move-data --confirm
# or, after a backup made by hand:
sudo /opt/gardience/gardience move-data --confirm --backup /backups/gardience-after-move.tar.gz.encThe old copy is the only other copy of your data, so --confirm removes it only when the new disk is mounted (its marker file is there, on the disk it was moved to), the console is healthy, and a backup was made since the move. Otherwise it says which check failed and removes nothing.
Until you do, gardience doctor reminds you that the old copy is still there. gardience move-data status shows where the live data is.
Backups
#Backups are encrypted with this server's backup key before they leave it (see Backup and restore). Schedule them under Administration > Backups to one of these:
- A folder on the server, where you mount a network share (NFS or SMB) or a USB disk. This is the right use of a network share. Keep the share's mount in
/etc/fstabso it is there after a restart. - S3-compatible storage, including Amazon S3 (also in AWS GovCloud), Backblaze B2, Wasabi, Cloudflare R2, and MinIO. Give Gardience a key that can only write, list, and delete in its bucket. Each backup goes up as one file of up to 5 GB.
- An SFTP server. Gardience makes its own key pair and shows you the public key to authorize.
Keep a copy of the backup key (config/backup.key) in your password manager. Restoring on a new server needs it.
Warnings
#gardience doctor and the console (on the overview and the Backups page, for admins) warn you, and never block anything, when:
- no scheduled backup goes off this server (to S3, SFTP, a network share, or another disk)
- the newest good backup is older than its schedule
- the disk that holds the live data is nearly full (less than 15 percent or 5 GB free)
- the live data is on the operating system's disk and no backup goes off the server
Recovery
#Each scenario below ends with every agent reconnecting with its existing key, so no machine needs to be approved again. That works because the backup holds the Salt master's key and every agent's key. Agents find the server by the name or address they were set up with, so give the new server that name or address, or point the DNS name at it.
The data disk fails, the server is fine
#- Attach a new disk, format it, and mount it where the old one was (the same folder as in
.env,GARDIENCE_DATA_DIR). Keep the line in/etc/fstab. Make the empty folders and the marker that tell Gardience the disk is there:
sudo mkdir -p /data/gardience/{gardiencedata,saltpki,saltcache,updatescache} echo "restored $(date -u +%F)" | sudo tee /data/gardience/.gardience-dataRestore the newest backup:
sudo /opt/gardience/gardience restore /mnt/backups/gardience-scheduled-20261119-020000.tar.gz.encOn the same server, the restore finds the backup key by itself.
- Run
sudo /opt/gardience/gardience doctor. Agents reconnect within a few minutes.
If the data was in Docker volumes on the operating system's disk and that disk failed, follow the next scenario.
The whole server is lost, with a warm standby
#Promote the standby. On the standby:
sudo /opt/gardience/gardience promoteThe console is back in about a minute, and agents set up with both addresses move to it on their own. See High availability for the details and for making a new standby afterwards.
The whole server is lost, no standby
#- Build a new server with the same name or address the agents use (or point that DNS name at it afterwards).
Install the same Gardience release there. To keep the data on a disk of its own, mount it first and use
--data-dir:sudo ./install/install.sh --data-dir /data/gardience --license license.jsonCopy the newest backup and its
.sha256and.macfiles to the new server, for example from S3:aws s3 cp s3://your-bucket/gardience/ /root/restore/ --recursive --exclude '*' --include 'gardience-scheduled-20261119-020000*'Restore it with the backup key from your password manager:
sudo /opt/gardience/gardience restore /root/restore/gardience-scheduled-20261119-020000.tar.gz.enc \ --passphrase-file /root/backup.key- Run
sudo /opt/gardience/gardience doctor, sign in, and check Machines. Agents reconnect within a few minutes with their existing keys. - If the server managed itself (see Manage the Gardience server itself), run
sudo /opt/gardience/gardience manage-selfagain on the new server. Its own agent is new, so it joins again.
Test it
#Run a recovery drill at least once a year: install on a spare server, restore a real backup, and check that every machine reconnects.