2

I've made a bit of a balls up...

When attempting to create a bootable Ubuntu usb drive I accidentally ran dd on my main system drive :(

sudo dd if=/path/to/image.img of=/dev/rdisk1 bs=1m

I realised what I'd done pretty quickly but everything seemed fine so I re-ran the command on the correct drive /dev/disk2 and thought "phew not sure how I got away with that"... Then things started going wrong... I could continue using the applications I had open but opening anything new / accessing the hdd caused that thing to lock.

Sadly I haven't been using time machine, lesson learnt!

I spoke to AppleCare who said I need to reformat the machine but I'm really hoping there's some way to restore whatever 1m I destroyed (I'm assuming something to do with the partition information). Wishful thinking?

Also, AppleCare told me to restart, which means I can only user repair mode utils.

Help!

3

Sorry to hear of your situation. The first megabyte will have included the drive's partition and critical structural information.

If you can, dd all the remaining content to another drive as a back-up of sorts. Then I suspect your best choice is a professional repair service or a tool like DiskWarrior:

DiskWarrior

Everything just disappeared after your Mac went haywire. All your work documents. The music you most enjoy. The movie of your kid's first steps. It's your life and it's gone. Don't panic! DiskWarrior will recover your documents, photos, music and any other files when disaster strikes and you lose access to your files.

Recovering a Mac Drive on OS X

@DavidAnderson mentions in the comments below that recovery may be possible. This assumes your drive was GUID partitioned. The Cloudy Aide-Mémoire article, Recovering a non-readable disk on Mac OS X goes into more detail:

  1. Connect your external disk
  2. Start terminal and use the 3 commands in bold below:
    1. diskutil list
    2. sudo gpt recover /dev/disk1
    3. diskutil eject /dev/disk1
  3. If the last command was successful, disconnect and reconnect your disk, which >should now be OK

An alternative to the second command (gpt) would be diskutil repairDisk /dev/disk1

Note than the manpage for gpt does not cover the recover option whereas the manpage for diskutil does cover the repairDisk option.

Good luck – and be sure to back-up in the future!

  • Damn, I thought as much. I was hoping there might be some clever trick of creating a new partition and copying the first 1m of that. I don't think I can do that from recovery mode though can I? – James Jun 23 '15 at 16:30
  • I am sorry. I think that approach is impossible. Thankfully your files should still be recoverable – with the right byte-level scanning software. I have used DiskWarrior back with MacOS Classic and it saved my drive then; I hope it or a professional service can help you now! – Graham Miln Jun 23 '15 at 17:08
  • 1
    Actually, there is a backup copy of the GUID partition table (GPT) at the end of the drive. If @James can find a way to boot, he can enter the command gpt recover /dev/disk1 to repair the primary GPT at the beginning of the drive. Also, if he caught the dd command before it overwrote the EFI partition, there would be no damage to the OS X partition. This would require catching the error within 20 seconds of pressing the enter key. – David Anderson Jun 24 '15 at 4:56
  • Thanks David, I bit the bullet and erased the partition and formatted. Never mind. – James Jun 24 '15 at 16:50

You must log in to answer this question.

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