2
2
I have a Time Machine-style backup system set up on my NAS (running BusyBox v1.16.1), using rsync --link-dest
as described here: http://blog.interlinked.org/tutorials/rsync_time_machine.html
Is there an easy way to find out which files will be deleted if I delete an old backup directory, and which will just be unlinked? I assume one way would be to find which inodes in the old directory have only one link to them, but I don't know a way to do that. rm --dry-run
anyone?
Bonus Points: Find a way to do the above, and also calculate the total disk space freed if the old backup is deleted.
Thanks! This is perfect. I don't need the second part; since the backup images are full of hard links, I just need to delete the oldest backup directory.
find oldest/ -type f -links 1 >> files-lost-forever.txt; find oldest/ -type f -links 1 -print0 | xargs -0 du | awk '{total = total + $1}END{print total " bytes freed"}'; rm -rf oldest;
– JDS – 2012-06-26T05:15:27.943er...
s/du/du -k/
ands/bytes/Kb/
– JDS – 2012-06-26T06:44:42.373