Wednesday, October 26, 2011

Imaging a Mac Computer with Bootcamp using Clonezilla

Creating an image for a Macintosh computer that includes both a Macintosh partition and a Bootcamp partition for Windows is complicated at best with the release of Lion and the demise of the old standby: Winclone.  Since twocanoes stopped developing Winclone, I've been looking for another method to create an image that will be, well, reliable.  While it is possible to use Winclone 2.3, it's not supported and it's very buggy.  And that's just the Windows partition, not the entire drive, and I want the entire drive.  So, based on some suggestions I got with previous posts and lots of online research, I decided to give Clonezilla a try.  
Clonezilla is akin to Norton Ghost, as it grabs a complete image of a hard drive, partitions and all, and will restore it.  Unlike other ghosting software though, Clonezilla supports HFS+, the Mac OS X Extended filesystem, as provided by the core utility, Partclone.  That means it can image both a standard NTFS partition with the Mac partition.  It sounds great, assuming it would work, so I thought I would test it out and see if it were a viable option for mass deployment of Mac with Bootcamp.  Going through the motions, I was impressed with the repository settings that were available.  Much like Acronis, the Clonezilla Live CD boots up into it's own OS platform.  With Clonezilla, though, it's Linux, and it shows.  There are a lot of options to select, and it doesn't have a very friendly UI.  But, really, UI is secondary to performance in my case (because I'm used to a command line UI that it presents), so that wasn't much of a consideration.  
The first neat experience I saw with Clonezilla was it's flexibility.  You can select just about every language and keyboard setup that Linux supports, which makes it handy to deploy.  Unfortunely, you need to do it every single time you boot.  Perhaps there is a way to build a custom CD, or perhaps settings would be kept with the USB boot, but I didn't see it off hand.  The other flexibility option that impressed me was the method of finding your repository.  It's actually very easy to find a connection method that will work for you.  I really liked the idea of having an SSH repository, making images easy to deploy to and from a remote server if necessary.  The only thing to change performance at that point would be the speed of your connection.  Internally, if you are on a Gigibit switched network, it will come as close to that speed as possible.
Then we get to the image tool.  I only used the beginner options, which probably has a lot of settings that are defaulted, but I wanted to make this as easy as possible.  That, and after spending a good 5 minutes on choosing my keyboard and setting up the repository information, I wasn't much interested in spending more time configuring when default settings should work just fine.  Apparently you can back up just partitions, or the entire disk.  I chose the entire disk because that was what I am looking for, but I kept the partition idea in mind for future projects (assuming it worked, of course). 
Below are the steps I took while creating an image, and deploying that image to a computer. 
Steps: Booting from the CD
  1. Boot to Clonezilla Live CD
  2. Select boot option for Clonezilla.  The default works great at 800 x 600.
  3. Select Language (default is US English)
  4. If you are not using a USB keyboard, select the keymap from the arch list, otherwise continue with "Don't tuch keymap"
    1. If you selected to select the keymap, select your keyboard type (default is most common, QWERTY)
    2. Select the Keyboard layout (starts with Brazillian)
    3. Select your keyboard variant, either Apple USB or Standard
Now you are ready to set up the repository for your image. 
  1. Select Start_Clonezilla
  2. Select Device-Image, as you would want to create an image from a device.  
  3. Select your repository method. 
    1. If you have a local device, like a USB drive or internal drive, you can use Local_dev
    2. If you have an SSH server you want to publish the image to, use ssh_server
    3. If you have an SMB server (Samba, or Windows server), this will be best for you
    4. If you have an NFS server (common in UNIX networks), nsf_server will work for you
  4. Depending on what you selected before, you need to verify your network connection (or not if it's local).  I selected the Ethernet network (for speed), and then used DHCP.  This will probably be the most common setup for everyone. 
  5. Since I chose SSH, I entered in my SSH server IP (can use DNS name too), confirmed the port number, and entered in the user ID for the login.
  6. Then enter in the absolute path for the repository.  I put it on my Desktop, so I put in  /Users/userid/Desktop.
  7. It will then ask you for authentication information to mount the connection.  Follow directions (hopefully you already know all this information).
You are now ready to start the image.
  1. Select Beginner mode.  It's easy to use, and you don't have to mess with the expert stuff.  If you already know what you are doing, then expert would be great.  But then, if you already know what you are doing, why are you reading this?
  2. Select Action
    1. savedisk:  Will image the entire hard drive as an image, with all partitions.  This is what I chose for creating the image of my Mac with the bootcamp drive.
    2. saveparts:  Will image partitions of the drive for restoration.  If you don't need everything, just a single partition (like your Bootcamp partition), this will back up just the partition.  Obviously this will save you time over the entire disk if you have more than one partition.
    3. restoredisk: Will restore the drive from an image.
    4. restoreparts: Will restore individual partitions.
    5. recovery-iso-zip: Will create a recovery disk of Clonezilla Live for either CD or as a zip for a bootable USB drive.
    6. chk-img-restorable:  will check to see if an image is restorable or not.  This is an option you can turn on while creating the image, so it will be checked after the image has been created.
  3. Input the name you want for your image.
  4. Select the disk or partition you want to back up
  5. Choose to either check the image as it's saved, or skip the check.  I recommend letting it check the image (increased my image time by 15 minutes, but well worth piece of mind)
  6. Press enter to continue. 
At this point, you are all set!  Clonezilla will create an image of each partition in the hard drive (or just the one you selected), and notify you how long for each partition it will take to back up and restore.  It took, for my two images, a total of about an hour and a half to back up and restore the image using SSH and the options I selected above on a Gigabit network.  
To restore, it's much the same process.  Boot to the drive, select your language, etc., and set up your device repository. To restore, you would use these steps:
  1. Select Beginner mode.
  2. Select restoredisk (or restoreparts, if you backed up a partition)
  3. Select your archive as displayed
  4. Select the drive you wish to image.
  5. Press Enter to continue. 
  6. It will then ask you if you want your hard drive partitions overwritten, type Y to continue.  It will then verify that you are wanting to replace your hard drive partitions, type y.
  7. The system will not restore.
The restoration process is done partition by partition, with each partition taking less time to reimage than it took to create the image in the first place.  And the results?  Success!  The restore booted without a problem, with all settings in tact.  That is better than could be said for the previous imaging tools I have tried.  
So it looks like I have found a useful cloning tool for imaging my Macintosh computer lab, and pretty much any lab for that matter.  


Anonymous said...

I tried setting up a windows 7 just the way I want it on every mac that wants windows os via bootcamp and then using clonezilla just to copy that partition. Then when I try to restore it on other macs, I get system restore error, with system restore not fixing anything, just looping me back and forth. Any ideas?

Jeremy Robb said...

When you restore your Windows partition, is it on a computer that is the same make/model as the computer you built the image? It sounds like the Mac is different enough for Windows to have issues with the image.

Anonymous said...

I get an error message. "This disk contains mismatched GPT ad MBR partition: /dev/sda ...."

Then it dumps me out. Any ideas?

Thank you!!!

Jeremy Robb said...

Hmm. Sounds like a similar issue: the GPT and MBR partition doesn't match the image. If you get this straight from imaging the computer, it could be a problem with the drive. If that isn't the case, you may want to check out the Clonezilla website and see what the forums say.