Skip to content

backup ​

Backup apps to local and remote storage.

Usage ​

sh
mithrandir backup [app]
mithrandir backup list [local|remote]
mithrandir backup delete [--yes] <local|remote> [date]
mithrandir backup verify [options] [date]
mithrandir backup config
mithrandir backup remote <add|list|remove>

Arguments ​

ArgumentDescription
appOptional. Specific app to backup. If omitted, backs up all apps in APPS config

Subcommands ​

backup list ​

List existing backups.

sh
mithrandir backup list [local|remote]
ArgumentDescription
localList only local backups
remoteList only remote backups

If no argument is given, lists both local and remote backups.

backup delete ​

Delete backups by location and optional date.

sh
mithrandir backup delete [--yes] <local|remote> [date]
ArgumentDescription
local or remoteRequired. Which backups to delete
dateOptional. Date in YYYY-MM-DD format. If omitted, prompts for selection
FlagDescription
--yes, -ySkip confirmation prompt

backup verify ​

Verify the integrity of backup archives.

sh
mithrandir backup verify [options] [date]
ArgumentDescription
dateOptional. Date in YYYY-MM-DD format. Defaults to latest
FlagDescription
--remote, -rVerify remote backups instead of local
--extract, -xTest extraction during verification

backup config ​

Interactively view and edit backup settings.

sh
mithrandir backup config

Walks through each backup setting one by one, showing the current value and prompting for a new one. Press Enter to keep the current value.

SettingDefaultDescription
BACKUP_DIR/backupsLocal backup directory
LOCAL_RETENTION5Number of local backups to keep
REMOTE_RETENTION10Number of remote backups to keep
RCLONE_REMOTESgdriveComma-separated list of rclone remote names
APPSautoApps to backup — auto for all installed, or comma-separated list
BACKUP_HOUR2Hour of the day (0-23) when automatic backups run
BACKUP_PASSWORD(none)Optional encryption password (input is masked)

If BACKUP_HOUR is changed and systemd is available, the backup timer is automatically updated to the new schedule.

backup remote ​

Manage rclone remotes used for backup syncing.

sh
mithrandir backup remote add
mithrandir backup remote list
mithrandir backup remote remove
SubcommandDescription
addInteractively add a new rclone remote to RCLONE_REMOTES
listList all configured remotes and their status
removeRemove a remote from RCLONE_REMOTES

These commands update the RCLONE_REMOTES variable in .env. The underlying rclone remote configuration (credentials, tokens) is managed separately via rclone config or automatic setup.

Description ​

Creates timestamped tar archives of each app's configuration and data directories. Archives are stored locally in BACKUP_DIR (default /backups) and synced to all configured rclone remotes.

Old backups are automatically pruned based on LOCAL_RETENTION and REMOTE_RETENTION settings.

Non-TTY Mode ​

When run from a systemd timer or non-interactive shell, the backup command outputs timestamped plaintext logs to stdout and /var/log/homelab-backup.log instead of the interactive UI.

Encryption ​

When BACKUP_PASSWORD is set in .env, all backups are encrypted with AES-256-CBC (via openssl) after creation. Encrypted files use the .tar.zst.enc extension. Restore and verify commands detect encrypted files automatically and decrypt using the same password.

If a backup is encrypted but no password is available:

  • Restore/recover: Fails with an error message
  • Verify: Reports "encrypted" and passes (size check only)
VariableDefaultDescription
BACKUP_DIR/backupsLocal backup directory
LOCAL_RETENTION5Number of local backups to keep
REMOTE_RETENTION10Number of remote backups to keep
RCLONE_REMOTESgdriveComma-separated list of rclone remote names
APPSautoComma-separated app list, or auto for all installed
BACKUP_HOUR2Hour of the day (0-23) when automatic backups run
BACKUP_PASSWORD(none)Optional encryption password for backups