LinuxCommandLibrary

tdbbackup.tdbtools

Backup and restore TDB databases

SYNOPSIS

tdbbackup [-v] source_tdb_file destination_backup_file
tdbbackup [-v] -s source_tdb_file -d destination_backup_file

PARAMETERS

source_tdb_file
    The path to the TDB file to be backed up. This can be provided as a positional argument.

destination_backup_file
    The path where the consistent backup copy will be saved. This can be provided as a positional argument.

-s source_tdb_file
    Specifies the path to the TDB file to be backed up, using an explicit option.

-d destination_backup_file
    Specifies the path where the consistent backup copy will be saved, using an explicit option.

-v
    Enables verbose output, providing more detailed information about the backup process to standard output.

-h, --help
    Displays a brief help message with command usage and available options, then exits.

--version
    Prints the tdbbackup version information to standard output and exits.

DESCRIPTION

tdbbackup is a utility from the tdbtools suite designed for creating consistent backups of TDB (Trivial Database) files. TDB files are lightweight databases often used by Samba and other applications for storing various types of data, such as user credentials, group mappings, or internal state.

The primary challenge with backing up live database files is ensuring data consistency. If a database is being written to during a backup operation, the resulting backup file might be corrupt or contain inconsistent data. tdbbackup addresses this by internally acquiring a lock on the source TDB file, copying its contents to a specified destination, and then releasing the lock. This guarantees that the backup copy reflects a single, consistent state of the database, even if it's actively in use.

This command is particularly vital for Samba administrators who need to regularly back up critical TDB files like secrets.tdb, passdb.tdb, or group_mapping.tdb without interrupting Samba services or risking data corruption. It ensures data integrity for recovery operations.

CAVEATS

tdbbackup requires appropriate file system permissions to read the source TDB file and write to the specified destination path. The TDB file must be unlockable by tdbbackup; if another process holds an exclusive lock preventing advisory locking, the backup might fail. While tdbbackup uses advisory locking to ensure consistency, it relies on other applications (like Samba) also respecting these locks.

CONSISTENCY GUARANTEE

tdbbackup ensures a consistent snapshot of the TDB file by acquiring a lock on the file before initiating the copy. This critical step prevents partial or corrupt backups that could occur if the file were modified by another process during the copy operation, guaranteeing a reliable point-in-time backup.

USAGE WITH SAMBA

For Samba administrators, tdbbackup is essential for regularly backing up critical TDB files such as /var/lib/samba/private/secrets.tdb, /var/lib/samba/private/passdb.tdb, and /var/lib/samba/group_mapping.tdb. Incorporating regular tdbbackup operations into backup routines is a key part of disaster recovery planning for Samba environments.

HISTORY

tdbbackup is an integral part of the tdbtools suite, which emerged from the development efforts behind Samba. The TDB (Trivial Database) library was created to provide a lightweight, robust, and fast key-value store for Samba's internal operations, particularly for scenarios requiring concurrent access from multiple processes. As Samba became a critical component in network infrastructures, the need for reliable backup mechanisms for its persistent data, often stored in TDB files, became paramount. tdbbackup was specifically developed to address the challenge of backing up these live TDB files consistently, leveraging the TDB library's locking mechanisms to ensure data integrity during the backup process. Its evolution closely tracks the increasing reliance on TDB files within the Samba project.

SEE ALSO

tdbtool(8), samba(8), tdb(3)

Copied to clipboard