3

If I were to use tar -xvf to create an archived .tar file of the Backups.backupdb folder Time Machine creates, would it sufficiently preserve hard links, etc? For example, if I uploaded to, say Google Drive, and later downloaded it in the future and extracted it to a new drive, would the extracted folder still be readable my Time Machine? Or would the safer route be imaging the entire drive?

1
  • 1
    FYI - tar would need -c to Create an archive. -X is to eXtract an archive.
    – Alex
    Sep 7, 2020 at 0:24

1 Answer 1

5

Creating an archive with tar (using the -c option) does by default preserve hard links. I.e. the file will only be stored once in the archive, and when you unpack the archive you'll get hard links on the file system again. It's only when you use the --hard-dereference option to tar that hard links are ignored.

Remember also to use the -p option when creating and restoring the archive. This will preserve the permissions of files, including the ownership, ACL and other information.

Finally I would strongly recommend that you test the backup of the backup after you have made it to ensure that it can be read properly by Time Machine to enable you to restore the actual backup.

1
  • Because TimeMachine & Macs use some advanced file/filesystem features: Be sure to use /usr/bin/tar (the one that comes with macOS). Depending on (a) command-line tools packages you may have installed {HomeBrew, MacPorts, Fink, pkgsrc, ...}, (b) your Mac OS version, and (c) your $PATH ...if you run tar (without the /usr/bin/ part) you might actually run a non-Apple version of tar that doesn't support xatts, ACLs, directory hard-links, etc. (This was more of an issue back in the days of 10.6 but still good to be careful!)
    – DouglasDD
    May 14 at 19:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .