I was trying to delete a Win 10 bootcamp partition to merge it back into the main one with Mac OS X, but I have messed up because instead of just using Bootcamp itself I have manually deleted the small UEFI partition and Bootcamp wouldn't work anymore and Disk Utility showed up to 7 partitions, all inaccessible and some very small.
So I messed around with diskutil via terminal and I used the solution posted here: How do I delete a BootCamp partition using Terminal's diskutil?
sudo diskutil eraseVolume JHFS+ deleteme /dev/disksXX
I used this command twice on two of the empty Windows/Bootcamp partitions and I swear I did NOT deleted the main Mac OS partition (400GB of 500 total). PC kept working fine, all my data were there. I reboot and everything is gone, like there is no OS anymore!
Via recovery I have now re-installed High Sierra on the "former" Windows partition (100GB of 500 total). Here is the current state of the harddisk.
diskutil list
/dev/disk0 (internal, physical):
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *500.1 GB disk0
1: EFI EFI 209.7 MB disk0s1
2: Apple_HFS deleteme -134217728 B disk0s2
3: Apple_HFS deleteme 399.8 GB disk0s3
4: Apple_CoreStorage deleteme 98.0 GB disk0s4
5: Apple_Boot Recovery HD 650.0 MB disk0s5
/dev/disk1 (internal, virtual):
#: TYPE NAME SIZE IDENTIFIER
0: Apple_HFS deleteme +97.7 GB disk1
Logical Volume on disk0s4
ADBBCC29-EF79-48EB-AC19-792DCF08B90F
Unencrypted
Is there anything I can do to get my previous OS X installation back? At least recover my files, apps, downloads... I don't understand how they are all gone: I did not format the main partition (399.8 GB now called disk0s3) (how would it even be possible to do it with the OS currently running?)
Some details:
Mounted volumes:
:~$ mount
/dev/disk1 on / (hfs, local, journaled)
devfs on /dev (devfs, local, nobrowse)
map -hosts on /net (autofs, nosuid, automounted, nobrowse)
map auto_home on /home (autofs, automounted, nobrowse)
/dev/disk0s2 on /Volumes/deleteme 1 (hfs, local, read-only)
/dev/disk0s3 on /Volumes/deleteme 2 (hfs, local, read-only)
Content of the first three blocks of disk0s2:
:~$ sudo dd if=/dev/disk0s2 bs=512 count=3 | hexdump
Password:
3+0 records in
3+0 records out
0000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
1536 bytes transferred in 0.028495 secs (53905 bytes/sec)
*
0000400 48 2b 00 04 80 00 60 00 66 73 63 6b 00 00 0b a4
0000410 da bd 0e 2a da bc f3 0f 00 00 00 00 d7 a0 89 c1
0000420 00 00 00 3d 00 00 00 13 00 00 10 00 05 d1 3c 8d
0000430 05 cf 9c 04 00 00 00 00 00 01 00 00 00 01 00 00
0000440 00 0e fb f0 00 00 00 00 00 00 00 00 00 00 00 01
0000450 00 02 39 34 00 06 7a 1a 00 00 00 00 00 00 00 00
0000460 00 00 00 00 00 02 39 34 64 53 0b f7 20 5b f1 32
0000470 00 00 00 00 00 ba 30 00 00 00 00 00 00 00 0b a3
0000480 00 00 00 01 00 00 0b a3 00 00 00 00 00 00 00 00
0000490 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*
00004c0 00 00 00 00 00 90 00 00 00 90 00 00 00 00 09 00
00004d0 00 00 2b a5 00 00 09 00 00 00 00 00 00 00 00 00
00004e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*
0000510 00 00 00 00 0a 90 00 00 0a 90 00 00 00 00 a9 00
0000520 00 08 8a a5 00 00 a9 00 00 00 00 00 00 00 00 00
0000530 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*
0000560 00 00 00 00 0c 20 00 00 0c 20 00 00 00 00 c2 00
0000570 00 00 34 a5 00 00 c2 00 00 00 00 00 00 00 00 00
0000580 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*
0000600