Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

netnothing

macrumors 68040
Original poster
Mar 13, 2007
3,828
450
NH
Ok, so playing around I installed Lion on a clean formatted external disk to do some testing.

One thing I'm trying to figure out now is doing a backup boot clone and the potential way to restore. Obviously, cloners like CCC and Super Duper will clone my boot drive fine....but it won't clone the Recovery Partition.

So, for me I clone my boot drive to an external disk. If my main SSD should ever fail....I can always throw this disk in my Mac Pro. However, in the long run, I'd just be getting a new SSD to clone it back. Now if I were to just clone it back, I wouldn't get the Recovery Partition.

So what I'm assuming is that to work this way in the future....if my drive was to fail, once I get a new SSD boot drive, I'd clean install Lion on that (thus creating the Recovery Partition), and then clone the backup back onto it.

Sound correct?

Now, what I tested was taking that clean Lion install, and erasing the Lion partition. What I noticed is that just doing an erase in Disk Utility, also kills the Recovery Partition. Why would erasing the Lion install kill the recovery partition? Is it not a real partition?

-Kevin
 
The recovery partition is hidden. It won't show up in disk utility. But I think if your erase the entire disk it will also erase that hidden recovery partition.
 
The recovery partition is hidden. It won't show up in disk utility. But I think if your erase the entire disk it will also erase that hidden recovery partition.

Correct. I know you don't see it. Guess I should have been clear.....to view it's there I'm using diskutil list from terminal.

I'm guessing however, that it's not a "real" partition. Because if it were a real partition, then me erasing the Lion install partition (from Disk Utility) should have no effect on the Recovery Partition.

-Kevin
 
Correct. I know you don't see it. Guess I should have been clear.....to view it's there I'm using diskutil list from terminal.

I'm guessing however, that it's not a "real" partition. Because if it were a real partition, then me erasing the Lion install partition (from Disk Utility) should have no effect on the Recovery Partition.

-Kevin

According to this thread https://forums.macrumors.com/threads/1168017/ you have to remove the entire hard disk to remove the recovery partition.

It is a real partition, but I don't think you can erase it unless you erase the entire "Macintosh HD". I had Lion installed and then went back to a Snow Leopard time machine backup to get rid of it, and low and behold the Lion recovery was still there when I booted up the machine while holding the "option" key. I had to erase the entire HD and then restore my time machine backup to get rid of the recovery partition.
 
According to this thread https://forums.macrumors.com/threads/1168017/ you have to remove the entire hard disk to remove the recovery partition.

It is a real partition, but I don't think you can erase it unless you erase the entire "Macintosh HD". I had Lion installed and then went back to a Snow Leopard time machine backup to get rid of it, and low and behold the Lion recovery was still there when I booted up the machine while holding the "option" key. I had to erase the entire HD and then restore my time machine backup to get rid of the recovery partition.

Thanks for pointing out that thread. I replied to ask if anyone has an update since it's from June.

I'm trying this again.....and will report back.

When I erase my "Lion Test", I'm erasing the partition in Disk Utility....not the drive itself. So I don't know why it would be touching the Recovery Partition.

-Kevin
 
Thanks for pointing out that thread. I replied to ask if anyone has an update since it's from June.

I'm trying this again.....and will report back.

When I erase my "Lion Test", I'm erasing the partition in Disk Utility....not the drive itself. So I don't know why it would be touching the Recovery Partition.

-Kevin

I may be wrong. But I don't think I am. If "Lion Test" is the name of your hard drive and you erase it in Disk Utility, you are in effect erasing both the recovery partition (which is hidden from view) and your regular Lion partition.

Maybe someone else can shed some light on this?
 
I may be wrong. But I don't think I am. If "Lion Test" is the name of your hard drive and you erase it in Disk Utility, you are in effect erasing both the recovery partition (which is hidden from view) and your regular Lion partition.

Maybe someone else can shed some light on this?

