borgmatic

SQLite

πŸ”

New in version 1.7.9 To backup SQLite with borgmatic, use the sqlite_databases: hook. For example:

sqlite_databases:
    - name: mydb
      path: /var/lib/sqlite3/mydb.sqlite

Full configuration

# List of one or more SQLite databases to dump before creating a
# backup, run once per configuration file. The database dumps are
# added to your source directories at runtime and streamed directly to
# Borg. Requires the sqlite3 command. See https://sqlite.org/cli.html
# for details.
sqlite_databases:
    # This is used to tag the database dump file with a name.
    # It is not the path to the database file itself. The name
    # "all" has no special meaning for SQLite databases.
    - name: users

      # Path to the SQLite database file to dump. If relative,
      # it is relative to the current working directory. Note
      # that using this database hook implicitly enables
      # read_special (see above) to support dump and restore
      # streaming.
      path: /var/lib/sqlite/users.db

      # Label to identify the database dump in the backup.
      label: my_backup_label

      # Path to the SQLite database file to restore to. Defaults
      # to the "path" option.
      restore_path: /var/lib/sqlite/users.db

      # Command to use instead of "sqlite3". This can be used to
      # run a specific sqlite3 version (e.g., one inside a
      # running container). If you run it from within a
      # container, make sure to mount the path in the
      # "user_runtime_directory" option from the host into the
      # container at the same location. Defaults to "sqlite3".
      sqlite_command: docker exec sqlite_container sqlite3

      # Command to run when restoring a database instead
      # of "sqlite3". This can be used to run a specific 
      # sqlite3 version (e.g., one inside a running container). 
      # Defaults to "sqlite3".
      sqlite_restore_command: docker exec sqlite_container sqlite3

Improve this documentation

Have an idea on how to make this documentation even better? Use our issue tracker to send your feedback!