Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Use diskutil and installer on the Mac OS X Install CD UNIX
An earlier hint showed us how to use such command line tools as diskutil and installer while in single user mode under Mac OS X 10.3. I wanted to do the same thing, but while starting up from the Mac OS X Install CD. Since the CD itself is write protected, there are couple of additional steps needed to make this work. The good thing is that all the steps are actually right there in a file called rc.cdrom, located in /etc. The only thing we have to make sure is that the script rc.cdrom ends before it invokes the GUI and starts the Installer application.

We still have the problem that the CD is write-protected, so we cannot just edit the rc.cdrom file and run it. Apart from that, there is no text editing tool (like vi or pico) installed on the CD. But luckily there is a tool named head. With head, you can print a self-defined count of lines back to the shell from the file you specify.

The most important thing is to find the line you would want the rc.cdrom script to stop at. I guess that would be right before the /System/Installation/CDIS/splash command is defined. In my case, that was line 168. Adapt the line number to the rc.cdrom script you find on your Install CD in /etc/. So finally here's the walkthru:
  1. Insert the Mac OS X Install CD and reboot / turn on your Mac
  2. Press the C key and wait for the Apple logo to appear
  3. Immediately press and hold cmd - s until the Apple logo dissappears
  4. Wait for the command line prompt
  5. Execute the command: head -n 168 /etc/rc.cdrom | sh
  6. Press the return key to get your prompt back after the script has finished
Now you can use diskutil or installer right from the CD. Especially when you install the OS, this is a real time saver.
    •    
  • Currently 1.50 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (2 votes cast)
 
[14,283 views]  

Use diskutil and installer on the Mac OS X Install CD | 12 comments | Create New Account
Click here to return to the 'Use diskutil and installer on the Mac OS X Install CD' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Use diskutil and installer on the Mac OS X Install CD
Authored by: diamondsw on Nov 09, '04 10:31:22AM

Okay, I admit to being royally confused - why on earth would I do this? Disk Utility and Installer.app are both readily available on the CD, and if you're exiting the command line at the end of the hint, what good does this do you?

I'm sure there's something I'm missing here.



[ Reply to This | # ]
Use diskutil and installer on the Mac OS X Install CD
Authored by: macevangelist on Nov 10, '04 11:47:31AM

For me it's all about saving time. No wait until the GUI loads, no clicks thru agreements or the target disk selection. You just issue three commands and that's it.

1. head -n 168 /etc/rc.cdrom | sh
2. installer -pkg /System/Installation/Packages/OSInstall.mpkg -target /Volumes/HardDisk
3. reboot

Additionally you have all hard drives mounted as read/write in /Volumes thus enabling you to work with the filesystem. This is a feature that every Install CD had in the pre-Mac OS X days.



[ Reply to This | # ]
Use diskutil and installer on the Mac OS X Install CD
Authored by: VEGx on Nov 09, '04 11:04:57AM

I wonder if he means command line applications...



[ Reply to This | # ]
Use diskutil and installer on the Mac OS X Install CD
Authored by: Netzach on Nov 09, '04 02:59:08PM
Let's give it a BIG "why?".

---
//Intelligence has it's boundaries, but stupidity is unlimited.

[ Reply to This | # ]

actually....
Authored by: macubergeek on Nov 09, '04 05:06:38PM

If you really wanted to be slick you'd copy the install disk to a share on a drive and boot the mac and install off the nfs or samba share.



[ Reply to This | # ]
Use diskutil and installer on the Mac OS X Install CD
Authored by: risc on Nov 09, '04 07:01:16PM

Uhh, neat. But I'd really be impressed if I could:
1) Boot to CD
2) Connect to a network drive
3) Use Disk Utility to restore from a img or dmg on a network drive

(It's step 2 to I can't figure out while booted to CD)

---
RISC



[ Reply to This | # ]
Use diskutil and installer on the Mac OS X Install CD
Authored by: seann on Nov 09, '04 11:11:39PM

easy

rename terminal.app to startupdisk.app

make sure it runs, you'll have to change a few things.

copy that to the cd.

blah blah

now when you open up startupdisk
it opens terminal

do an asr -source http://file/to.dmg -target /dev/disks0

i'll see if I can post that script I have to do all the auto partitioning



[ Reply to This | # ]
Use diskutil and installer on the Mac OS X Install CD
Authored by: pstadelmann on Nov 10, '04 03:40:35AM

Put the .dmg file on a web server, and enter the URL in the "Source" field of the "Restore" panel in Disk Utility.



[ Reply to This | # ]
Use diskutil and installer on the Mac OS X Install CD
Authored by: Mendenhall on Nov 10, '04 01:36:39PM

Try
man mount_afp
mount_afp mounts afp volumes from the command line. It will probably do what you want. It is quite useful for remote administration. It also makes it possible to mount volumes somewhere other than in /Volumes, so you can mount a volume over a private directory.



[ Reply to This | # ]
Use diskutil and installer on the Mac OS X Install CD
Authored by: macevangelist on Nov 10, '04 02:01:36PM

The problem is that the Install CD does not have the necessary frameworks installed to use the mount_afp tool.

The frameworks are in the installer packages on the CD but there's no gunzip to retrieve the pax file, installer only extracts packages according to the .bom file and there's no tool to edit the .bom file. You could mount an additional RAM disk and install the BSD.pkg package on it to get gunzip. Then you'll also need around 450MB free on a RAM disk to extract the pax file from the Essentials.pkg package in order to finally get the frameworks we're missing for mount_afp.

As far as I see it there's really no easy way to enable afp drive mounting on an 'out-of-the-box' Mac OS X Install CD but there's always the possibility to create a custom Mac OS X Install CD.



[ Reply to This | # ]
earlier hint?
Authored by: hayne on Nov 10, '04 10:44:36AM

Do you have a link to the "earlier hint [that] showed us how to use such command line tools as diskutil and installer while in single user mode" ?
I couldn't find it doing a search for: diskutil



[ Reply to This | # ]
earlier hint?
Authored by: macevangelist on Nov 10, '04 11:02:36AM

Guess what I couldn't find that hint either, so I guess I picked it up somewhere else. Here are the steps needed to use command line tools like diskutil and installer in the single user mode when booted from a hard drive.

1. Boot into single user mode by pressing cmd - S at restart.
2. Mount the disk in read and write mode by executing the command:
mount -uw /

3. Start bootstrap daemons by executing the command:
/usr/libexec/register_mach_bootstrap_servers /etc/mach_init.d

4. Start DiskArb by executing the command:
SystemStarter start Disks



[ Reply to This | # ]