PDA

View Full Version : Create Recovery Partition


Dalton63841
Jun 13, 2013, 08:57 AM
With the new 10.9 beta installer, a recovery partition is not created if you use a DIY USB installer. The reason for that is because the BaseSystem.dmg needs to be copied onto the Recovery partition, but it does not exist as a dmg file on the USB Installer. This presents a problem for some, as functions like "Find My Mac" and FileVault won't work without it. Here are the instructions to fix that. I am not responsible for your system... Blah blah blah normal disclaimer. It will not break Boot Camp so no worries there.

Standard Recovery Partition(UPDATED EASIER!!!)

1. Download the Lion Recovery Update (http://support.apple.com/kb/DL1464). Make sure it is in your downloads folder. Then right click on the OS X Installer.app file and click Show Package Contents. Go to Contents/SharedSupport/. Copy the InstallESD.dmg file into your Downloads folder.

###Alternate Lion Recovery HD Update Link (https://www.dropbox.com/s/4jh93fwsgrzs4ad/RecoveryHDUpdate.dmg)

2. Copy the following code into a text document and save it as "recovery.sh" in your Downloads folder.
read -p "Ensure "RecoveryHDUpdate.dmg" and "InstallESD.dmg" are in your Downloads folder and press [Enter]"

#access dmtest from RecoveryHDUpdate.pkg
rm -rf /private/tmp/RecoveryHDUpdate
echo "Expanding RecoveryHDUpdate.pkg"
hdiutil attach -nobrowse ~/Downloads/RecoveryHDUpdate.dmg
pkgutil --expand /Volumes/Mac\ OS\ X\ Lion\ Recovery\ HD\ Update/RecoveryHDUpdate.pkg /tmp/RecoveryHDUpdate

#access BaseSystem.dmg and BaseSystem.chunklist
echo "Expanding InstallESD.dmg"
hdiutil attach -nobrowse ~/Downloads/InstallESD.dmg

#build Recovery partition
echo "Building Recovery Partition. Please Wait"
/tmp/RecoveryHDUpdate/RecoveryHDUpdate.pkg/Scripts/Tools/dmtest ensureRecoveryPartition / /Volumes/OS\ X\ Install\ ESD/BaseSystem.dmg 0 0 /Volumes/OS\ X\ Install\ ESD/BaseSystem.chunklist

#cleanup
echo "Cleaning up"
hdiutil eject /Volumes/Mac\ OS\ X\ Lion\ Recovery\ HD\ Update
hdiutil eject /Volumes/OS\ X\ Install\ ESD/
sudo touch /Library/Preferences/SystemConfiguration/com.apple.Boot.plist
sudo kextcache -f -u /
exit 0

3. Open Terminal and type the following commands:
chmod +x ~/Downloads/recovery.sh
sudo ~/Downloads/recovery.sh

4. Wait a few minutes for it to finish and return back to a prompt. Reboot to test your new recovery partition.

Dalton63841
Jun 14, 2013, 02:54 AM
Instructions significantly simplified. I took down the instructions for the full offline installer. Some kind of signature check is performed, so modifying the Recovery partition breaks it. I can get it to boot to a working offline installer, but it stops being recognized as a proper recovery partition.

Macman45
Jun 14, 2013, 03:02 AM
For the first time in years, I don't have a "Spare" Mac but I wish I did....with just my Imac and my rMBP, both of which are essential to me, I can't play with 10.9 yet, but it looks a lot more interesting than previous incarnations since SL.

richard6r
Jun 14, 2013, 03:52 AM
Great post! Wish I would've seen it earlier... took the easy way out and ran the installer from inside os x and it created the recovery partition that way. :apple:

Dalton63841
Jun 14, 2013, 03:58 AM
Great post! Wish I would've seen it earlier... took the easy way out and ran the installer from inside os x and it created the recovery partition that way. :apple:

Didn't even know that was an option. Still, there are certain instances where the installer refuses to make a recovery partition. Usually because of odd hard drive or partition setups. This gets around that.

torana355
Jun 14, 2013, 06:12 PM
I tried it but it comes up with syntax errors. :(

Dalton63841
Jun 14, 2013, 08:01 PM
I tried it but it comes up with syntax errors. :(

It either copied wrong, or else the text editor is messing it up. Try this:

torana355
Jun 14, 2013, 08:12 PM
It either copied wrong, or else the text editor is messing it up. Try this:

That worked a treat. Thanks! I wonder why my text file didnt work, it looked the same lol.


EDIT: i figured it out, the apple textedit app defaults to RTF on a new document instead of plain text. Doh lol

Dalton63841
Jun 14, 2013, 08:24 PM
That worked a treat. Thanks! I wonder why my text file didnt work, it looked the same lol.


EDIT: i figured it out, the apple textedit app defaults to RTF on a new document instead of plain text. Doh lol

What text editor did you use?

torana355
Jun 14, 2013, 08:25 PM
What text editor did you use?

The standard Apple textedit app. I set it to plain text in preferences and it works fine now :) Thanks for your help.

Dalton63841
Jun 14, 2013, 08:29 PM
The standard Apple textedit app. I set it to plain text in preferences and it works fine now :) Thanks for your help.

Glad it worked! I kind of figured it was something like that. Some text editors edit line breaks in a way that screws up shell scripts.

tywebb13
Jun 15, 2013, 03:41 AM
Great stuff! Worked for me too (on a 2011 mba dual booting lion and mavericks).

I just want know though as other developer previews and public versions of mavericks are released and we continue to use bootable usbs to install these, would we have to redo the process to update the recovery partition as well?

Dalton63841
Jun 15, 2013, 03:52 AM
Great stuff! Worked for me too (on a 2011 mba dual booting lion and mavericks).

I just want know though as other developer previews and public versions of mavericks are released and we continue to use bootable usbs to install these, would we have to redo the process to update the recovery partition as well?

I am pretty sure you would. But on the bright side you don't have to do anything special when that happens. If you don't have a recovery partition, this script builds one, but if you do already have a Recovery partition, the script will just update the Recovery partition with the new files.

I thought about adding a few lines to the script to handle getting the LionRecoveryHD.dmg, and deleting that file after it's done.

Pros: You wouldn't have to redownload or keep up with that file, or mess with it at all. You would literally just drop the InstallESD.dmg into your Downloads folder, and run this script.

Cons: It would add on up to about 5 minutes to the amount of time it takes the script to run. Because of this, I am going to see what people think before I change it.

tywebb13
Jun 15, 2013, 04:43 AM
But you know what's going to happen? I reckon a lot of people will make the recovery partition once, happily update their system with usbs without taking care to update the recovery partition at all. I think that's fraught with danger and I'm not suggesting that I'm in that category.......

But!!!!.......

You know what I mean. I really don't like what apple have done with the installesd file! It has essentially separated the installation of the system and recovery partition. Before it used to be done together from bootable usbs (the old way) so there was no possibility of having an updated system without an updated recovery partition. So it never was an issue before. But now it may become a big issue for those who choose to update with usbs!

I'm happy that you made the script file and it will be good for those who need it. But my point is that we shouldn't need it at all!

Apple should go back to the old way so that systems and recovery partitions are updated together from bootable usbs restored directly from the installesd file.

Dalton63841
Jun 15, 2013, 05:31 AM
But you know what's going to happen? I reckon a lot of people will make the recovery partition once, happily update their system with usbs without taking care to update the recovery partition at all. I think that's fraught with danger and I'm not suggesting that I'm in that category.......

But!!!!.......

You know what I mean. I really don't like what apple have done with the installesd file! It has essentially separated the installation of the system and recovery partition. Before it used to be done together from bootable usbs (the old way) so there was no possibility of having an updated system without an updated recovery partition. So it never was an issue before. But now it may become a big issue for those who choose to update with usbs!

I'm happy that you made the script file and it will be good for those who need it. But my point is that we shouldn't need it at all!

Apple should go back to the old way so that systems and recovery partitions are updated together from bootable usbs restored directly from the installesd file.

I agree completely. Honestly I will NEVER use my Recovery partition to reinstall. The only reason I made this script to build one is because it is required for "Find My Mac" and Filevault to work at all. And I'm willing to bet most feel the same. It's a nice idea, but having to download all the installation files from apples servers is hugely time consuming, especially when I can just keep a flash drive installer in a drawer that will do the same thing in 20 minutes.

Also, if I'm needing to jump into the Recovery partition to use Time Machine, disk utility or terminal to fix something, those tools won't be broken, even if it is outdated.

Beasty34
Jun 15, 2013, 06:09 AM
I am unable to install mavericks as it claims a recovery partition would not be created, the installer just plain refuses to continue and boots back into ML, would this sort that issue?

Dalton63841
Jun 15, 2013, 07:59 AM
I am unable to install mavericks as it claims a recovery partition would not be created, the installer just plain refuses to continue and boots back into ML, would this sort that issue?

Possibly. If there is a recovery partition before you try to install Mavericks it may go ahead and use it. BUT! Use the InstallESD for Mountain Lion, since that is what is currently installed. I can't predict what it will do if you install a Mavericks recovery partition to a Mountain Lion install.

After the recovery partition is built, then try installing Mavericks again and let me know what happens.

mmomega
Jun 15, 2013, 06:27 PM
Didn't even know that was an option. Still, there are certain instances where the installer refuses to make a recovery partition. Usually because of odd hard drive or partition setups. This gets around that.

When I initially just upgraded to Mavericks from Mountain Lion, it also upgraded my Recovery partition from 10.8 to 10.9.

However I wanted a fresh install so Restart - Option - Boot to 10.9 Recovery Installer and no matter what I did, 10.9 would not complete a fresh install from recovery.
I ran DiskUtility from recovery and formatted the SSD, the installer would just sit on trying to connect to my iTunes/AppStore account to verify my 10.9 was legit. It sat there for 45 minutes before I gave up and created the(your) USB Install.

Dalton63841
Jun 20, 2013, 05:59 PM
When I initially just upgraded to Mavericks from Mountain Lion, it also upgraded my Recovery partition from 10.8 to 10.9.

However I wanted a fresh install so Restart - Option - Boot to 10.9 Recovery Installer and no matter what I did, 10.9 would not complete a fresh install from recovery.
I ran DiskUtility from recovery and formatted the SSD, the installer would just sit on trying to connect to my iTunes/AppStore account to verify my 10.9 was legit. It sat there for 45 minutes before I gave up and created the(your) USB Install.

Yea the regular recovery partition is kind of a PITA, and especially useless since they don't even have anything set up for the beta to actually do a store. That's why I went ahead and did THIS (http://forums.macrumors.com/showthread.php?t=1598564)

chell
Jun 25, 2013, 06:58 AM
When I try to download the Lion Recovery Update from Apple I get a 404. Does anyone have the file?

Dalton63841
Jun 25, 2013, 07:01 AM
When I try to download the Lion Recovery Update from Apple I get a 404. Does anyone have the file?

I did notice that the download for that file seems to be sporadic... Sometimes it works and sometimes it drops a 404. Give me a bit to upload it to my Skydrive. It's a 452Mb download.

EDIT: Added a dropbox link since the main link for Lion Recovery HD Update is wonky.

tywebb13
Jun 27, 2013, 04:12 AM
A more stable link is http://support.apple.com/kb/dl1464

where the dl is lower case

Dalton63841
Jun 27, 2013, 07:44 PM
A more stable link is http://support.apple.com/kb/dl1464

where the dl is lower case

Thanks for that...

In other news, I built an ApplescriptObjC application that can:

1. Check whether or not you have a recovery partition.
2. Destroy the recovery partition and add that space back into the root volume.
3. Create a standard recovery partition.
4. Create an offline recovery partition.

You choose which one you want to do, and if it is option 3 or 4 you choose your InstallESD.dmg and it handles the rest. Works on Lion, ML, and Mavericks.

If anyone is interested in it just let me know.

tywebb13
Jul 3, 2013, 07:01 PM
Yeah. I'm interested. Why don't you just attach it here somewhere so we can download it?

Beasty34
Jul 6, 2013, 11:41 AM
Please!

Dalton63841
Jul 6, 2013, 12:32 PM
Yeah. I'm interested. Why don't you just attach it here somewhere so we can download it?

Please!

I made a whole post for it here:
http://forums.macrumors.com/showthread.php?p=17540458#post17540458

hmedia
Aug 19, 2013, 08:26 AM
Hi Dalton,

Firstly i wish to thank you for putting in the time and creating this tool, it's a very handy thing to have in my toolkit.

Second, would you have any insight as to how the recovery partition can be created on a RAID 0 ? (AppleRAID)

More specifically - i am trying to enable file vault on the RAID.

More specifically again still - I can actually get a bootable working RAID, and i can successfully encrypt it, i just can't BOOT from it, or AUTHRESTART into it.

My goal is a 710GB Raid 0 with a pre-boot unlock. Damn you apple.

I have tried all the following;

1)
- Format 3 SSD's, leave 10GB space free on each, and create a RAID 0 of 710GB and converted it into a corestorage logical volume group & volume of 710GB called "iMacHDD"
- Tried running the installer from a USB booted Mac OSX - it got to the reboot and said cannot create recovery volume

2)
- Format the 710GB RAID and use Carbon Copy Cloner to copy a bootable OS X onto the raid.
- Raid volume boots up fine, but FileVault refuses to encrypt drive because no recovery partition is present
- Tried a few tools including "Recovery Partition Creator 3.5" and your tool, to manually create a Recovery Partition. Both fail. RPC3.5 just quits, and your tool hangs at about 3/4.

