Thursday, September 17, 2015

Make a Clonezilla Live USB Stick for Mac

1/7/16 update: The easier way is to rewrite the partition table as GPT. If you use the Apple Disk Utility, there is an option to write a "GUID Partition Table" which is what you want to do when you re-partition the drive. Then format the partition as MSDOS(FAT32). However if you create the drive this way you won't be able to read it under Windows. So if you are going to use it with PC and Mac then use the following method instead.

On the Windows side, go to a command prompt and do the following:
Type Diskpart, press Enter
Type List Disk , press Enter
Type Select Disk # (where # is the number your drive shows up as), press Enter
Type Clean, press Enter
Type Convert GPT, press Enter
Type Exit, press Enter.
Then go into Disk Management and format the drive with FAT32.

Once you've partitioned and formatted, download the Clonezilla alternative stable zip and unzip to the drive and you are done.

This way also allows you to modify the boot menu, which for an EFI boot is located at EFI\boot\grub.cfg.

EDIT 3/21/17: If you are interested in a custom Mac boot icon and label, see this post.

***Original post***

I spent days trying to make a bootable USB of Clonezilla to use with Macs in my organization. I tried a number of USB makers as well as trying to put it together myself. Finally, I found the solution.

1. Download the alternative-stable AMD64 Clonezilla ISO.
2. Follow the instructions at http://www.ubuntu.com/download/desktop/create-a-usb-stick-on-mac-osx, referencing your Clonezilla ISO instead.

I have reproduced the steps here.

1. Open the Terminal (in /Applications/Utilities/ or query Terminal in Spotlight).

2. Convert the .iso file to .img using the convert option of hdiutil e.g.,
hdiutil convert -format UDRW -o ~/path/to/isoname.img ~/path/to/isoname.iso
(Where "isoname" is the name of the downloaded Clonezilla ISO)
Note: OS X tends to put the .dmg ending on the output file automatically.

3. Run
diskutil list
to get the current list of devices.

4. Insert your flash media.

5. Run
diskutil list
again and determine the device node assigned to your flash media (e.g. /dev/disk2).

6. Run
diskutil unmountDisk /dev/diskN
(replace N with the disk number from the last command; in the previous example, N would be 2).

7. Execute
sudo dd if=/path/to/downloaded.img of=/dev/rdiskN bs=1m
(replace /path/to/downloaded.img with the path where the image file is located; for example, ./ubuntu.img or ./ubuntu.dmg).

If you see the error dd: Invalid number '1m', you are using GNU dd. Use the same command but replace bs=1m with bs=1M
If you see the error dd: /dev/diskN: Resource busy, make sure the disk is not in use. Start the 'Disk Utility.app' and unmount (don't eject) the drive

8. Run
diskutil eject /dev/diskN
and remove your flash media when the command completes.

9. Restart your Mac and press alt/option key while the Mac is restarting to choose the USB stick.

If your external USB drive does not show up in Clonezilla, instead of choosing the local dev option, choose shell. Enter the following command to list your drives:
sudo fdisk -l
Your drive will be /dev/sdx, and the partition will be /dev/sdxn, such as /dev/sdb1.
Mount the partition to partimag with the following command:
mount -t auto /dev/sdxn /home/partimag
Then the following command to get back to Clonezilla:
exit

3 comments:

brian said...

This was fantastic...thank you!

M Jones said...

Thanks for sharing this guide. Worked perfectly. Made a Clonezilla bootable USB stick in order to clone an iMac 7.1 to a larger drive.

Tiraj Adikari said...

Thanks. Was useful