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

deleting from remote fails : has dependent clones #27

Closed
svennd opened this issue Mar 4, 2019 · 3 comments
Closed

deleting from remote fails : has dependent clones #27

svennd opened this issue Mar 4, 2019 · 3 comments

Comments

@svennd
Copy link

svennd commented Mar 4, 2019

I logged the output for pyznap send & pyznap snap :

Mar 04 13:15:02 INFO: Starting pyznap...
Mar 04 13:15:02 INFO: Sending snapshots...
Mar 04 13:15:03 INFO: Updating root@winky:winky/brick1 with recent snapshot tinky/brick1@pyznap_2019-03-04_13:15:02_frequent (~1.8K)...
Mar 04 13:15:04 INFO: root@winky:winky/brick1 is up to date...
Mar 04 13:15:04 INFO: Finished successfully...

04 INFO: Deleting snapshot root@winky:winky/brick1@pyznap_2019-03-04_12:45:01_frequent...
Mar 04 13:15:04 ERROR: Error while deleting snapshot root@winky:winky/brick1@pyznap_2019-03-04_12:45:01_frequent: 'cannot destroy 'winky/brick1@pyznap_2019-03-04_12:45:01_frequent': snapshot has dependent clones
use '-R' to destroy the following datasets:
winky/brick1/%recv'...
Mar 04 13:15:04 INFO: Deleting snapshot tinky/brick1@pyznap_2019-03-04_12:45:01_frequent...
Mar 04 13:15:04 INFO: Finished successfully...

/etc/pyznap/pyznap.conf

# default settings parent
[tinky]
        # every $cron runtime (~15 minutes)
        frequent = 2
        hourly = 6
        daily = 3
        weekly = 1
        monthly = 0
        yearly = 0
        # take snapshots ?
        snap = no
        # clean snapshots ?
        clean = no

[tinky/brick1]
        snap = yes
        clean = yes
        dest = ssh:22:root@winky:winky/brick1
        dest_keys = /root/.ssh/id_rsa_winky

# cleanup on backup
[ssh:22:root@winky:winky/brick1]
        frequent = 2
        hourly = 6
        daily = 3
        weekly = 1
        key = /root/.ssh/id_rsa_winky
        clean = yes

the cron :

*/15 * * * * root echo "pyznap send\n" > /var/log/pyznap && /usr/bin/pyznap send > /var/log/pyznap
*/15 * * * * root echo "pyznap snap\n" > /var/log/pyznap && /usr/bin/pyznap snap > /var/log/pyznap

The idea is that we take snapshots local, make sure the data is backed up on the backup location. I must miss something but I'm unsure what?

@yboetz
Copy link
Owner

yboetz commented Mar 4, 2019

Hm there should not be any clones for snapshots you only sent to a backup location. I think the problem here is that you start sending and cleaning at the same time. pyznap will still be sending snapshots to your backup location, when the other instance already wants to delete snapshots. As sending is incremental, it depends on old snapshots to be there on the dest. So if you try to delete one such snapshot while it is sending, I guess it tells you that the snapshot has dependent clones (marked with the %recv).

I would advise to always let pyznap send run after the snapshot taking, so in your cron file have something like

*/15 * * * * root  { echo "pyznap snap\n" && /usr/bin/pyznap snap ; echo "pyznap send\n" && /usr/bin/pyznap send } > /var/log/pyznap

Like this the pyznap send will always start only after snapshot taking/cleaning.

Also just a fyi, I don't know if this is by design: In you policy for your backup you don't specify any numbers for the snapshots to keep, so all of them will be set to 0. This means that all snapshots you send to your backup location will immediately be deleted again once you run pyznap snap :). This also means that every backup will have to be a full backup, not incremental, as there are no old snapshots from where to start the incremental send.

@svennd
Copy link
Author

svennd commented Mar 6, 2019

Oke; this is the cron now :
*/15 * * * * root /usr/bin/pyznap snap >> /var/log/pyznap && /usr/bin/pyznap send >> /var/log/pyznap

The initial issue is gone (you where correct) but its off by 1. There are 3 frequently, 7 hourly, 2 daily and 0 weekly 😄 Maybe I need more patience ? Anyways this can be closed, its clearly a configuration issue;

thanks for the help!

@yboetz
Copy link
Owner

yboetz commented Mar 6, 2019

Well, you first clean snapshots on the backup dest, then send your new snapshots, meaning after that cron there will be more snapshots than specified in your policy :). If you always want to have the exact amount of snapshots as specified in your policy you need to do something like this:

*/15 * * * * root  { /usr/bin/pyznap snap --take ; /usr/bin/pyznap send ; /usr/bin/pyznap snap --clean } >> /var/log/pyznap

This way it first takes snapshots, then sends them over to your backup, and then cleans old snapshots, meaning you are left with exactly the amount you specified.

@svennd svennd closed this as completed Mar 8, 2019
@svennd svennd reopened this Mar 8, 2019
@svennd svennd closed this as completed Mar 8, 2019
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