Which leads me to;

3)
- Manually encrypt the 710GB RAID using diskutil CS createLV and the -stdinpassphrase option to encrypt the drive, which works successfully.
- Boot into OSX install DVD or Recovery USB disk, and attempt to install onto this drive. It says "this drive needs to be unlocked first" so i enter the password, and it unlocks, and allows me to install this time, however, it still doesn't create a recovery partition, and it hangs at reboot because it tries to boot an encrypted drive without unlocking it. Stupid damn thing.

I CAN however install a minimal OS to disk0s2 (20GB), enable file vault, and then create my 710GB RAID as a secondary disk (not startup) and encrypt it, and add the pass to my keychain so it opens my DATA drive at boot - BUT - I need to relocate my home folder, and I have apps that rely on data being in certain places and i really didn't want long winded workarounds.


In short;


- I can install OSX onto a RAID 0
- I can encrypt my RAID 0
- OSX sees the RAID 0 as a bootable option but doesn't let me change the startup disk to it because it says it can't modify the helper partition.
- The Pre-Boot authentication screen comes up to unlock my small 20GB partition, but i can't find any way to trick it into unlocking the 710GB one, and pointing to boot from it.


i KNOW there's a way to do it. This must be a restriction, not a limitation. By virtue of the fact that the CS drivers are loaded pre-boot, and it sees my encrypted drive, i know there's a way it can be done. But i have wasted days and days on it now.

