Skip to content

Backup Format

konna edited this page Jun 9, 2025 · 1 revision

Backup Format

Konserve creates backups using the .tar archive format. Each backup includes both the actual files/folders and metadata required for full or partial restoration.


Archive Structure

Each backup is named as:

backup_YYYY-MM-DD_HH-MM-SS.tar

The contents of the archive are:

  • fingerprint.txt: metadata file mapping UUIDs to original paths
  • UUID folders: contain the actual backed-up files and subfolders

fingerprint.txt

This file contains:

  • A fingerprint string
  • A section header [Backup Info]
  • A list of lines in the format:
<UUID>: <original path>

Example:

ABC12345-6789-4ABC-DEF0-1234567890AB: C:\Users\tom\AppData\Roaming\spicetify

Files and Folders in the Archive

Individual Files

If a selected path is a file:

  • It is added directly as a .UUID.ext entry (extension is preserved)
  • Example: ABC12345-6789-4ABC-DEF0-1234567890AB.png

Folders

If a folder is selected:

  • A UUID is generated for the folder
  • Each file inside the folder is added under a directory named with that UUID
  • Original structure is preserved inside that folder using relative paths
  • Example:
    ABC12345-6789-4ABC-DEF0-1234567890AB/
        settings.json
        themes/
            dark.json
    

Backup Flow Summary

  1. Each selected file/folder gets a UUID
  2. fingerprint.txt is built and written first
  3. Files are copied into the archive:
    • Files go directly in as .UUID.ext
    • Folder contents are added under UUID/ structure
  4. Progress is updated as each file is processed
  5. The .tar file is finalized

Implementation Notes

  • Archives are created using the tar crate
  • Metadata such as file permissions and timestamps are preserved via Header::set_metadata
  • Each entry uses Header::new_gnu() and set_cksum() to ensure valid structure
  • No compression is used by default

Compatibility

  • TAR archives can be opened with 7-Zip, WinRAR, or standard tar utilities
  • fingerprint.txt can be viewed manually for inspection or recovery
  • The archive is portable and does not require Konserve to extract manually

Next: Restoration Logic

Clone this wiki locally