Contribute  :  Advanced Search  :  Directory  :  Forum  :  FAQ's  :  My Downloads  :  Links  :  Polls  
AFP548 Changing the world one server at a time.
Welcome to AFP548
Thursday, September 02 2010 @ 07:47 pm MDT
   

Autoinstall by DVD

ArticlesAuto Magic System Deployments Without a Network

Somewhere between NetInstall and touching every machine with a set of DVDs lies the ability to do automated installs with almost no infrastructure. This article will walk you through setting up a deployment methodology which any monkey could use.



I've got a few Xserve Cluster Nodes in my lab that I do a lot of my experimentation on. They're great machines. Good bang for the buck, but... They are a total bugger to reimage. Or at least they used to be.

None of the cluster nodes have video cards. They're filled up with Fibre Channel HBAs, extra gigabit ports and internal RAID cards. There's no free ports on the KVM, even if I did have video cards in them. Normally this isn't an issue at all, except for when I hose one of them up real good and need to nuke and pave the OS back into something that will boot.

I first did this by booting them in target disk mode and installing using the DVD drive in a laptop or other machine. That works, but you have to make sure that the hardware monitoring is enabled in /etc/hostconfig and other concerns since you didn't actually install the system on Xserve hardware.

Another method I had working for a while was a NetRestore server and I'd NetBoot the afflicted machine and then image it. However, with the half-dozen images I use, this also got to be a pain trying to set the default image all the time. Plus I ended up always commandering the NetRestore box and hosing that too.

Finally after spending way too much time futzing with cables and stacks of unlabeled Apple Drive Modules, I've started using an automated installation method that even a monkey like me can use without having to think.

If you caught my WWDC session in 2005 on scripting, I mentioned this a bit there. And yes I know I should have posted this a long time ago...

Overview

This process involves the use of a boot device. In this case a firewire harddrive but it could easily be a bootable DVD or NetBoot image or even an big honkin' USB thumb drive on a newer Intel machine.

This device has a basic OS X Server install on it, but modified with a startup item or /etc/rc.cdrom that will prep the target machine for taking a new image. Then image the target machine with one of a number of disk images on the boot device. Then the startup device will be set to the target machine and rebooted.

All of the images have a self-destructing startup item that will look in either a local configuration file, or on external storage for what to set the IP, hostname, serial number and other settings to force on the system.

Finally a last reboot of the target system and you're off to the races with a brand spanking new system.

The real genius of this setup is that it actually requires no user interaction whatsoever. I use the front panel mode on the Xserve to get it to boot off of anything but the internal drive I keep a default config file in the image, which can be overridden by an external file.

No keyboard, no monitor, and you only need two fingers to get into front panel mode! What could be easier?

Boot Device Setup

First off you need something to boot the target system from. The quickest way to do this is to image an installer DVD. I usually use an OS X Server installer DVD but you should be able to use a client one if you'd like.

Make a read/write disk image of the DVD. Mount it and remove the contents of /System/Library/Installation, making sure to leave the Installation folder itself. This should give you a very minimal boot system of just a few hundred MB. This means you can image this back to a DVD and still have 4 GB or more of storage for disk images. If you're using a firewire drive, space probably isn't an issue, so this isn't as big of a deal.

Now we need to slip our script into this image. To keep things clean I'll create a directory to stash all of my customizations in. In this case we'll use /opt/afp548. All of the scripts and disk images are going to go in there.

The first script that we're going to use, AMInstall.bash which you can find in the script package for this in our downloads section, is the one that will format/parition the drive and blast the image down onto the new volume.

Apple makes it easy for us to call a custom pre-install script from the /etc/rc.cdrom script that is used to begin the boot process, as it has a line in there to call an /etc/rc.cdrom.preWS script before the installation is actually started. Depending on my mood I sometimes create an alias between that location and my install script. Other times I edit the rc.cdrom file to call my script instead of rc.cdrom.preWS. I usually prefer the latter, but it's all a matter of style. Sometimes you feel like a nut...

