I have an embarrassing but very urgent problem. A friend of mine asked me to set up their new external HD for both Time Machine and file storage, and to transfer over files from their old HD. I started to partition the new drive using Disk Utility, but the partition option was greyed out. The entire disk was formatted as exFat, so I thought to reformat it as HFS+. I began to do so with diskUtil: diskUtil erasedisk hfs+ External /dev/disk2
(Note: this is on a Macbook Pro running El Capitan)
However, I mistyped. The new drive was not disk2, it was disk3–I had started to erase the old disk instead, which has important data in it. I realized my problem in an instant and ^C
'd my way out of there, but the damage was done. Here's the sitch:
-
Terminal output says:
Starting erase on disk2 Unmounting disk diskutil:interrupted $ diskUtil list ... /dev/disk2 (external, physical): #: TYPE NAME SIZE IDENTIFIER 0: GUID_partition_scheme *1.0 TB disk2 1: EFI EFI 209.7 MB disk2s1 2: Apple_HFS 999.8 GB disk2s2
-
As you can see, OSX recognizes the drive as GPT and the partition as HFS+. However, the drive will not show up in Finder.
- Windows (10) recognizes that I have an external HD plugged in, but nothing shows under "Volumes" when I view its device in Device Manager.
- Linux (Arch) recognizes the drive and the partition, just like OSX. I tried running ntfsfix, but to no avail. (It gave me a warning that said something about being unable to fix it and to try using chkdsk).
- I am not 100% certain what the state of this HD was before I half-formatted it. It was first used and formatted on a cheap Windows laptop when Vista was the newest Windows OS, so I would think that it was NTFS on an MBR scheme before I violated it. (Perhaps I'm wrong and someone knows better, but that's what I'm led to believe).
Anyways, here I am. I need to recover about 700GB of data, perhaps NTFS/MBR, on a drive that thinks it's HFS+/GPT. All of the data has got to be there, more or less at least, but I need help accessing it. If you have any insight or knowledge that could help me out, I would truly appreciate it.
(Lastly, I've downloaded and installed some data recovery software from Easeus. It's running a "scan" on the drive, and I suspect it'll fix my problem if I dish over $90 or so. This is just a last resort, though. I'd really rather not have this headache become an expensive one, and since it's picking a lot of data, I know there's gotta be a way to solve this with some elbow grease.)
Best Answer
You should be able to restore at least the boundaries of the old NTFS volume:
Windows (like OS X) uses some default partition schemes to partition and format a disk.
An MBR/NTFS disk usually has an MBR in the first block (block0). The first partition usually starts at the 1 MB boundary (that's block2048) with a special block - the NTFS Boot Sector - and ends with a special block. Both blocks start with EB 52 90 4E 54 46 53 20 (hex) or ∂RENTFS(x20). The last 4096 blocks (2 MiB) are empty space usually.
Depending on how much was written while creating ("erasing") the new main HFS+ volume (usually about 120 - 160 MB after the process finished) the success of a data recovery may vary.
Detach any external drive except the broken one!
To recover the old NTFS volume boundaries you have to delete the GUID partition table and restore an MBR partition scheme:
To remove the GUIDpt, first open Terminal.app and get an overview (below I assume the disk identifier of the falsely formatted disk is disk2):
The result is similar to the one below (your total size - here 1953525760 blocks and the main volume - here 1952853936 blocks - may differ slightly):
Remove the GUIDpt:
Search the disk for the string ∂RENTFS(x20) in the last sectors of the disk:
-s: Skip offset bytes from the beginning of the input. The size is KiB/MiB/GiB. In my example the disk has a size of 931.51 GiB, so I searched the last 1.51 Gib only.
The result is
e8e0bffe00 eb 52 90 4e 54 46 53 20 20 20 20 00 02 08 00 00
with e8e0bffe00 being the offset in hex. Converted with a hex2dec service this means an offset of 1000203091456 (dividing this by 512, the result is equal to block 1953521663).Since this block is the last one in the previous volume you can determine the old volume size: 1953521663 (last block) - 2048 (probable start block) + 1 (counting starts with 0). The result has to be divisible by 8!
You may also check the first blocks of the disk with:
You should get at least one line like this:
800 eb 52 90 4e 54 46 53 20 20 20 20 00 02 08 00 00
. This is the NTFS Boot Sector at block 2048 - the 1 MB boundary - since these blocks are usually not erased by Disk Utility. Enter ctrlC to stop hexdump.Now having the first block and the last block of the NTFS volume you should be able to restore the old MBR partition with fdisk:
Now you may be lucky and the NTFS volume just pops up or you have to use a data recovery tool.