Disk with 2 partitioned: how to create the Recovery HD with Casper Imaging?

Apfelpom
New Contributor III

Hi all,

I have a couple of 10.7 clients with two partitions on the internal disk. "Macintosh HD" with OS X 10.7.3 and a "Users-Volume" Partition with the user home folders.

I can't use Casper Imaging out of the box to partition the disk, because it has already two partitions and Casper doesn't seems to change anything.

For sure, I could walk from machine to machine and use the Carbon Copy Cloner feature to create the Recovery HD with an external disk. But I would love to find a way using Casper Imaging/Netboot.

Thanks,

Yann

2 ACCEPTED SOLUTIONS

Apfelpom
New Contributor III

Brunerd's script is amazing. It's first built a new DMG from the Lion Installer and HD Recovery update from Apple. In this new DMG there's a .command script. Ran this and it creates the partition with the Recovery HD on the fly.

Before:

C07CX0M7DD6K:~ localadmin$ diskutil list
/dev/disk0
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *500.1 GB   disk0
   1:                        EFI                         209.7 MB   disk0s1
   2:                  Apple_HFS Macintosh HD            250.1 GB   disk0s2
   3:                  Apple_HFS Users-Volume            249.6 GB   disk0s3

And after:

C07CX0M7DD6K:~ localadmin$ diskutil list
/dev/disk0
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *500.1 GB   disk0
   1:                        EFI                         209.7 MB   disk0s1
   2:                  Apple_HFS Macintosh HD            249.5 GB   disk0s2
   3:                 Apple_Boot Recovery HD             650.0 MB   disk0s5
   4:                  Apple_HFS Users-Volume            249.6 GB   disk0s3

BTW: the Recovery HD partition does not need to be disk0s3 (I thought it was mandatory). In my case the disk0s3 was already matched with the "Users-Volume".

So I'm thinking about a way to automate this, guess I will copy the DMG to a temp folder, open it and run the command line.

Thanks,

Yann

View solution in original post

Apfelpom
New Contributor III

Basically I build the updated "RecoveryHDUpdater_11D50.dmg" the way brunerd described here http://www.brunerd.com/blog/2012/03/21/update-create-lion-recoveryhd-partition-quickly-without-reins..., deploy the DMG to a temp folder and run this script (based on the .command file located in RecoveryHDUpdater_11D50.dmg but without the great interactivity -- don't need it now):

#!/bin/bash
MYPATH="/Volumes/Recovery HD Updater 10.7.3 11D50"
DEST="/"
DMG="/private/tmp/Casper/RecoveryHDUpdater_11D50.dmg"

#mount the dmg
hdiutil attach "$DMG"

#create Recovery partition
sudo "$MYPATH"/bin/dmtest ensureRecoveryPartition "$DEST" "$MYPATH"/etc/BaseSystem.dmg 0 0 "$MYPATH"/etc/BaseSystem.chunklist

#wait before unmounting
sleep 5

#unmount the dmg
hdiutil detach "$MYPATH"

hdiutil before...:

Office-SA-Mac mini:tmp localadmin$ diskutil list
/dev/disk0
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *500.1 GB   disk0
   1:                        EFI                         209.7 MB   disk0s1
   2:                  Apple_HFS Macintosh HD            249.9 GB   disk0s2
   3:                  Apple_HFS Users-Volume            249.7 GB   disk0s3

...and after:

Office-SA-Mac mini:tmp localadmin$ diskutil list
/dev/disk0
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *500.1 GB   disk0
   1:                        EFI                         209.7 MB   disk0s1
   2:                  Apple_HFS Macintosh HD            249.4 GB   disk0s2
   3:                 Apple_Boot Recovery HD             650.0 MB   disk0s5
   4:                  Apple_HFS Users-Volume            249.7 GB   disk0s3

Note that you can run the script more than once, it will not create a new partition. The current Users don't have to be logged out, so I think it could be deploy the every 15.

Thank's

Yann

View solution in original post

12 REPLIES 12

rob_potvin
Contributor III
Contributor III

Bonjour

I found this, you could use his instruction to make a script

http://www.dmitry-dulepov.com/2011/09/how-to-create-mac-os-x-lion-recovery.html

Hope that helps

Salut

rob_potvin
Contributor III
Contributor III

You can also pull off the BaseSytstem.dmg (Hidden on the Lion DMG)

http://hints.macworld.com/article.php?story=20110717190509986

Then resize the Macintosh HD add a 1GB drive then image that across, you don't even have to netboot you could do this via a policy.

Once you have it created and everything is imaged, you would have to run this script from the jamf KB (https://jamfnation.jamfsoftware.com/article.html?id=173)

#!/bin/sh
/usr/sbin/diskutil unmount /dev/disk0s3
/usr/sbin/asr adjust -target /dev/disk0s3 -settype Apple_Boot

Let me know if you want some help on this one, would be a good to know and have.

bentoms
Release Candidate Programs Tester

How were these macs imaged? Are you sure they do not have a recovery partition?

I ask as I image my macs from a 10.7 compiled OS then partition adding a users partition.

This means I have actually 3 partitions in the following order:

1) OS
2) Recovery
3) Users

which, works! For booting to recovery partition anyhow, I've not tried FileVault.

donmontalvo
Esteemed Contributor III

