Need to recover SSD partition table using Gdisk on Samsung 512GB on MBP MID 2015

My internal SSD was scrambled due to a power failure during some kind of kernal process or other. It is now unrecognizable in the MBP. I purchased a new SSD and also the OWC external holder for the internal SSD. It is recognized as 251GB uninitialized in the DiskU. Will not mount to do first aid. disutil list shows only this:


/dev/disk2 (external, physical):

  #:            TYPE NAME          SIZE    IDENTIFIER

  0:                          *251.0 GB  disk2


How do I use Gdisk to begin to fix partitions? I do not have this SSD backed up and need to get at a metamask account as I find I saved an incorrect seed phrase (I mixed up seed phrases and threw out the active one!) Could potentially lose 5 k if I cannot recover this! Can anyone held here?

MacBook Pro 15″, macOS 10.12

Posted on Nov 15, 2020 2:16 PM

Reply

Similar questions

45 replies

Nov 16, 2020 2:29 PM in response to BackBay

Since you posted this in the Bootcamp forum, I will assume that you have Windows and macOS both on the SSD. If that is the case, and if the GPT table entries are invalid, there is a default configuration for Apple SSDs.


The disk partition typically starts at sector 40, with EFI being 409600 sectors (~200MB). The first 40 sectors contain the primary GPT table and some padding. The secondary GPT table is at the end of the disk in a reverse layout.


We can build a default primary GPT table. Once that is done, we can use Testdisk to scan and see what it can find.


Be aware that there is a second layout which is also used which has an EFI partition of 314.6 MB. It should still begin at sector 40.

