Gardience Documentation gardience.com →
Docs / Administration

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):

VolumeWhat is in itKind of files
gardience-server_gardiencedataEverything 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 logJSON 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_saltpkiThe Salt master's key and every accepted agent's keyPlain key files
gardience-server_saltcacheThe Salt job cache (kept one hour) and sign-in sessionsPlain files
gardience-server_updatescacheThe Linux update cache, when you turn it onPackage 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:

Live data must be on storage the server sees as a local disk. These are supported:

These are not supported for live data, and Gardience refuses them:

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/gardience

The 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/gardience

It does this, in order:

  1. 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.
  2. Shows what it will move and asks you to confirm (--yes skips the question).
  3. Stops Gardience and copies the four kinds of live data, keeping owners, permissions, and links.
  4. Compares the copy with the original, file by file, by SHA-256 checksum.
  5. 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.enc

The 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:

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:

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

#
  1. 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.
  2. 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-data
  3. Restore the newest backup:

    sudo /opt/gardience/gardience restore /mnt/backups/gardience-scheduled-20261119-020000.tar.gz.enc

    On the same server, the restore finds the backup key by itself.

  4. 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 promote

The 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

#
  1. Build a new server with the same name or address the agents use (or point that DNS name at it afterwards).
  2. 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.json
  3. Copy the newest backup and its .sha256 and .mac files to the new server, for example from S3:

    aws s3 cp s3://your-bucket/gardience/ /root/restore/ --recursive --exclude '*' --include 'gardience-scheduled-20261119-020000*'
  4. 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
  5. Run sudo /opt/gardience/gardience doctor, sign in, and check Machines. Agents reconnect within a few minutes with their existing keys.
  6. If the server managed itself (see Manage the Gardience server itself), run sudo /opt/gardience/gardience manage-self again 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.

#
Gardience by Bouziden Management LLC.