So edit these lines in /etc/rc.cdrom on the DVD image you're working with to call your script.
#
# Source a pre-WindowServer script if present
# (This is inaccurate, the WindowServer is now started on demand.)
#
if [ -x /etc/rc.cdrom.preWS ]; then
	/etc/rc.cdrom.preWS
fi
When you're done it'll look something like this (make sure to keep the humorous comment of course):
#
# Source a pre-WindowServer script if present
# (This is inaccurate, the WindowServer is now started on demand.)
#
if [ -x /opt/afp548/AMInstall.bash ]; then
	/opt/afp548/AMInstall.bash
fi
Now for what the AMInstall script does.

First of all it will get a list of all mounted devices, minus the boot device. It will make a RAID 1 set from bays 1 and 2. Then it will blast your disk image onto it. It will then make the newly imaged drive your boot system. Finally it will log what it did.

Your disk image should have the AMConf.bash file setup as a startup/launchd item. If done correctly this should ensure that upon reboot this script will run and look for a pre-installed config file or a volume called AMSData with a config file on it. The AMData volume can easily be a USB thumb drive or another firewire drive. The script could also easily be altered to pull this information from a web server or other network service.

The script will use the config file to read in the IP address, hostname, and other setup information for this system based upon it's hardware serial number. When it's finished it will delete itself and reboot the system.

You should now have a fully configured and useable server system without having to be present for the install.

Note that the scripts included will probably need a bit of work on your part to customize for your environment. However they should be decently commented enough to allow you to do that. You can get them from our downloads section.

(That bit about the internal RAID on the cluster node was a joke, bonus points if you caught it)

Story Options

Advertising

Autoinstall by DVD | 9 comments | Create New Account
The following comments are owned by whomever posted them. This site is not responsible for what they say.
Autoinstall by DVD
Authored by: Macleod on Monday, March 12 2007 @ 05:59 pm MDT
Why go to the trouble to change the rc.cdrom when its already set to source a non-existant rc.local file? Put the contents of your script into a file named rc.local and drop it into /etc, or use rc.local to call your script stored elsewhere. Either way, you don't have to modify the rc.cdrom at all.

--DH
Autoinstall by DVD
Authored by: Dean_Shavit on Tuesday, March 20 2007 @ 08:42 am MDT
Neat!...but there's a *much* easier (and more flexible) way to re-image a cluster node or headless server. Recent versions of Netrestore (Bombich.com) have an ARD client built into the Netinstall set and therefore "automagically" show up in the ARD scanner with the computer name based on the numeric IP when netbooted (dashes, not dots). With a nice post-restore action, you're all good, and it'll be much faster than a DVD to boot (pun intended). If you don't have a server for NetBoot, just configure your 'book to be a NetBoot server...

Dean Shavit
author of Mac HelpMate
http://www.macworkshops.com/machelpmate
Autoinstall by DVD
Authored by: Anonymous on Wednesday, April 04 2007 @ 05:41 pm MDT
The script does not work out of the box. Imaged a 10.4.8 UB Server DVD and it did not have the command "cut". I am now burning a new DVD with the cut binary where it belongs in /usr/bin. Hopefully this is the only binary that is missing.

Thanks for a great write up!

Hopefully it will work for me.
Autoinstall by DVD
Authored by: priglmeier on Tuesday, October 02 2007 @ 02:19 pm MDT
Thanks for the interesting article. No more jokes about clustering though, ok?! I want clustering in Mac OS X server. Damn
Autoinstall by DVD
Authored by: Jeffrey Madson on Friday, May 01 2009 @ 03:37 pm MDT
I realize this is a older post but I'm very much in need of some help. I need to create a minimal boot system as is described in this post but I would like to used a plain OS Install disk and Leopard. I tried following this post but the Installation folder wasn't were indicated and I keep getting a -61 error when I try to delete anything in it. Any help at all on this would be greatly appreciated!