Nov 16, 2020 4:04 PM in response to Loner T

  • [The o option on the main menu causes GPT fdisk to create new GPT data structures (headers, partition tables, and MBR). If your disk's data structures are very badly damaged, using this option first might enable you to load one undamaged partition table to recover your partitions.]

This sounds like the right course of action but you have written about these two layouts. I am am not yet sure what these two layouts are respectively. The second one has the EFI partition? I guess I need your help to determine what is the standard disk partition used on these factory installed Samsungs. but where to find that? The EFI partition would be removed only if I was using bootcamp which I was not. All systems have the EFI partition unless someone removes it right?


Nov 16, 2020 4:32 PM in response to BackBay

Not sure if this is the 4k

Model Name: MacBook Pro

 Model Identifier: MacBookPro11,4

 Processor Name: Intel Core i7

 Processor Speed: 2.2 GHz

 Number of Processors: 1

 Total Number of Cores: 4

 L2 Cache (per Core): 256 KB

 L3 Cache: 6 MB

 Memory: 16 GB

 Boot ROM Version: 199.0.0.0.0

 SMC Version (system): 2.29f23

 Hardware UUID: CEFC3F35-239C-5C8C-8434-269DA09F1101


So here is where I made a mistake: I should have run this below with disk 2 correct?


sudo dd id=/dev/rdisk2 count=5 2>/dev/null | hexdump -C

Nov 16, 2020 4:57 PM in response to Loner T

[A dd command is also available on macOS, since you are booted from an external disk. It can be used to make a copy, but will need the same disk space as the size of the SSD for this to work correctly. It should be done first, before GDisk manipulates this disk in any way.

GDisk will create the backup GPT table, once you do the write. The Pri and Sec entries will be cerated. You can also create the EFI.

If you run

sudo dd id=/dev/rdisk0 count=5 2>/dev/null | hexdump -C

what do you get? This will give us the first 5 'sectors' of the on-disk structure.]


So this:

sudo dd id=/dev/rdisk2 count=5 2>/dev/null | hexdump -C

is just preliminary before using dd and making a copy right?

When needing a disk to send to I can use the disk I booted from right? this is a file not a clone I assume. I'm using a sandisk It has ample space. I appreciate ur patience I will never be a computer engineer I know.

Nov 16, 2020 7:44 PM in response to BackBay

BackBay wrote:

Ok ran this
sudo dd id=/dev/rdisk0 count=5 2>/dev/null | hexdump -C

And it went right back to the command line prompt. I don't think any process is working

You missed typed "id=" should be "if=". No need to be that complicated. You can use this command:

sudo  hexdump  -C  /dev/disk0


Or if you want a native macOS solution:

sudo  xxd  /dev/disk0



Nov 16, 2020 7:51 PM in response to BackBay

BackBay wrote:

As far as making a back up I still must see if GNU needs to be mounted. I tread CCC and it would not recognize the owc enclosure.. it takes time for the owc enclosure (with the original Samsung SSD) to even be recognized on current booted up HD and in disk util. Also disk util will not make an image of it either it just runs the program and seems to not produce anything.

I highly recommend using GNU ddrescue if you already have Homebrew installed. GNU ddrescue does not need a mounted drive/volume. GNU ddrescue also allows you to see the progress as well as resume the clone if it is interrupted (as long as you use the logging/mapping file option). Just make sure to get the source & destination correct since it doesn't use the "if=" and "of=" options, but instead uses relative location (first file/device is the source input, the second file/device is the destination, and the third file is is the logging file). You can also use the "--ask" option to prompt you for confirmation of the command (and it shows what will happen).

Nov 16, 2020 8:16 PM in response to HWTech

Thx for catching that typo. I am now running

sudo dd if=/dev/rdisk2 count=5 2>/dev/null | hexdump -C

(the SSD im trying to fix is listed as Disk 2 in DiskUtil)

It is still running.


As far as using GNU

I nothing against it but if it is a cloning method then it wont work and (dd) may be the better option.

This is because, as wacky as this sounds, when I install the new OWC 480GB aura SSD (which works fine) the owc external case with the factory installed Samsung SSD will not show up. I originally intended to clone it this way but

1 I could never get the Samsung to show up when the OWC aura SSD was installed, and;

2 The CCC software and the diskutility would never recognize the external drive to image/clone.





Nov 16, 2020 9:17 PM in response to BackBay

BackBay wrote:

Thx for catching that typo. I am now running
sudo dd if=/dev/rdisk2 count=5 2>/dev/null | hexdump -C
(the SSD im trying to fix is listed as Disk 2 in DiskUtil)
It is still running.

As far as using GNU
I nothing against it but if it is a cloning method then it wont work and (dd) may be the better option.

GNU ddrescue is basically an updated and better version of "dd". It is basically "dd" on steroids. There are some cases where "dd" is the better or easier option.


This is because, as wacky as this sounds, when I install the new OWC 480GB aura SSD (which works fine) the owc external case with the factory installed Samsung SSD will not show up. I originally intended to clone it this way but
1 I could never get the Samsung to show up when the OWC aura SSD was installed, and;
2 The CCC software and the diskutility would never recognize the external drive to image/clone.

CCC & Disk Utility need a mounted volume to clone. Like "dd", GNU ddrescue does not need a drive to be mounted in order to access the physical drive which is why I suggested its use when you mentioned you wanted to clone the SSD.


Nov 17, 2020 1:31 AM in response to Loner T

Yes it is the only one that is possible to use-- (by OWC )So it is the OWC Envoy pro enclosure specified for this Samsung SSD with the proprietary connector- I was thinking that it is this connector that is causing the trouble tbh.


The command:

sudo dd if=/dev/rdisk0 count=5 2>/dev/null | hexdump -C

went right to the command prompt and

sudo dd if=/dev/rdisk2 count=5 2>/dev/null | hexdump -C

took some time but did the same thing.


I need some sleep but I have all my free time now to work on this. I will read over the GNU manual and rodsbooks you sent me so I will be better prepared to use your command line stuff.


HWTech has some good recommendations but my Question is: Is there a way to do the (dd) or the better GNU (dd) using a disk image so I can send it to the sandisk I booteded from? (I'm pretty sure I saw this in one of the manuals)

I know I will have trouble doing any cloning due to constraints:

[ I'm connected and Booted from a sandisk external SSD (using USB) and I have the OWC ENVOY PRO with the Samsung on the other USB port. So when cloning the drive then I have no place to put it-- because you need the full empty drive to do the cloning right? I have plenty of room on the sandisk drive I booted from but I am fairly certain this is not possible to use unless you tell me I can use an image. Alternatively, if I install the new apple drive aura pro 480gb: First, the Samsung will not show up (not kidding) Second, it may be cutting it close as far as needing the same amount of space for the data needed for cloning as I am not sure how much was full on the 512GB Samsung drive.]

What I do have is two thunderbolt ports (no proprietary cord for that) another 1TB Sandisk SSD I can empty if needed. and an HDMI port but none of that helps this situation I think.


When I am have studied more and am ready, how should I begin the Recomended (dd)?



Nov 17, 2020 1:39 AM in response to HWTech

[GNU ddrescue is basically an updated and better version of "dd". It is basically "dd" on steroids. There are some cases where "dd" is the better or easier option. ]


[CCC & Disk Utility need a mounted volume to clone. Like "dd", GNU ddrescue does not need a drive to be mounted in order to access the physical drive which is why I suggested its use when you mentioned you wanted to clone the SSD.]


Ok I didn't know they were almost the same and I am reading up the manual. The whole issue (aside from mounting issue) is the constraints I outlined here:


[I'm connected and Booted from a sandisk external SSD (using USB) and I have the OWC ENVOY PRO with the Samsung on the other USB port. So when cloning the drive then I have no place to put it-- because you need the full empty drive to do the cloning right? I have plenty of room on the sandisk drive I booted from but I am fairly certain this is not possible to use unless you tell me I can use an image. Alternatively, if I install the new apple drive aura pro 480gb: First, the Samsung will not show up (not kidding) Second, it may be cutting it close as far as needing the same amount of space for the data needed for cloning as I am not sure how much was full on the 512GB Samsung drive.]


I am getting some sleep and then I'll do some reading but I am open to any and all recommendations...

Nov 20, 2020 1:26 AM in response to Loner T

I must wait (as I am in Taiwan right now) to ask the OWC guys questions about the hardware but I am wondering if I actually need it.

Do you have any experience or know of any reason why the factory installed SSD would not show up while installed in the Macbook? I have since been able to install and test a new AURA pro in the MBP and it works fine. So the logic board is not at fault. The original SSD will not show up though. Further, it seems to get hot while installed. I could do the ddrescue from there if I could get it to be recognized even if it wont mount I assume. You ever hear of or have any experience with this kind of issue?

Nov 20, 2020 1:12 PM in response to BackBay

Definitely contact OWC tech support if you are unsure if the product is compatible with your hardware. I find OWC tech support to be very friendly and helpful.


I agree with @LonerT that the Apple SSD likely has a controller issue if it is getting extremely hot. Most of the SSD failures I have encountered have involved not being able to communicate with the SSD at all (regardless of the OS used). macOS is very particular and can even refuse to operate when the Apple hardware isn't working as expected so it doesn't surprise me that macOS may not see the SSD when installed internally. Plus by installing the SSD in a USB enclosure you are blocking some of the natural communication with the SSD. Really hard to say why one works and the other does not without gathering more information using a Linux boot disk.


It may be interesting to create a bootable Knoppix Linux USB drive to see whether Linux is able to detect the bad SSD when the bad SSD is internally. You can also use Knoppix to perform the clone using GNU ddrescue since Knoppix includes this utility by default. If you are interested in this method instead let me know since the directions are just slightly different than the ones I provided for macOS below.


In my previous post I provided a template for the command you can use with ddrescue at least on the first pass. If errors are encountered and you need to run another pass in an attempt to read any troublesome blocks, then the command should be modified by removing the " -n " option flag.


If you are cloning directly to another bare drive instead of a raw image file you may need to add the " -f " option flag after the " -n " option flag in order to force the utility to overwrite existing data on the destination drive. I believe the utility will alert you if this necessary.


This command will clone the SSD to a raw image file on your Desktop called "samsung-clone.img" along with "mapping-file.txt" which is needed if you restart an interrupted clone or to start another pass (see the previous post for some more information about this command and what you need to customize such as replacing "diskN" with the correct drive identifier):

sudo  ddrescue  --ask  -n  /dev/diskN   ~/Desktop/samsung-clone.img   ~/Desktop/mapping-file.txt


If you are going to clone the bad SSD to another equal or larger drive, then you need to modify the destination to point to the correct drive identifier for the destination drive which must not be mounted or ejected. To unmount a drive without ejecting the drive you need to use the following command (replacing the "Y" in "diskY" with the correct drive identifier):

diskutil  unmountDisk  diskY


Then you would use this template to clone to another bare drive:

sudo  ddrescue  --ask  -n  -f  /dev/diskN   /dev/diskY   ~/Desktop/mapping-file.txt


Notice I added the " -f " option flag to force the utility to overwrite data on the destination drive "diskY". I also modified the destination parameter from a raw image file on the Desktop to "/dev/diskY" which is the physical drive identified as "diskY". If you mix up the source & destinations, then you will overwrite your data (assuming it still exists) so be very careful.


This is all you really should need for your situation regarding ddrescue. I do recommend at least browsing the ddrescue manual on the website just to understand the basics of how the utility works and which parameters are for the source, destination, and mapping file. You do not need to read everything (I actually skimmed & skipped serveral sections myself).


As for downloading GNU ddrescue I suggest installing Homebrew so that you can access the newest version of GNU ddrescue when using macOS. Follow the instructions on the Homebrew website for installing Homebrew itself:

https://brew.sh/


To install Homebrew you can just cut & paste this command directly into macOS Terminal app (If you cut & paste this command from their website make sure not to include the leading "$" character which I've removed here):

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"


Once Home brew is installed it is very easy to install GNU ddrescue with the following command:

brew  install  ddrescue


FYI, I make it a point in my posts here to emphasize it is "GNU ddrescue" since there is another version of this utility just called "ddrescue" as well which isn't as good or the same utility. I'm not even sure if this other version still exists, but I want to ensure people use the correct utility. It is Ok for others to just reference it as "ddrescue" for simplicity.


This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Need to recover SSD partition table using Gdisk on Samsung 512GB on MBP MID 2015

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.