Even a point in the right direction (i.e. "you're dealing with compiled binaries here...forget it" or "there'll be a plist buried in a package somewhere ..") would be massively appreciated and i get the feeling you'd be the one guy with the know-how.

Thanks in advance for any help.

hmedia
Aug 19, 2013, 09:20 AM
This is the error i get (and the same error when i try change to this startup disk)


Creating recovery partition: finished
Error (async): Some information was unavailable during an internal lookup (-69808)
Cleaning up
"disk9" unmounted.
"disk9" ejected.
hdiutil: eject failed - No such file or directory
ucopyRPS: copying files for booter: Operation not supported by device
ucopyRPS: copying files for booter: Operation not supported by device
ucopyRPS: copying files for booter: Operation not supported by device
Failed to update helper partitions.

cammykool
Aug 22, 2013, 01:25 PM
http://img.tapatalk.com/d/13/08/23/u3a6e5un.jpg

It made me one.

mooninite
Oct 7, 2013, 11:51 PM
Dalton,

I ran your Recovery Editor App and selected the option to create a full offline installer but it didn't work.

I immediately got an error that said I have to have at least 12GB of free space to do it. Well, I have 300 gigs of free space.

Can you please help me out with this?

Thanks
moon

bibyfok
Oct 8, 2013, 06:02 AM
I don't get it: Will this create a fully usable Mavericks Recovery partition or a Lion one with only the utilities available?

