How to get comments?

omgs

Renowned Member
Aug 19, 2016
81
5
73
59
Hi.

I'm reading the docs and am unable to find an option to store a comment via proxmox-backup-client, similar to vzdump notes in the gui. Is this possible?
 
Hi!

If I understood you correctly, then yes, you can do that! There's the subcommand snapshot notes show <snapshot> and snapshot notes update <snapshot> <new-note> for the Proxmox Backup client. So if I want to change the note of some backup I could do:

Bash:
proxmox-backup-client snapshot notes update "ct/123/2024-11-28T14:08:00Z" "Some new note" --repository mydatastore

The same can be done from the PBS WebGUI when double clicking on the "Comment" of a backup snapshot in Datastore > mydatastore > Content, expanding the specific backup group.
 
Ok, but I think there's an issue on that. If I have a script where I backup something, and later want to create a comment, how do I find the ID of the backup I've just done?
 
It depends on how you have written your scripts, but you could retrieve it either from the output of the vzdump command, e.g. for the container with the vmid 123 on the PVE node mynode and for the PBS instance pbs:

Bash:
$ vzdump 123 --mode snapshot --node mynode --remove 0 --storage pbs | grep "creating.*archive" | grep -o "ct/123/[^']*"
ct/123/2024-11-29T09:00:00Z

or getting the latest snapshot for a backup group (which is just the format + the vmid), e.g. for a VM with vmid 456:

Bash:
$ proxmox-backup-client snapshot list "vm/456" --repository mydatastore --output-format json | jq ".[-1]"
{
    "backup-id": "456",
    "backup-time": ...,
    "backup-type": "vm",
    ...
}

The second option would require you to format the snapshot name from the first three parameters, so the first option would probably be easier to use.