Using Rsync For Exact Copy
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?
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
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.