-
Notifications
You must be signed in to change notification settings - Fork 1
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
Time Machine automatically nuking snapshots #1
Comments
Doing testing with an actual snapshot schedule, it looks like it doesn't let me keep more then 4 or 5 snapshots at a time, which equates to never having hourly snapshots kept. This is super unfortunate, but unless apply provides a way around this i don't see what could be done. |
It looks like there is a way to create snapshots via a C syscall: #include <fcntl.h>
#include <stdio.h>
#include <sys/attr.h>
#include <sys/snapshot.h>
int main() {
int dirfd = open("/", O_RDONLY, 0);
if (dirfd < 0) {
perror("open");
return(1);
}
int ret = fs_snapshot_create(dirfd, "snapshot_test", 0);
if (ret != 0)
perror("fs_snapshot_create");
return (ret);
} However, running this, even as root, returns the error |
Did you find any more info regarding the entitlement required and how to request this? |
I havent tried this myself, but when reading the snapshot documentation of CCC, it seems they have found a way around this. The interface distinguishes between snapshots made by CCC and snapshots made by Time Machine. Also it guarantees the following:
|
I think I found the answer here:
Seem like the key is to use |
Whoops. I now see you already posted that article on 11 Nov 2017. I guess CCC was able to get this special entitlement because they're a backup application developer. |
Seems really odd to me that this special entitlement is required at all and not just require elevated privileges for the effective uid... |
Seriously, it's super dumb 👎 |
You can mount the snapshot somewhere, and Time Machine won't be able to delete it. I've tested mounting multiple snapshots and it did not create any problems. |
Another option: use snaputil. See here: ahl/apfs#2. |
It looks like time machine will occasionally nuke snapshots itself. If I had to guess, it is probably doing something along the lines of
tmutil thinlocalsnapshots /
.As it stands, the only way I found to create APFS snapshots is via tmutil, so unless whatever is deleting the snapshots we created is run on a cron or something that we can disable, there isn't much to be done about this. Ideally we would have a C API or a different set of tools outside of time machine that let us create APFS snapshots, but until that is a thing we will take what we can get.
This won't cause the program to crash, if it finds that a snapshot was removed out from under it, it will just remove that snapshots metadata from the database and keep happily running. But it does mean that I cannot guarantee the amount of snapshots to keep limits found in the config file will be honored.
The text was updated successfully, but these errors were encountered: