Is it possible to copy a Time Machine backup using rsync
to another HFS formatted disk? I am concerned that rsync
would not be able to track the hard-linked directories that Time Machine uses.
-
2I haven't tested, but I'm pretty sure it won't recreate the linked directory structure. In Apple's support document HT202380: "Transfer Time Machine backups from one backup disk to another", they recommend using Finder to copy the backup (after making sure the disk is properly formatted, has permissions enabled, and TM is switched off).– Gordon DavissonCommented Dec 5, 2019 at 7:32
-
Thank you. I've seen that article, too. Finder is a disaster when you go over several hundred thousand files.– JuanCommented Dec 5, 2019 at 16:39
-
In that case I'm not sure what to suggest. I don't think there's a way to break it up into Finder-handlable chunks without (again) breaking the hard-linked directories, and I don't know of any other tools that'll handle them properly.– Gordon DavissonCommented Dec 5, 2019 at 18:36
-
@GordonDavisson, if you convert your comments to an answer, I will accept it.– JuanCommented Dec 6, 2019 at 18:21
-
1I think I'd rather leave the question open, in hopes that someone else has a more definitive answer (or viable alternative).– Gordon DavissonCommented Dec 9, 2019 at 0:21
1 Answer
The rsync command is very powerful and versatile, and it can preserve the Hard Links and other crucial information of the Time Machine backup. As from this post (https://www.cyberciti.biz/faq/linux-unix-apple-osx-bsd-rsync-copy-hard-links/), you could do:
rsync -azH /path/to/source /path/to/dest/
The flags stand for:
-a
: archive mode (copy direcotries, preserve permisions, groups and ownerships, modification times..)
-z
: compress while transfering to accelerate the copying process
-H
: preserve Hard Links (crucial for Time Machine backups)
You could also add -v
(for verbose) to visually follow the progress of your backup.
(I don't know if Time Machine uses numeric group and user IDs, in which case you could add the --numeric-ids
flag).
BTW, you may also want to update your rsync through Homebrew (v. 3.x.x), since the one that ships with Catalina is 2.9.6.
I would also add an alias to my backup script in my .zshrc file with two purposes: 1. make it easier to run without having to type everyithing again every time I want to backup, 2. make it less prone to destructive human error (such as inverting the path to source and the path to destination).
-
4From the same site as you quote for rsync it also says "Hard links cannot link directories" Which is known elsewhere so NO rsync does not work with Time Machine.– mmmmmmCommented May 18, 2021 at 8:58
-
I tried it. Rsync fails trying to opendir the many hidden folders in the Time Machine file system. I kept getting permission denied errors, in spite of the fact that I'm logged in as the sole user of the system and have permissions on both drives. I tried taking out -a and manually turning on all of it's included modes except -p; the problem persisted. Commented Aug 29, 2022 at 4:37
-
@RobertM. you need to give full disk access to your terminal application– TonyCommented Oct 16, 2023 at 12:59