Manual Backup Pruning Possible?
So from time to time, an error gets into the backup process (usually a crashed database) and the backup drive gets full because backups are not pruning.
Used to be no big deal to just manually delete the older backups, but I am wondering if this is still possible given the hardlinking that is used. We are likely deleting files that are otherwise hard linked in other restore points, right?
So what is the best practice way to manually prune old backups when there is not enough remaining free space to run a complete backup set once the errors are resolved and get the old versions pruned automatically?
-
That's what the "Strictly enforce retention, regardless of backup success" option is for, it will automatically remove them regardless. Or maybe I didn't understand the question? 0 -
Yes that is true, but once you get to the point where there is not enough space for a full backup to run, that won't do anything since the backup cannot complete and pruning takes place at the end. 0 -
It shouldn't ever get to that point though unless you just plain out don't have enough space on the drive in which case you have a different issue and should upgrade your disk space OR reduce the retention to not store as many days worth of backups. 0 -
We as a rule do not enable the prune anyway because it means that there is an issue with the backups. SOMETIMES it goes to far and the drive has less free space left than is needed to run the backup, just the way it is. We could of course delete ALL the backups, but it would be better to just delete enough to get to the point where a new backup can run and let the auto pruning do its thing. 0 -
So your question is, you want an automated way of removing only x amount of backups to free up x amount of space to allow the backup process to complete in which it would then prune the backups as usual? 0 -
Basically, but I am not expecteing automated. I just want to know if it is safe to manually delete say ten or fifteen daily backup folders or not. Will the subsequent backup restore whatever source files that were there, or will it assume from the meta data that the source files are still there. 0 -
Good question, so I am assuming you are primarily asking as the restore ability would still show an available backup when in fact it would not be available since it was manually deleted and the meta data remains. I just tested this, and yes that would be the case but the next time the backups run, it repopulates the metadata so the backups you removed will not show. So if you remove said backups, then run /usr/local/cpanel/bin/backup
you will actually be ok since the metadata will get updated.0 -
Actually, no, My concern is for the files that are hard linked. If I remove a source file that is hard linked else where, does the cPanel backup recognize this and back the source file up again and re-establish the hard links. 0 -
That's not how hard links work, if you remove it from one location, it still remains in the other location, example: [root@office ~]# mkdir -p original/test [root@office ~]# mkdir -p link/test [root@office ~]# touch original/test/hello [root@office ~]# ln original/test/hello link/test/ [root@office ~]# ll original/test/hello -rw-r--r-- 2 root root 0 Sep 28 09:23 original/test/hello [root@office ~]# ll link/test/hello -rw-r--r-- 2 root root 0 Sep 28 09:23 link/test/hello [root@office ~]# rm -f original/test/hello [root@office ~]# ll original/test/hello ls: cannot access original/test/hello: No such file or directory [root@office ~]# ll link/test/hello -rw-r--r-- 1 root root 0 Sep 28 09:23 link/test/hello
You can see the original test file that was the source of the link was removed but the file remains, just down 1 link which is what the '1' indicates next to the permissions, where you saw it was a '2' after we linked it originally. Same goes for your backups, if you remove an entire backup, that hardlink remains throughout the rest of the backups, each new backup is sourced from the previously taken backup, not the one about to be pruned unless there is only 1 set of backups.0 -
I also spent a good amount of time explaining how the incremental backups and hardlinks work here: which might be helpful @GOT 0
Please sign in to leave a comment.
Comments
10 comments