My Goal with my GM installed via USB is to get a fully usable system with a Recovery HD for Mavericks that can be updated if Apple push an update.

Will your script achieve this?

Thanks for your work!

tywebb13
Oct 8, 2013, 06:27 AM
Dalton63841 wrote his stuff for DP1 because bootable usbs made for that system would not install a recovery partition.

But since then, apple made an executable file in DP4 called createinstallmedia which can be used to make a bootable usb which will install both mavericks DP4 or GM and a recovery partition at the same time.

To make the bootable USB of the GM, using this method:

Your 8 GB USB drive should be called Untitled and formatted as Mac OS Extended (Journaled). The installer should be called Install OS X Mavericks.app and should be in your Applications folder.

Run this in terminal and wait about 20 minutes:

sudo /Applications/Install\ OS\ X\ Mavericks.app/Contents/Resources/createinstallmedia --volume /Volumes/Untitled --applicationpath /Applications/Install\ OS\ X\ Mavericks.app --nointeraction

You should see something like this:

Erasing Disk: 0%... 10%... 20%... 100%...
Copying installer files to disk...
Copy complete.
Making disk bootable...
Copying boot files...
Copy complete.
Done.

You can then boot up from the USB by holding down the option key, then install the GM (and recovery partition) from the USB.

bibyfok
Oct 8, 2013, 08:26 AM
Dalton63841 wrote his stuff for DP1 because bootable usbs made for that system would not install a recovery partition.

