Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with Snapshot Format (Timestamp) and Thinning #250

Closed
norsemangrey opened this issue Mar 26, 2024 · 5 comments
Closed

Issues with Snapshot Format (Timestamp) and Thinning #250

norsemangrey opened this issue Mar 26, 2024 · 5 comments

Comments

@norsemangrey
Copy link

I'm having an issue where old snapshots are not thinned when trying to resolve the snapshot format timestamp to a variable before passing it to the zfs-autobackup function.

I'm running multiple snapshot profiles in the same script and for the purpose of managing the snapshots later I would like them all to have the same timestamp in the snapshot name. Thus I'm trying to do something like in the below example, instead of passing timestamp format like this SNAPSHOT_FORMAT="%Y-%m-%dT%H:%M:%S-auto".

This works fine in that the snapshots are created and with the correct name, but thinning of old snapshots no longer works. Is this a bug, and if not is there another way to accomplish what I'm trying to do?

SOURCE_NAME=host-1
SNAPSHOT_FORMAT="$(date +%Y-%m-%dT%H:%M:%S)-auto"

zfs-autobackup SOURCE_NAME \
                    --keep-source=2 \
                    --property-format=snapshot-base:{} \
                    --snapshot-format $SNAPSHOT_FORMAT \
                    --exclude-received \
                    --progress \
                    --debug-output \
                    --verbose

zfs-autobackup SOURCE_NAME \
                    --keep-source=5,1d1w,1w1m \
                    --property-format=snapshot-pri-1:{} \
                    --snapshot-format $SNAPSHOT_FORMAT \
                    --exclude-received \
                    --progress \
                    --debug-output \
                    --verbose
@psy0rz
Copy link
Owner

psy0rz commented Mar 27, 2024

look at the original snapshot format, there should be a {} in it, that gets filled in with the backup name automaticly.

@norsemangrey
Copy link
Author

I'm probably being dense, but I'm not sure i follow ....

The original snapshot format is this: {}-%Y-%m-%dT%H:%M:%SZ which means my snapshots would be named host-1-<timestamp>. I don't need the snapshot profile- / backup name as part of the snapshot name ... just the timestamp, but I need it to be the same for all profiles in the same script.

@psy0rz
Copy link
Owner

psy0rz commented Mar 27, 2024

uuh why are you calling the date command in your snapshot format line? $(date..)

@norsemangrey
Copy link
Author

norsemangrey commented Mar 27, 2024

Because I want to resolve the timestamp in the variable before passing it the zfs-autobackup function so that I get the the same timestamp for both snapshot profiles....otherwise there will be some seconds difference ..... It was what I was trying to explain above, but I was probably doing a poor job of it xD

@psy0rz
Copy link
Owner

psy0rz commented Aug 13, 2024

You're using a fixed string as snapshot "format". This makes it so that zfs-autobackup cant parse the dates and times of the existing snapshots.

If you just want the timestamp, use --snapshot-format=%Y-%m-%dT%H:%M:%SZ

Edwin

@psy0rz psy0rz closed this as completed Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants