How to Make a Mac Start Up Disk Image
David Miller April 2, 2007 Tutorials Mac
If you’re into preventative maintenance and creating backups like we are, you’ll need to create a Mac start up disk image. It’s an indispensable tool – one which could save your data and prevent a lot of headaches down the road. This how-to will show you how to make an image of one hard drive and store it on another drive. This image will be compressed and will make recovery fast and easy. You will need an additional volume or a mounted shared drive with enough space to create the image.
There are two ways to create these images: Using Disk Utility or using the
asr commands in the terminal. We’ll talk about the GUI disk utility version first, and then we’ll discuss the CLI and automated version. It is best to create an image from a drive that is not booted at the time. You can image an active boot drive, but try to stop or quit any services and applications to make sure there is minimal writing to the hard drive while the image is being created. Here’s how to make a Mac start up disk image using Disk Utility:
Launch the Disk Utility application. It’s located in Applications > Utilities.
From the File menu, select New > Disk Image from Folder.
Select the drive you want to image. Click the Image button.
Name your new disc image. From the Image Format menu, select Compressed.
Once the disc image is created, it will appear in the left pane in the Disk Utility application. Click once on the image. From the Images menu, select Scan image for Restore.
To restore a disc image back to a hard drive, click once on the image in the left pane. Select the Restore tab. Drag the image file from the left pane to the Source box. Drag the partition you want to restore to from the left pane to the Destination box. Check both the Erase Destination and Skip Checksum checkboxes. Click the Restore button.
Creating Disk Images with hdiutil and asr
Below, you’ll find a simple script that will create a ready-to-restore image. The disc image will be created with the date in the name. The only thing you will need to change is the part that says
extdisk – change this to the name of the second partition or share you will save the image to.
hdiutil create -srcfolder / /Volumes/extdisk/server_name_here.dmg
asr -imagescan /Volumes/extdisk/server_name_here.dmg
mv /Volumes/extdisk/backup.dmg /Volumes/extdisk/server_name_here`date +%Y-%m-%d’.dmg
You can use cron to make full disk image backups. For example, you can create a cron job that images Macintosh HD to another drive called Backup Images every Sunday at 3 AM. Edit cron using the following command in the terminal:
sudo pico /etc/crontab
Add this line, but substitute
/path_to_image_script with the real path to the shell script from above:
00 3 * * 7 root sh /path_to_image_script
Press Control+O to save. Press the return key. Press Control+X to exit the pico editor.
We have a few servers running either Mac OS 10.4 client or 10.4 server. Using the above method is how we backup the system partition. We only use the system partition for boot and server settings, and this makes the partition quite small and fast to image. The boot partition on our servers never grows larger than 3GB, because there are no additional files taking up space. Besides the weekly image that is automatically created by cron and a script, we also create an image right before applying any patches or updates. This process is so fast that we can restore a system image in less than ten minutes after a cold boot off an external startup disk. We have successfully used this on a few occasions, when an Apple update broke something.
Subscribe to our email newsletter
Sign up and get Macinstruct's tutorials delivered to your inbox. No spam, promise!