But since then, apple made an executable file in DP4 called createinstallmedia which can be used to make a bootable usb which will install both mavericks DP4 or GM and a recovery partition at the same time.

To make the bootable USB of the GM, using this method:

Your 8 GB USB drive should be called Untitled and formatted as Mac OS Extended (Journaled). The installer should be called Install OS X Mavericks.app and should be in your Applications folder.

Run this in terminal and wait about 20 minutes:

sudo /Applications/Install\ OS\ X\ Mavericks.app/Contents/Resources/createinstallmedia --volume /Volumes/Untitled --applicationpath /Applications/Install\ OS\ X\ Mavericks.app --nointeraction

You should see something like this:

Erasing Disk: 0%... 10%... 20%... 100%...
Copying installer files to disk...
Copy complete.
Making disk bootable...
Copying boot files...
Copy complete.
Done.

You can then boot up from the USB by holding down the option key, then install the GM (and recovery partition) from the USB.
Thanks but my prob is that I don't have a recovery cause I didn't install the GM using this method...

mooninite
Oct 8, 2013, 07:06 PM
Dalton63841 wrote his stuff for DP1 because bootable usbs made for that system would not install a recovery partition.

But since then, apple made an executable file in DP4 called createinstallmedia which can be used to make a bootable usb which will install both mavericks DP4 or GM and a recovery partition at the same time.

To make the bootable USB of the GM, using this method:

Your 8 GB USB drive should be called Untitled and formatted as Mac OS Extended (Journaled). The installer should be called Install OS X Mavericks.app and should be in your Applications folder.

Run this in terminal and wait about 20 minutes:

sudo /Applications/Install\ OS\ X\ Mavericks.app/Contents/Resources/createinstallmedia --volume /Volumes/Untitled --applicationpath /Applications/Install\ OS\ X\ Mavericks.app --nointeraction

You should see something like this:

Erasing Disk: 0%... 10%... 20%... 100%...
Copying installer files to disk...
Copy complete.
Making disk bootable...
Copying boot files...
Copy complete.
Done.

You can then boot up from the USB by holding down the option key, then install the GM (and recovery partition) from the USB.

