Unmounting Recovery HD with Fusion Drives

JPDyson
Valued Contributor

It's worth noting that in the case of a Fusion Drive, the typical approach to unmounting a Recovery HD partition as outlined in the KB article for deploying 10.8 will not work. Recovery HD will not be disk0s3, or on disk0 at all. I'm considering another approach that will determine the actual location of Recovery HD as follows:

diskutil list | grep 'Apple_Boot Recovery HD' | tail -c 8

This returns the accurate location for each case I've tried, but it does assume your Recovery HD is called Recovery HD (as it will be if you use the Configuration I've built). Does anybody see a problem with "Solving" for the Recovery HD in this manner?

5 REPLIES 5

mm2270
Legendary Contributor III

I think it would be a little safer to do it this way-

diskutil list | awk '/Apple_Boot/{print $NF}'

A Recovery HD, if present, will always show up as a type of 'Apple_Boot', regardless of what it got named, so using awk's regex matching to look for that should be safe unless you somehow have more than one Recovery HD present, which would be a very unusual case. Also, telling awk to print out the last column would be safer than trying to tail the last 8 characters. Although the identifier should be 7 characters in length, there's no absolute guarantee that it will be.

JPDyson
Valued Contributor

Perhaps not. Check out my Fusion drive...

/dev/disk0
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *1.0 TB     disk0
   1:                        EFI                         209.7 MB   disk0s1
   2:          Apple_CoreStorage                         999.3 GB   disk0s2
   3:                 Apple_Boot Boot OS X               650.0 MB   disk0s3
/dev/disk1
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *121.3 GB   disk1
   1:                        EFI                         209.7 MB   disk1s1
   2:          Apple_CoreStorage                         121.0 GB   disk1s2
   3:                 Apple_Boot Boot OS X               134.2 MB   disk1s3

JPDyson
Valued Contributor

So, the approach fails for a different reason - it wont' be Apple_Boot until I MAKE it Apple_Boot; that's half of what the script does (the first half is to unmount). I do agree with your "last column" idea, though. I'm testing this now:

diskutil list | grep 'Apple_HFS Recovery HD' | awk '{print $NF}'

Because after imaging, it's going to look like this:

/dev/disk0
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *1.0 TB     disk0
   1:                        EFI                         209.7 MB   disk0s1
   2:          Apple_CoreStorage                         999.3 GB   disk0s2
   3:                 Apple_Boot Boot OS X               650.0 MB   disk0s3
/dev/disk1
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *121.3 GB   disk1
   1:                        EFI                         209.7 MB   disk1s1
   2:          Apple_CoreStorage                         121.0 GB   disk1s2
   3:                 Apple_Boot Boot OS X               134.2 MB   disk1s3
/dev/disk2
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *1.1 TB     disk2
   1:                        EFI                         209.7 MB   disk2s1
   2:                  Apple_HFS Macintosh HD            1.1 TB     disk2s2
   3:                  Apple_HFS Recovery HD             814.6 MB   disk2s3

So, this approach is targeted to exactly what I'm trying to solve: A Recovery HD that I've created from my image.

mm2270
Legendary Contributor III

Ah, I got it now. I didn't really understand what you were trying to do in grabbing that information. I thought you needed get the disk identifier for an existing, working Recovery HD, but makes sense now. :)

chenderson
New Contributor II

Josh, do you mind sharing your final script for unmounting the Recovery HD on a Fusion drive?