However, the guy who asked this couldn't do that, because his computer had only one CPU core, and you are not able to install ESXi 5 on a system with less than two CPU cores. Actually the USB key drive that he was using to boot this computer had been created by installing ESXi on another computer (with multiple CPU cores) and was then plugged into the one-core-machine (which is a smart way to overcome this limitation).
There is at least one other reason why you would want a clone of an existing ESXi installation rather than installing a new one: If you boot your system from a USB key drive then you might want to have an exact copy of it in a safe place for the quickest possible replacement if the primary key drive fails (Imagine the machine is at a remote location with an "IT guy" on site who has absolutely no VMware experience ...). Can you think of other reasons? Let me know in the comments of this post!
So how do you clone an ESXi 5 installation?
I will describe two different methods to do this: one super fast method for experienced Linux users, and one super easy method for all other users.
Method 1: Using dd and (s)gdisk
1. Boot the system with a Linux Live CD. I have used the lightweight Systemrescue-CD for testing, it includes all the tools that I used here.
|Systemrescue-CD v3.1.2 boot screen|
This should list you at least the source disk (a USB key drive named /dev/sdb in my example) and the target disk (an internal hard disk named /dev/sda)
3. Print the partition table of the source disk with a command like
sgdisk -p /dev/sdb
sgdisk is a tool for handling disks with the GPT partition table which is what a new ESXi 5.x install will use (Please note: If your system was upgraded from an earlier version of ESXi it might use the MBR partition layout). The command will produce an output like this:
Disk /dev/sdb: 15679488 sectors, 7.5 GiB Logical sector size: 512 bytes Disk identifier (GUID): 3703B3D8-7FBE-4A3A-8526-FE24A6BF76DC Partition table holds up to 128 entries First usable sector is 34, last usable sector is 15679454 Partitions will be aligned on 32-sector boundaries Total free space is 13836413 sectors (6.6 GiB) Number Start (sector) End (sector) Size Code Name 1 64 8191 4.0 MiB EF00 5 8224 520191 250.0 MiB 0700 6 520224 1032191 250.0 MiB 0700 7 1032224 1257471 110.0 MiB FFFF 8 1257504 1843199 286.0 MiB 0700If your source disk is a USB key drive or SD card then you will always see exactly this list of partitions. If your source disk is a hard disk then you will notice another partition (a persistent scratch partition with a size of 4 GB) that ends at sector 10229759.
4. Note the end sector number of the last partition and dump this number (+1, because numbering starts at 0) of sectors from the source to the target disk:
dd if=/dev/sdb of=/dev/sda bs=512 count=1843200
(As an experienced Linux user you are of course aware that this will overwrite the target disk and cause a loss of all data stored on it.)
5. Fix the GPT partition table of the target disk using the gdisk tool as follows:
x (to enter the expert's menu)
e (to relocate backup data structures to the end of the disk)
w (to write the fixed partition table)
Congratulations! You now have a bootable copy of your original ESXi installation on the target disk. This was the super fast method and now for the super easy one:
Method 2: Using the Clonezilla Live CD
1. Download the Clonezilla Live CD, burn it and boot your system with it.
2. Follow the instructions on screen:
- Choose your preferred display language and keyboard settings
- Start Clonezilla from the menu and select the device-device mode (for copying one device to another)
- Select "Beginner" mode and then "local disk to local disk clone mode"
- You will then be presented with the list of detected disks with their device names and sizes, so it should be easy for you to identify and select the correct source disk:
Select the source disk with Clonezilla's disk to disk cloning
- In the next menu select the target disk from the remaining disk devices
- Accept the default selection for the file system repair options (skip checking/repairing ...)
- As a safety measure you will then be asked three times in a row whether you want to continue. Answer y each time. And you should really be aware now that your target disk will be overwritten causing a loss of all data on it ;-)
- Now the partimage tool will finally do the job of copying all partitions:
Clonzilla copying partitions with partimage
- After that press Enter, then select Power off or reboot.
After having cloned the ESXi installation you must make sure that you do not have both the source and target disk attached to the computer when you are going to boot it. Otherwise ESXi will greet you will a PSOD (Purple Screen Of Death) and the message "Two filesystems with the same UUID have been detected. Make sure you do not have two ESXi installations" (see KB1035107). This is what I call a clear error message ;-)
Now have fun cloning!