copy-from-mac-time-machine
copy-from-mac-time-machine copied to clipboard
Add an option to just copy latest backup
So I'd like to have just the most recent complete backup of my (now dead) Mac on my Linux box. If I run this script, I'll be copying a mostly-full 2TB drive onto my 1TB drive, which doesn't really work (I tried). And anyway, I don't need a second copy of the full history; it's what the backup drive is for.
I might try taking a look at this this weekend since I've got a few old Time Machine backups I'd like data from.
Hm, I don't have access to a Mac Time Machine backup atm to reproduce, but I think this is already feasible. From the README:
where $source is the mount point (i.e. not e.g. /dev/sdb2) of the Time Machine Volume and the proper directory (e.g. could be "Latest"
So, if the first parameter (aka "$source") not only points to the mount of the backup but also to the directory (by suffixing /Latest
) you should only get the (complete) latest backup.
I tried this and a lot of the main folders in my home directory (desktop and documents, etc) were empty. I am re-running this with the source set to just Backups.backupdb to see if it fixes it.
Thx @GreenJon902 for trying this out. Have you had success? Also, I don't know, but maybe the latest backup of yours was somehow faulty - you could try out an other backup (not "latest" but something with a datestamp on it)?
@dr0i I set it to copy all of the backups so it is still running. Of ones it has done, it looks like the folders are still empty. From what I can tell so far, it creates the folders from the special files but then doesn't fill them. I saw you mentioned that it needs to be able to re-run the original script, could this be a permissions issue where it only re-runs it for the special folder file things but can't which is why the folders aren't filled?
When it is finished then I'll check the folders again to see if the /latest
was the issue. If it takes much longer or you think that won't help then I can stop it and try using the date as you suggested.
I have stopped it because it was going to take a lot longer.
I have started a new one with the source set to mountpoint/2022-02-23-230344/Macintosh HD - Data
. So far it has copied the system wide applications folder which was a special folder and has turned it into an actual folder and started filling its contents, fingers crossed it will do the same for special folders in my user directory and elsewhere on the drive!
@dr0i I believe I have discovered a fix, I think i needed to run the script with sudo as it didn't have permissions to some files on the time machine backup file (some had a red circled X on the icons and the script sometimes outputted permission denied). I ran this just for my user folder and it has started filling Desktop and Documents which it didn't do before, meaning
So, if the first parameter (aka "$source") not only points to the mount of the backup but also to the directory (by suffixing /Latest) you should only get the (complete) latest backup.
probably works! I will test this and get back to you.
Edit: I just realized that this was already mentioned in the README, sorry for not reading that right..
@GreenJon902 great that it works for you - and no problem for not following the README correctly. Your comments here may well help others who experiences the same problems. Closing.