Thank you!!!

bax2003
Oct 18, 2013, 07:22 AM
http://img708.imageshack.us/img708/3037/2ucx.jpg

Success.

Dalton63841 - great work !

chevellian
Oct 23, 2013, 01:23 AM
great work Dalton63841 now I can use Find my Mac this helped a lot

mr666
Oct 23, 2013, 06:28 AM
Got this near the end in Terminal.....

->-[Local dmAsyncFinishedForDisk:mainError:detailError:dictionary:]: del callback: DADR=0x7fbe939005f0=disk0s3 errMain=-69736 errAux=0 infoDict=(null)
<--[Local dmAsyncFinishedForDisk:mainError:detailError:dictionary:]
Creating recovery partition: finished
Error (async): Couldn't attach disk image (-69736)
Cleaning up
"disk1" unmounted.
"disk1" ejected.
hdiutil: eject failed - No such file or directory

kildjean
Oct 23, 2013, 01:53 PM
The standard Apple textedit app. I set it to plain text in preferences and it works fine now :) Thanks for your help.

I highly recommend Text Wrangler. It's free and works great with text scripts like that.

Rockford18
Oct 26, 2013, 05:49 PM
great work Dalton63841 :)

rawdvm
Oct 29, 2013, 09:49 AM
Dalton,
Thanks for the great info. I used your original recovery.sh script & it worked perfectly. However, I now have 2 Recovery HD partitions. Before I ran recovery.sh, diskutil list displayed this (Not formatted correctly):

MacBook-Pro:~ raw$ diskutil list
/dev/disk0
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *1.0 TB disk0
1: EFI EFI 209.7 MB disk0s1
2: Apple_HFS Macintosh HD 998.7 GB disk0s2
3: Apple_Boot 650.0 MB disk0s3

*Note: The Apple_Boot partition has no Name
After running recovery.sh, diskutil list displayed this (Not formatted correctly):

MacBook-Pro:~ raw$ diskutil list
/dev/disk0
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *1.0 TB disk0
1: EFI EFI 209.7 MB disk0s1
2: Apple_HFS Macintosh HD 998.7 GB disk0s2
3: Apple_Boot Recovery HD 650.0 MB disk0s3
4: Apple_HFS Recovery HD 650.0 MB disk0s4

Do I need both disk0s3 & disk0s4? Or, can I delete one of them? If so, which one?
Thanks again!

Mjsais
Oct 31, 2013, 08:59 PM
I have a Lion recovery partition in a second drive (i keep my original lion drive intact), plus I have an over iMac running maverick that has a working recovery partition. Would cloning either of those partitions using CarbonCopy to my current Mavericks Startup drive (currently lacks recovery partition) work? All I want to do is have access to findmymac.

k.iUser
Nov 6, 2013, 11:59 AM
Hey all, I am new to the mac world. After i lost my recovery HD, I copied the script and saved the recovery.sh in the download folder then i typed the command in terminal. But I got no recovery partition until I re-downloaded Mavericks. The point is Does the command I copy pasted in terminal change anything in my Mac? and how to undo it or remove it or cancel its effect or write write another command to cancel it or restore terminal clean without any command?

Thanks for your help :)

aol
Feb 19, 2014, 12:40 PM
I was uncomfortable using the Lion recovery HD update on a late 2013 rMBP which, as of Mavericks 10.9.1, uses a custom OS install. Other tips on creating a bootable USB stick fail for this model at this time (presumably until 10.9.2 combines all the right kexts and so forth). Meanwhile, I'd followed another tip to create the bootable USB stick and install it needing to completely wipe the internal HD, but this process also removed the recovery partition. Needing to recreate it, I found this tip. What ended up working well for me was, rather than use a bootable USB stick, I used Internet Recovery.

If you boot while holding COMMAND+R while on a wifi or ethernet network, you can use Internet Recovery to reinstall Mavericks to a 2013 rMBP and this process will create the recovery partition. Here's a link to the Apple Support page: http://support.apple.com/kb/HT4718