How to repair a drive after accidentally changing the partition scheme? I was using the Boot Camp. Somehow I managed to change the GPT partition scheme on my external hard drive to a MBR partition scheme. Below is the output from the command sudo gpt -r -vvv show /dev/disk1. 

gpt show: /dev/disk1: mediasize=1000204886016; sectorsize=512; blocks=1953525168
gpt show: /dev/disk1: Suspicious MBR at sector 0
gpt show: /dev/disk1: Bad CRC in GPT table at sector 2
gpt show: /dev/disk1: Sec GPT at sector 1953525167
       start        size  index  contents
           0           1         MBR
           1      409639         
      409640  1829583888      2  MBR part 175
  1829993528     1531680      3  MBR part 171
  1831525208   121999927         
  1953525135          32         Sec GPT table
  1953525167           1         Sec GPT header


I was booting OS X from this external drive. I am trying to make this drive functional without losing all the data on it.
The output from the gpt command indicates the following.


While there is no indication that there is a problem with the primary
GUID Partition Table (GPT) header, the entries appear to have been
corrupted.
The secondary (backup) GPT header and entries are intact.
The MBR tables contains at least two partition entries. One entry is
a OS X partition (type 175=0xAF). Another entry is an OS X recovery
partition (type 171=0xAB).


Under normal circumstances, the following is true. 


The gpt command does not display MBR partition entry for partitions
of type 0xEE.
Some of the primary and secondary GPT headers values differ,
therefore the headers not identical.
The primary and secondary GPT entries themselves are actually
identical.


Therefore, copying the entries, from the secondary GPT to the primary GPT, should fix the partition table errors. The commands give below will do this. (I assume the external drive is still disk1).

diskutil unmountDisk /dev/disk1
sudo dd if=/dev/disk1 of=/dev/disk1 count=32 conv=notrunc seek=2 skip=1953525135 



  Even if the above commands fix the partition table errors, there is no guarantee the data, stored in the partitions, has not been corrupted.