TestDisk is a powerful free data recovery utility.
TestDisk was primarily designed to help recover lost partitions and/or make non-booting disks bootable again when these symptoms are caused by faulty software, certain types of viruses or human error (such as accidentally erasing your Partition Table). Partition table recovery using TestDisk is really easy.
To install testdisk, paste this in macOS terminal after installing MacPorts
sudo port install testdisk