I'll post some screens once the install is done.....but to answer your question, in Disk Utility, I'm clicking on the indented partition called "Lion Test" and erasing that.

I'm not clicking on the overall drive, which is where the "Lion Test" partition is indented from.

-Kevin
 
Ok, so playing around I installed Lion on a clean formatted external disk to do some testing.

One thing I'm trying to figure out now is doing a backup boot clone and the potential way to restore. Obviously, cloners like CCC and Super Duper will clone my boot drive fine....but it won't clone the Recovery Partition.

So, for me I clone my boot drive to an external disk. If my main SSD should ever fail....I can always throw this disk in my Mac Pro. However, in the long run, I'd just be getting a new SSD to clone it back. Now if I were to just clone it back, I wouldn't get the Recovery Partition.

So what I'm assuming is that to work this way in the future....if my drive was to fail, once I get a new SSD boot drive, I'd clean install Lion on that (thus creating the Recovery Partition), and then clone the backup back onto it.

Sound correct?

Now, what I tested was taking that clean Lion install, and erasing the Lion partition. What I noticed is that just doing an erase in Disk Utility, also kills the Recovery Partition. Why would erasing the Lion install kill the recovery partition? Is it not a real partition?

-Kevin

From the diskutil manpage:

diskutil said:
eraseDisk format name [[APM]Format | [MBR]Format | [GPT]Format] device
Erase an existing disk, removing all volumes and writing out a new partitioning scheme con-
taining one new empty filesystem volume. If the partitioning scheme is not specified, then
an appropriate one for the current machine is chosen. Format is discussed below in the sec-
tion for the partitionDisk verb. Ownership of the affected disk is required.

As for the recovery partition being a "real" partition -- it indeed is. If you mount it (diskutil mount disk0s3) you'll see that the /Volumes/Recovery HD is an ordinary HFS+ volume. However in the GPT table it's flagged as "Apple_Boot" (UUID 426F6F74-0000-11AA-AA11-00306543ECAC) which renders the partition invisible to GUI programs like Disk Utility.. See also the manpage for gpt, (try sudo gpt -r show disk0 and also sudo gpt -r show -l disk0).
 
Ok, so I just took an external drive and plugged it into my NewerTech Voyager dock. Hooked this up to my MacBook running Lion.

I created one partition on the drive called "Lion Test"
I then installed Lion on the drive.

After the install, when I boot back into my Macbook and run diskutil list I see this:

Code:
/dev/disk1
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *300.1 GB   disk1
   1:                        EFI                         209.7 MB   disk1s1
   2:                  Apple_HFS Lion Test               299.2 GB   disk1s2
   3:                 Apple_Boot Recovery HD             650.0 MB   disk1s3

Ok cool....there's the Lion Test partition and the Recovery HD.

Attached below is a screenshot of what this looks like in Disk Utility. Clearly, you cannot see the Recovery HD. However, shouldn't I be able to click on the "Lion Test" partition.....then click erase, and have Disk Utility only erase the "Lion Test"? Afterwards shouldn't I still be able to see the Recovery HD partition using diskutil list?

-Kevin
 

Attachments

  • Screen Shot 2011-08-09 at 10.41.32 AM.png
    Screen Shot 2011-08-09 at 10.41.32 AM.png
    166.3 KB · Views: 109
Attached below is a screenshot of what this looks like in Disk Utility. Clearly, you cannot see the Recovery HD. However, shouldn't I be able to click on the "Lion Test" partition.....then click erase, and have Disk Utility only erase the "Lion Test"? Afterwards shouldn't I still be able to see the Recovery HD partition using diskutil list?

-Kevin

Negative.

Doing an Erase in Disk Utility erases all partitions (all volumes) on the target disk and leaves you with one partition in whatever format you chose.
 
Ok, so I go into Disk Utility, and I highlight just the "Lion Test" partition and click erase. The screenshot attached shows that Disk Utility says it will erase this partition, not affecting any other partitions on the disk.

However, after I do that and run diskutil list on the drive again, I get this:

