Wayne Davison
2020-Dec-13 19:45 UTC
Is there any way to restore/create hardlinks lost in incremental backups?
You could rsync the current day4 dir to a day4.new dir, and list all the prior days as --link-dest options. Make sure that you're using the same xatt/acl options as your official backup command (the options may or may not be present) so that you are preserving the same level of info as the backup. You also have the choice of copying the whole day4 dir or just the day4/pictures dir, as you see fit. For example: rsync -aiv --link-dest=../day1 --link-dest=../day2 --link-dest=../day3 day4/ day4.new/ mv day4 day4.bad mv day4.new day4 If you only want to reprocess the pictures subdir, just tweak the "day4/" arg to be "day4/pictures" (no trailing slash) and change the mv commands to deal with just that subdir. ..wayne.. On Thu, Dec 10, 2020 at 9:29 AM Chris Green via rsync <rsync at lists.samba.org> wrote:> I run a simple self written incremental backup system using rsync's > --link-dest option. > > Occasionally, because I've moved things around or because I've done > something else that breaks things, the hard links aren't created as > they should be and I get a very space consuming backup increment. > > Is there any easy way that one can restore hard links in the *middle* > of a series? For example say I have:- > > day1/pictures > day2/pictures > day3/pictures > day4/pictures > day5/pictures > > and I notice that day4/pictures is using as much space as > day1/pictures but all the others are relatively small, i.e. > day2 day3 and day5 have correctly hard linked to the previous day but > day4 hasn't. > > It needs a tool that can scan day4, check a file is identical with the > one in day3 then hardlink it without losing the link from day5. > > There's jdupes but that does lose the link from day5 so you'd have to > apply it to all the directories after the one that's lost the links. > > > > -- > Chris Green > ? > > > -- > Please use reply-all for most replies to avoid omitting the mailing list. > To unsubscribe or change options: > https://lists.samba.org/mailman/listinfo/rsync > Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.samba.org/pipermail/rsync/attachments/20201213/cc0b75b2/attachment.htm>
Wayne Davison
2020-Dec-13 19:58 UTC
Is there any way to restore/create hardlinks lost in incremental backups?
I should also mention that there are totally valid reasons why the dir might be huge on day4. For instance, if someone changed the mode on the files from 664 to 644 then the files cannot be hard-linked together even if the file's data is unchanged. The same goes for differences in preserved xattrs, acls, and ownership. In such a case you could decide that you don't care about the change in meta info and tweak it on the earlier files to match day4's files and then the suggested re-link command would decide it could join them together. You'd probably then need to keep going and re-link day5's pictures (since it was probably linking to the old day4's pictures). ..wayne.. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.samba.org/pipermail/rsync/attachments/20201213/f7b42bb9/attachment.htm>