@Rob Thanks for the tip. I'm not sure how I blew away my Recovery HD partition, but I was able to restore it in 15 minutes using your procedure.

I'm wondering if the Recovery HD partition ever gets upgraded when the OS is upgraded? I would hope Apple covered that base. If not, I'm hoping we can automate upgrade via Casper Policy. This really looks good. Thanks!

Don

--
https://donmontalvo.com

rob_potvin
Contributor III
Contributor III

Yeah the recovery hd does get updated. There was a recovery HD update that came with 10.7.2.

I also think that apple can update it with an is update like 10.7.3 combo.

rob_potvin
Contributor III
Contributor III

@donmontalvo mind sharing what you did? Sounds pretty cool. Might evn help a few folk.

Apfelpom
New Contributor III

@Ben: I actually have only 2 partitions on the drives:

#:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *250.1 GB   disk0
   1:                        EFI                         209.7 MB   disk0s1
   2:                  Apple_HFS Macintosh HD            124.9 GB   disk0s2
   3:                  Apple_HFS Users-Volume            124.7 GB   disk0s3

I used Casper imaging to deploy a pre-compiled 10.7.3 Macintosh HD, so the Recovery HD partition was not built.

@Rob: Nice tricks, but how should I create the Recovery HD partition? Casper Imaging won't partition a drive with already more than 1 Partition I think.

I found this article/script which seems to partition the disk on the fly and add the recovery HD -- will give a try and report.
http://www.brunerd.com/blog/2012/03/21/update-create-lion-recoveryhd-partition-quickly-without-reins...

Thanks,

Yann

Apfelpom
New Contributor III

Brunerd's script is amazing. It's first built a new DMG from the Lion Installer and HD Recovery update from Apple. In this new DMG there's a .command script. Ran this and it creates the partition with the Recovery HD on the fly.

Before:

C07CX0M7DD6K:~ localadmin$ diskutil list
/dev/disk0
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *500.1 GB   disk0
   1:                        EFI                         209.7 MB   disk0s1
   2:                  Apple_HFS Macintosh HD            250.1 GB   disk0s2
   3:                  Apple_HFS Users-Volume            249.6 GB   disk0s3

And after:

C07CX0M7DD6K:~ localadmin$ diskutil list
/dev/disk0
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *500.1 GB   disk0
   1:                        EFI                         209.7 MB   disk0s1
   2:                  Apple_HFS Macintosh HD            249.5 GB   disk0s2
   3:                 Apple_Boot Recovery HD             650.0 MB   disk0s5
   4:                  Apple_HFS Users-Volume            249.6 GB   disk0s3

BTW: the Recovery HD partition does not need to be disk0s3 (I thought it was mandatory). In my case the disk0s3 was already matched with the "Users-Volume".

So I'm thinking about a way to automate this, guess I will copy the DMG to a temp folder, open it and run the command line.

Thanks,

Yann

Apfelpom
New Contributor III

Hi Don,

I'm wondering if the Recovery HD partition ever gets upgraded when the OS is upgraded? I would hope Apple covered that base. If not, I'm hoping we can automate upgrade via Casper Policy.

I think you would be able to update/re-image the recovery HD the Brunerd's way :-)

Thanks, Yann

rob_potvin
Contributor III
Contributor III

Awesome! Share it...

Apfelpom
New Contributor III

Basically I build the updated "RecoveryHDUpdater_11D50.dmg" the way brunerd described here http://www.brunerd.com/blog/2012/03/21/update-create-lion-recoveryhd-partition-quickly-without-reins..., deploy the DMG to a temp folder and run this script (based on the .command file located in RecoveryHDUpdater_11D50.dmg but without the great interactivity -- don't need it now):

#!/bin/bash
MYPATH="/Volumes/Recovery HD Updater 10.7.3 11D50"
DEST="/"
DMG="/private/tmp/Casper/RecoveryHDUpdater_11D50.dmg"

#mount the dmg
hdiutil attach "$DMG"

#create Recovery partition
sudo "$MYPATH"/bin/dmtest ensureRecoveryPartition "$DEST" "$MYPATH"/etc/BaseSystem.dmg 0 0 "$MYPATH"/etc/BaseSystem.chunklist

#wait before unmounting
sleep 5

#unmount the dmg
hdiutil detach "$MYPATH"

hdiutil before...:

Office-SA-Mac mini:tmp localadmin$ diskutil list
/dev/disk0
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *500.1 GB   disk0
   1:                        EFI                         209.7 MB   disk0s1
   2:                  Apple_HFS Macintosh HD            249.9 GB   disk0s2
   3:                  Apple_HFS Users-Volume            249.7 GB   disk0s3

...and after:

Office-SA-Mac mini:tmp localadmin$ diskutil list
/dev/disk0
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *500.1 GB   disk0
   1:                        EFI                         209.7 MB   disk0s1
   2:                  Apple_HFS Macintosh HD            249.4 GB   disk0s2
   3:                 Apple_Boot Recovery HD             650.0 MB   disk0s5
   4:                  Apple_HFS Users-Volume            249.7 GB   disk0s3

Note that you can run the script more than once, it will not create a new partition. The current Users don't have to be logged out, so I think it could be deploy the every 15.

Thank's

Yann

rob_potvin
Contributor III
Contributor III

Awesome!! Thanks for sharing mate!