Code:
/dev/disk1
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *300.1 GB   disk1
   1:                        EFI                         209.7 MB   disk1s1
   2:                  Apple_HFS Lion Test               299.2 GB   disk1s2


No recovery partition.

Why?

-Kevin
 

Attachments

  • Screen Shot 2011-08-09 at 10.46.44 AM.png
    Screen Shot 2011-08-09 at 10.46.44 AM.png
    190.2 KB · Views: 107
Negative.

Doing an Erase in Disk Utility erases all partitions (all volumes) on the target disk and leaves you with one partition in whatever format you chose.

That doesn't make any sense. If I create two partitons on this drive....and I put a bunch of stuff in both. If I then erase one of the partitions.....it doesn't erase anything in the other one.

-Kevin
 
Ok, so I go into Disk Utility, and I highlight just the "Lion Test" partition and click erase. The screenshot attached shows that Disk Utility says it will erase this partition, not affecting any other partitions on the disk.

However, after I do that and run diskutil list on the drive again, I get this:

Code:
/dev/disk1
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *300.1 GB   disk1
   1:                        EFI                         209.7 MB   disk1s1
   2:                  Apple_HFS Lion Test               299.2 GB   disk1s2


No recovery partition.

Why?

-Kevin

You have to click where it says "NewerTech" and erase that. That should erase everything on that drive including the hidden recovery partition. If you click on "Lion Test" you are not erasing the hidden partition. Put it this way.. if the recovery partition were not hidden, it would just show up right underneath the "Lion Test" partition.
 
That doesn't make any sense. If I create two partitons on this drive....and I put a bunch of stuff in both. If I then erase one of the partitions.....it doesn't erase anything in the other one.

-Kevin

Yes, and I stand corrected. I was going by the info about eraseDisk in the man page, when in fact you're effectively doing eraseVolume.

Perhaps you found another bug? Or perhaps Disk Utility treats Apple_Boot partitions specially, given the fact that it cannot even see them? If it doesn't know a partition is there, why would it necessarily be preserved?

You could, as a test, change the partition type of the recovery partition from Apple_Boot to Apple_HFS and try your Disk Utility test again.
 
You have to click where it says "NewerTech" and erase that. That should erase everything on that drive including the hidden recovery partition. If you click on "Lion Test" you are not erasing the hidden partition. Put it this way.. if the recovery partition were not hidden, it would just show up right underneath the "Lion Test" partition.

That's not what I'm trying to do.

I AM just clicking on "Lion Test" and erasing that volume. However, what is happening is it is also erasing the Recovery HD partition.....which is why I'm confused. If OS X treats it as a real partiton......why when erasing just the Lion Test, does it ALSO erase the Recovery HD?

See, my goal in all this was testing for creating a full clone of my Lion boot drive. I was trying to see if I clean installed Lion on a drive, then erased just the Lion install part, whether I would be left with an empty partition AND the Recovery HD partition. I'm just tinkering.....to see what happens. Clearly though, it looks like OS X is killing the Recovery HD partition when I erase the Lion partition.

-Kevin
 
Why do you want to delete it in the first place?

Because it's there? :D:p:eek:

Seriously though....I was just playing around with cloning options and was curious to see if I erased the clean Lion install and cloned BACK onto this drive, whether the Recovery HD partition would still be there. What I'm finding is....it's not.

-Kevin
 
Because it's there? :D:p:eek:

Seriously though....I was just playing around with cloning options and was curious to see if I erased the clean Lion install and cloned BACK onto this drive, whether the Recovery HD partition would still be there. What I'm finding is....it's not.

-Kevin

Your better off using the lion recovery assistant:

http://support.apple.com/kb/DL1433

And create a USB recovery disk anyway. If your OS disk fails....thats where the recovery hd is located!! Which really makes no sense to me.
 
Just an FYI.....

diskutil eraseVolume from the terminal will ALSO wipe the Recovery HD.

I think OS X is tying the Lion partition to the Recovery HD partition and diskutil knows about it.

