diskutil removeVolume of Apple_Boot volume erased previous volume
Ok, I was trying to consolidate data on a hard drive using terminal and diskutil.
My last partition on the disk was erased and it became an "Apple_boot" GUID_partion_scheme for some reason.
So I attempted to erase this last partition and this was my horrifying unexpected results (see bold part in quote, please)...
my-mac-pro:~ Dream$ diskutil list
/dev/disk0
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *3.0 TB disk0
1: Apple_HFS 3.9v2 379.9 GB disk0s1
2: Apple_HFS Humongus3 1.2 TB disk0s2
3: Apple_Boot 249.4 GB disk0s3
my-mac-pro:~ Dream$ man diskutil
my-mac-pro:~ Dream$ diskutil mergePartitions JHFS+ disk0s2 disk0s3
Usage: diskutil mergePartitions [force] format name
DiskIdentifier|DeviceNode DiskIdentifier|DeviceNode
Merge two or more pre-existing partitions into one. The first disk parameter
is the starting partition; the second disk parameter is the ending partition;
this given range of two or more partitions will be merged into one.
All partitions in the range, except for the first one, must be unmountable.
All data on merged partitions other than the first will be lost; data on the
first partition will be lost as well if the "force" argument is given.
If "force" is not given, and the first partition has a resizable file system
(e.g. JHFS+), it will be grown in a data-preserving manner, even if a different
file system is specified (in fact, your file system and volume name parameters
are both ignored in this case). If "force" is not given, and the first
partition is not resizable, you will be prompted if you want to erase.
If "force" is given, the first partition is always formatted. You should
do this if you wish to reformat to a new file system type.
Merged partitions are required to be ordered sequentially on disk.
See diskutil list for the actual on-disk ordering; BSD slice identifiers
may in certain circumstances not always be in numerical order but the
top-to-bottom order given by diskutil list is always the on-disk order.
Ownership of the affected disk is required.
Example: diskutil mergePartitions JHFS+ NewName disk3s4 disk3s7
This example will merge all partitions *BETWEEN* disk3s4 and disk3s7,
preserving data on disk3s4 but destroying data on disk3s5, disk3s6,
disk3s7 and any invisible free space partitions between those disks;
disk3s4 will be grown to cover the full space if possible.
my-mac-pro:~ Dream$ diskutil list
/dev/disk0
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *3.0 TB disk0
1: Apple_HFS 3.9v2 379.9 GB disk0s1
2: Apple_HFS Humongus3 1.2 TB disk0s2
3: Apple_Boot 249.4 GB disk0s3
my-mac-pro:~ Dream$ man diskutil
my-mac-pro:~ Dream$ diskutil eraseVolume JHFS+ Empty4 disk0s3
Started erase on disk0s3
Unmounting disk
Erasing
Initialized /dev/rdisk0s2 as a 1 TB HFS Plus volume with a 98304k journal
Mounting disk
Finished erase on disk0s2 Empty4
my-mac-pro:~ Dream$ diskutil list
/dev/disk0
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *3.0 TB disk0
1: EFI 209.7 MB disk0s5
2: Apple_HFS 3.9v2 379.9 GB disk0s1
3: Apple_HFS Empty4 1.2 TB disk0s2
4: Apple_HFS 249.3 GB disk0s3
my-mac-pro:~ Dream$
So the "Humongus3" volume was "erased" and named "Empty4"
so here are my questions
- What the heck happened
- Is there a way to undo this? It seems to for some reason to have converted the previous partion into an /rdisk?
- Is there a good way to recover the data, or rebuild the file structure on the volume that was once "Humongus3"?
Thanks for any help you may want to share
DreamConjuror
OS X Mountain Lion (10.8.5)