I booted to a live ubuntu USB, wanting to delete partitions on an SD card, and ended up deleting all my partitions on my mac book pro's internal hd.I have already tried gpart (which gets stuck at Begin scan...) and testdisk (which can't create partitions since Function write_part_mac not implemented!).I did try cmd + r at boot, but gave it up as it was taking a long time. I thought there would be an easier and faster alternative.Is there a way to recover data with partitions on my hd?***EDIT: Here's my testdisk o/p for the mac hd: Partition               Start        End    Size in sectorsP DOS_FAT_32                    40     409639     409600 [EFI]P HFS                       409640  489972567  489562928
Recover partitions Mac OS internal hd
partition;osx;fdisk;gparted;testdisk
Intel MacBook Pro's use GUID partition table for disk partitioning which one can edit with gdisk.A copy of the partition table metadata is usually stored as backup of the primary. You can read more detail about it on the Arch Wiki hereYou need first to know the device name, /dev/sda, /dev/sdb of your Mac disk.You can use the blkid, lsblk or dmesg commands to determine the exact name if you do not know. From your Ubuntu Live USB, use gdisk /dev/sdX (where X is your device name)e.g. /dev/sdb (assuming the USB is given sda and the Mac is the only other disk)   $ sudo gdisk /dev/sdbGPT fdisk (gdisk) version 0.8.10Partition table scan:  MBR: protective  BSD: not present  APM: not present  GPT: presentFound valid GPT with protective MBR; using GPT.Command (? for help): `r`Recovery/transformation command (? for help): `b` Recovery/transformation command (? for help): `w`And rebootThe b restores the backup GUID partition table and w writes it to disk You way wish to also run the v verify after restoring the backup table and before writing it to the disk. gdisk is very sane about letting one create and modify the partition table, in memory, and nothing is written on disk until you write it with the w command. Be very sure you are happy with the recovery result before you write it to disk.