In this latest case.....I had another partition on the drive and erasing the Lion one does not affect that partition.

-Kevin
 
EDIT: It is unknown at this time whether the order of the partitions matters. The below tests were done with the Apple_Boot ("recovery") partition placed after the regular HFS+ partition in the GPT table, similar to how disk0 would be partitioned on a legit Lion installation.


Here's a bit of research/evidence that ultimately comes these conclusions:

  1. Behavior of Disk Utility in regards to Apple_Boot partitions differs on SL and Lion
  2. When erasing a disk slice (e.g. Macintosh HD), SL Disk Utility leaves the Apple_Boot partition alone; Lion removes the Apple_Boot partition from the partition table but apparenlty leaves the data alone
  3. Lion's behavior should be considered a bug (I have not, yet, reported it)

I did my testing with an 8GB USB stick with a GUID partition map that contained two slices: an HFS+ ("Apple_HFS") and an HFS+ flagged as "Apple_Boot" (the type of Lion's recovery partition). I used the gpt command-line utility for manipulating the partition map and appropriate newfs_hfs commands as well for formatting.

For all images please click the thumbnails.

ON SNOW LEOPARD

Here's what diskutil list disk1 reported for the USB stick after initial partitioning and formatting and mounting (of course only disk1s2 was mounted since the Apple_Boot slices are ignored):
SL-before.png


Then I hit this with Disk Utility to erase the visible slice:
SL-erase.png


The Apple_Boot partition wasn't touched, as seen by the output of diskutil list disk1:
SL-after.png


For the sake of reference, here's the partition table as reported by sudo gpt -r show disk1:
SL-GPT.png



ON LION

I popped this thing into my MBA4,2. As expected, diskutil list disk1 reported the following:
lion-before.png


I hit it with Disk Utility to erase the visible slice (disk1s2):
lion-erase.png


After that -- GASP! -- the "recovery" partition was gone:
lion-after.png


And the partition map, as reported by gpt:
lion-GPT.png



BACK ON SNOW LEOPARD

I hopped back on my trusted and favored SL box. I re-added the "recovery" (Apple_Boot) partition using gpt. This step implies that, although the partition had been removed by Disk Utility on Lion, it wasn't erased! (see the output of diskutil list disk1):
SL-GPT-after-lion.png


And, as expected, the "recovery" partition (Untitled 2) mounted just fine. (Note the first mountDisk verb ignores the recovery/Apple_Boot slice; it has to be explicitly mounted.):
SL-mount-after-lion.png


and, output of mount:
SL-mount-after-lion2.png
 
Last edited:
EDIT: It is unknown at this time whether the order of the partitions matters. The below tests were done with the Apple_Boot ("recovery") partition placed after the regular HFS+ partition in the GPT table, similar to how disk0 would be partitioned on a legit Lion installation.


Here's a bit of research/evidence that ultimately comes these conclusions:
...

Wow....awesome testing. Thanks for doing that.

So it looks like the partition is still there, just not shown within a Lion system.

Interesting.

-Kevin
 
Wow....awesome testing. Thanks for doing that.

So it looks like the partition is still there, just not shown within a Lion system.

Interesting.

-Kevin

No problem. I was as curious as you, and a little distraction from legitimate work I should be doing is always good. ;)

Yes, Lion apparently re-writes the drive's partition map when you erase your Lion Test slice using Disk Utility, leaving out the Recovery slice. When it re-writes the map, it uses the same geometry that the Lion Test slice had before the erase (i.e. the same start and size as reported by gpt). As we know the Recovery slice resides after the Lion Test slice; Disk Utility merely removes it from the partition map (effectively does a gpt remove) but it apparently doesn't do anything at all to the actual bytes of data aside from changing the partition table. So, after you do the erase procedure using Disk Utility -- and if you know the start and size parameters of the recovery slice (as shown by gpt) -- you could do a gpt add to put that recovery slice back in the partition map.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.