3

I've used rsync before, on Linux, many times, but also many years ago and I also don't know if there are any differences or issues between using it on an iMac and on Linux.

I have a drive with a problem and now mounts read-only. I replaced it with a good new drive and it's now connected via USB in a SATA case.

If I want to create a folder on the new drive, say, "/OldDrive", and copy all the files on my old drive over to it, preserving ownerships, permissions, and anything else macOS cares about, what are the command options and switches I need to use on rsync to do this?

  • What version of macOS? The metadata can be lost with rsync but maybe you are copying to a non Apple filesystem and don’t care about resource forks and metadata. – bmike Jan 16 '18 at 22:56
  • I'm copying from what was my system drive until it stopped behaving to what will be my new system drive. I'm using 10.13.2. – Tango Jan 17 '18 at 2:06
  • @bmike: Actually, and I should have mentioned this above, it's metadata I'm worried about, since I've seen extra metadata on files and have had to research what it meant and how to deal with it. – Tango Jan 17 '18 at 3:08
  • Yes indeed Tango - I'll answer with the recommended best tools - ditto over rsync and possibly asr as well as a neat solution to not even copy the files off - just migrate to a new external OS drive. +1 and great clarification. – bmike Jan 17 '18 at 3:16
  • @bmike: Looking at this now, it was not the best question for me to ask. Clearly, you've realized that I'm trying to restore a bad drive. My problem is I still think like I'm on Linux and on Linux, if I was concerned about the drive itself, but files were intact, I'd have used the "-a" in rsync, with sudo, to copy over all the files with permissions and owners and metadata intact, so that was my first thought here. I wanted to preserve all things, like settings, game scores, and tweaks I've done along the way. (Continued...) – Tango Jan 17 '18 at 16:02
2

You can use dd to create a bit for bit duplicate.

dd if=/dev/sdX of=/dev/sdY conv=noerror,sync

To find the name of your disks:

diskutil list

Then unmount the destination drive

diskutil unmount volume

Then run dd. There will be no progress meter, and it will take awhile so just be patient.

  • 1
    To add a progress bar to dd use dc3dd – WayToDoor Jan 17 '18 at 0:46
  • You're right in your guess that my main goal is, ultimately, to duplicate the bad drive on the new one. The problem with this - copying device to device - is that I have to do it when booting from another device. The only other device I can boot from is a flash drive - and I've just learned how amazingly and stunningly slow an iMac booted from a ram drive can be. – Tango Jan 17 '18 at 2:08
2

Rsync isn't the best choice for Mac to Mac copies.

I'd use ditto or asr if you need a command line solution. Disk Utility calls asr internally and you could mirror the volume and then wipe and run Migration Assistant - that's far better than trying to boot from a damaged copy.

Do go ahead and make the full copy for your backup - then consider installing to a new OS.

In fact, you could install OS onto an external USB / Thunderbolt / FireWire drive first before even making a copy then migrate the data and accounts and apps from the internal drive to the external clean OS install.

That saves a step and you don't even need to worry about syntax of asr or ditto or rsync

  • On the old drive I installed the latest High Sierra. It booted, then I went to upgrade Server and it insisted on rebooting - I got caught in an install loop. Now I know that's a hardware fail. So I suspect if I get the data on the old drive to the new one, it may want to reinstall High Sierra, which just takes some time, but I would think, after that, it would boot. My problem is that I know Linux, but don't know macOS that well and I don't want to lose any kind of important metadata. Also, I have a flash drive I can boot from, but it's so slow I can't boot there and copy a big drive. – Tango Jan 17 '18 at 16:13
  • Are you available any time coming up in chat? What always concerns me are the details I don't know. From what you're saying, I think Migration Assistant might do much of what I need, but I just want to be clear, in my head, about it all and asking here would mean a "comment discussion." – Tango Jan 17 '18 at 18:17

You must log in to answer this question.

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