Wednesday, September 30, 2015

Cloning Macs using Recovery Mode (or a USB Boot Drive) over a Network

Cloning Macs using Recovery Mode or a USB boot drive involves using Disk Utility to create an image of the drive. Where this gets complicated is when you need to do this over a network. Now let me stop here and say that in my testing, Clonezilla seems to be a faster option. However, you can do this with just the tools in OSX.

A prerequisite is that your file server must be configured to allow AFP or NFS protocols. You can't mount an SMB/Samba share in Recovery Mode because the Samba libraries aren't loaded. But AFP and NFS are core to OSX. A NAS is really great here because most NAS boxes allow you to enable many different file sharing protocols. Be aware that if you use NFS, your server might have a separate option to allow writing over NFS.

With that set up, boot to recovery mode or the USB boot drive, then go to the terminal. Enter the following command to set up a mount point:

mkdir /Volumes/Server

"Server" could be anything you want, it's just a name.

Now mount the network share:

For NFS:
mount -t nfs (ip address of the server):(share, such as /nfs/images or /images) /Volumes/Server
example: mount -t nfs 10.1.1.50:/nfs/images /Volumes/Server

For AFP:
mount -t afp afp://(username):(password)@(ip address of the server)(share, such as /images) /Volumes/Server
example: mount -t afp afp://username:password@10.1.1.50/images

Now quit Terminal and go into Disk Utility. Select the drive you want to create an image for, and click New Image. Find the down arrow next to the location drop down that gives you the Finder view. In some versions of OSX your Share will show here. Otherwise, drop down the "Look in" box and choose the computer. Then you will be able to select the share.

No comments: