7

/Volumes/Original_Time_Machine is no longer being backed up to, but contains old backups that I want to keep.

/Volumes/New_Time_Machine_Archive is an empty partition

Both of these are on separate physical hard drives.

I was thinking of doing this in the terminal. Connect both physical hard drives, then:

cd /Volumes/Original_Time_Machine
cp -rp * "/Volumes/New_Time_Machine_Archive"

Would I be able to restore from this if I copy this way? Or is there another way I should do it?

  • 1
    What is your goal? Continue using the files for Time Machine backup? Recover data from all snapshots? – n1000 Feb 26 '17 at 5:02
  • Is this volume being backed up an APFS volume? Of so, I don't think the documentation is quite available to figure your solution out. APFS get localsnapshots, and they are taken by 'tmutil' which was a change from 'diskutil' doing it before. You’ll see the remnants in diskutils output. Those local snapshots are what get backed up in increments. Keep looking though! – Jahhein Apr 26 '18 at 18:39
  • @n1000 Essentially, my goal was to move the backups from one disc to another as I was going to format the hard drive I was copying from. – Kolob Canyon Aug 31 '18 at 16:27
  • This worked for me: apple.stackexchange.com/a/343920/11282 – andrew Nov 27 '18 at 11:35
5

Apple has fixed Finder in macOS 10.13.4 to preserve hard links so my answer is to use Finder to migrate your TM backup. They did not, however, fix cp. It still does not preserve hard links and doesn't have an option to do so.

I know the OP requested a way of doing it from the terminal but all my efforts to do so in macOS 10.13.3, where I had given up on Finder because it did not then preserve hard links, failed.

The rsync command suggested by @n1000 failed after more than 12 hours with out of memory, even though I have 16GB of memory. This is a known problem fixed in rsync v3+. However v3 sets all the user and group ids to 99 and was painfully slow. There were long periods with no disk and no significant CPU activity. I've found rsync very slow on other platforms too.

cpio did not preserve ownership.

pax got strange errors.

I came closest to success with tar:

cd /Volumes/My\ Passport
sudo bash
tar -cf - -T ~/TMFileList | (cd ../My\ Canvio;tar -xpvSf -)

where ~/TMFileList was created with

cd /Volumes/My\ Passport
sudo bash
find -d Backups.backupdb -print > ~/TMFileList

[I tried a tar -c | tar -x thing first but that was copying some hard links as separate files for reasons related, I guessed, to the order it was seeing the files. Which led to me making the depth-first list.]

However tar was taking an impractically long time. I killed it after 3 days. Some of this was because it was extracting files multiple times. The majority of this was, like rsync, due to long periods of inactivity for reasons I could not determine. What it managed to complete had correct ownership and hard links were preserved.

So I strongly recommend using Finder. Just make sure you have macOS 10.13.4. Follow the Apple support instructions in the link at the end of @n1000's answer.

  • Can you explain what you mean by "Apple has fixed Finder"? Can you provide a link to some documentation or an article? – JBis Apr 26 '18 at 12:36
  • 2
    Prior to 10.13.4, Finder did not preserve hard links when copying. Since TM backups make much use of hard links this meant a Finder created copy would be multiple times the size of the original. In my case a copy of a 500GB backup set to a new 2TB disk failed due to out of space. Apple fixed this in 10.13.4, apparently in response to a bug I filed at bugreporter.apple.com (#36944937). Those bugs are not public so I can't provide a link. They asked me to verify the issue in 10.13.4 suggesting they had fixed it. I did. The copy is now the exact size of the original and hard links are preserved. – msc Apr 28 '18 at 1:20
  • @msc wow, that's amazing... I'll give that a go after updating my os. Thanks for doing that! – youngrrrr Aug 30 '18 at 8:38
  • 1
    @chmac I just had to do a TM copy in 10.14.2 due to a disk problem. It basically worked. It got to a point where Finder said "5 seconds remaining" at which point the copy was the same size as the original. However "5 seconds remaining" went on for 3 hours until I hit Cancel. During that time it periodically copied very small chunks of data gradually increasing the size of the copy. No idea why. But the copy is okay albeit a few megabyte larger than the original. – msc Feb 10 at 4:01
  • 1
    @msc I'm just now seeing this exact same behaviour on 10.14.6, with TM definitely not running. Canceling breaks the copy, too, as it isn't complete (although Finder is saying 0 files left). So, for me too, using Finder (as recommended by Apple) is not a viable option. I'm not yet sure what is a viable option. – Stuart Watt Aug 24 at 1:01
1

As suggested to the answers and comments in this question, the -p option will not work on a Mac. I tested -rp and it will convert symbolic links to real files. That means when you use this your Time Machine backup will become significantly larger. Time Machine creates symbolic links for redundant files and therefore avoids copying duplicate files between the snapshots.

Hence, use

cp -a

to preserve the symbolic links. This will be necessary if you plan on continuing to use the data for Time Machine backups. Alternatively, you could also use rsync using the -K option to preserve symlinks, e.g.:

rsync -ahvrK

This Apple support document describes the procedure for migrating a backup from one drive to another (using Finder).

  • My goal is to transfer this data and have OS X recognize the drive I move it to as a time machine backup and not just a regular partition – Kolob Canyon Feb 26 '17 at 7:23
  • @KolobCanyon OK, I see. The title suggests it more or less. I suggest you edit your question to make it more obvious. My answer should do what you want. – n1000 Feb 26 '17 at 8:06
  • The man for -a Same as -pPR options. Preserves structure and attributes of files but not directory structure. ... Don't I want to preserve directory structure? – Kolob Canyon Feb 26 '17 at 16:59
  • 1
    TimeMachine uses hard links not symbolic links. – msc Jan 30 '18 at 5:27
  • And man cp on macOS reveals that cp copies hard links as separate files thus enlarging backups. – msc Feb 2 '18 at 1:40

You must log in to answer this question.

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