examples/

directory
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 16, 2026 License: AGPL-3.0

README

Examples

Complete backups with a single gopbs.Backup call: scan -> plan -> generate -> chunk -> deduplicate -> upload -> catalog -> manifest -> finish, fully streamed.

Example What it shows
backup-sync Fully synchronous generation (Archive.Workers: 1); -exclude (repeatable, proxmox-backup-client --exclude syntax) and -pxarexclude show exclusions.
backup-async Asynchronous generation (the default): parallel payload reads reassembled in order — byte-identical output, much faster on many-file trees.
backup-streams Multiple streams of data — virtual files that exist nowhere on disk — under a virtual root: buffered generated content, file-backed streams, and pure readers of pre-known size.
backup-v2 v2 split archives (Format: gopbs.FormatV2): metadata and payload streams uploaded concurrently as two indexes — metadata-only changes leave the payload stream fully deduplicated. Restore needs proxmox-backup-client ≥ 3.2.
restore gopbs.Restore: the newest snapshot (or -time) into a directory, whole or -path subtrees, encrypted backups via -keyfile or -master-key; -list prints the tree via gopbs.Browse.
restore-stream Reading back: ListSnapshots, a reader session on the newest snapshot, and one dynamic index (e.g. an UploadStream database file) copied out as a verified byte stream.

All of them default to the docker test stack from tests/compose.yml (the directory-based ones back up /tmp):

cd tests && docker compose up -d garage pmoxs3 && cd ..
go run ./examples/backup-sync
go run ./examples/backup-sync -exclude '*.log' -exclude 'cache/' -pxarexclude
go run ./examples/backup-async     # run twice (a couple of seconds apart) to see dedup at work
go run ./examples/backup-v2        # split mpxar/ppxar upload
go run ./examples/restore -list                     # browse the newest snapshot of this host
go run ./examples/restore -target /tmp/restored     # restore it
go run ./examples/restore-stream -id "$(hostname)" -archive root.pxar -out /tmp/root.pxar

Point them at a real server with -url, -username, -realm, -password, -fingerprint, -datastore, -source and -id. For the lower-level building blocks (sessions, manual chunk uploads, custom dedup) see the pbs package documentation and tests/pbs_test.go.

Directories

Path Synopsis
Command backup-async backs up a directory to Proxmox Backup Server with a single gopbs.Backup call, using asynchronous archive generation (the library default): the tree layout is planned first, then a pool of workers reads file contents in parallel while the stream is chunked, deduplicated against the previous snapshot, and uploaded concurrently.
Command backup-async backs up a directory to Proxmox Backup Server with a single gopbs.Backup call, using asynchronous archive generation (the library default): the tree layout is planned first, then a pool of workers reads file contents in parallel while the stream is chunked, deduplicated against the previous snapshot, and uploaded concurrently.
Command backup-streams backs up multiple streams of data — virtual files that exist nowhere on disk — in one gopbs.Backup call.
Command backup-streams backs up multiple streams of data — virtual files that exist nowhere on disk — in one gopbs.Backup call.
Command backup-sync backs up a directory to Proxmox Backup Server with a single gopbs.Backup call, using fully synchronous archive generation (Archive.Workers: 1): one goroutine walks the tree and reads contents, producing byte-identical output to the asynchronous default.
Command backup-sync backs up a directory to Proxmox Backup Server with a single gopbs.Backup call, using fully synchronous archive generation (Archive.Workers: 1): one goroutine walks the tree and reads contents, producing byte-identical output to the asynchronous default.
Command backup-v2 backs up a directory to Proxmox Backup Server as a v2 split archive: one gopbs.Backup call with Format: gopbs.FormatV2 uploads a metadata stream (<name>.mpxar.didx) and a payload stream (<name>.ppxar.didx) as two dynamic indexes, generated and uploaded concurrently.
Command backup-v2 backs up a directory to Proxmox Backup Server as a v2 split archive: one gopbs.Backup call with Format: gopbs.FormatV2 uploads a metadata stream (<name>.mpxar.didx) and a payload stream (<name>.ppxar.didx) as two dynamic indexes, generated and uploaded concurrently.
Command restore restores an archive from Proxmox Backup Server into a directory with a single gopbs.Restore call: the newest snapshot of the backup group by default, the whole archive or only the -path entries, v1 or v2 (told apart by the snapshot manifest).
Command restore restores an archive from Proxmox Backup Server into a directory with a single gopbs.Restore call: the newest snapshot of the backup group by default, the whole archive or only the -path entries, v1 or v2 (told apart by the snapshot manifest).
Command restore-stream copies one dynamic index of a backup group's newest snapshot to a file.
Command restore-stream copies one dynamic index of a backup group's newest snapshot to a file.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL