VMware Cloud Community
FATGUYMEST
Contributor
Contributor

Cloning an ESXi 4 USB Host

I'm running ESXi 4 off of a 1GB USB drive. I have 4 guest machines configured and running smoothly. Now that I have everything configured the way I want it, I'd like to clone that USB host drive and put it away somewhere safe as a backup incase my current USB fails on me. How can I accomplish this? I've tried using ghost, and it worked, but upon attempting to boot to the backup drive, all of my configuration information was gone. ESXi loaded, but my IP was gone, DNS name, root password...etc. Has anyone successfully completed this?

0 Kudos
14 Replies
Dave_Mishchenko
Immortal
Immortal

Welcome to the VMware Community forums. The best option is to use vicfg-cfgbackup.pl from the RCLI. You can get that command in vMA download - http://www.vmware.com/support/developer/vima/ or vSphere vCLI - http://www.vmware.com/support/developer/vcli/

0 Kudos
FATGUYMEST
Contributor
Contributor

Will this allow me to take an image that will have all of the config info in it as I have described? Or will it just help me get the config info out of my current production USB?

0 Kudos
lamw
Community Manager
Community Manager

The solution described by Dave will only extract configurations defined for your ESXi host (e.g. vSwitch configs,datastore mounts,passwords,users,etc). It will not backup the VM(s) that are stored within the local storage, in this case on your USB key. You will need to implement another solution to backup your VM(s) but regarding the host configurations, yes the vCLI's esxcfg-cfgbackup will allow you to extract and restore.

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

VMware Code Central - Scripts/Sample code for Developers and Administrators

If you find this information useful, please award points for "correct" or "helpful".

0 Kudos
rmrobert
VMware Employee
VMware Employee

Maybe I'm wrong, so someone can correct me, but what I would do is boot a Linux LiveCD (either physically or in a Workstation VM) and if you go the Workstation VM route, make sure to passthrough the USB key to the LiveCD guest. Then find your device with: fdisk -l, and do a 'dd if=/dev/sdb of=esx4i-backup.dd' then copy that file off the VM, perhaps using SCP, or NFS/CIFS mounting from inside the VM.

To restore, just use dd in the opposite direction. Also setting bs=4M or something will speed things up but isn't necessary.

0 Kudos
AndreTheGiant
Immortal
Immortal

Unix dd command is just a block to block copy utility (and is very useful).

In this case the destination must be with the same size (or greater) then the original.

Andre

**if you found this or any other answer useful please consider allocating points for helpful or correct answers

Andrew | http://about.me/amauro | http://vinfrastructure.it/ | @Andrea_Mauro
0 Kudos
rmrobert
VMware Employee
VMware Employee

In my example, you are backing up to a file, not another device. It goes without saying you need as much space as you are trying to back up (without getting fancy by piping to gzip or something).

Andre is right, that you can restore to any device of equal or greater size only.

0 Kudos
AndreTheGiant
Immortal
Immortal

In my example, you are backing up to a file, not another device.

True.

But when you do the "restore" you will need a key with enought space Smiley Happy

Note that extra space are unusable, cause dd copy also the partition table.

Andre

**if you found this or any other answer useful please consider allocating points for helpful or correct answers

Andrew | http://about.me/amauro | http://vinfrastructure.it/ | @Andrea_Mauro
0 Kudos
FATGUYMEST
Contributor
Contributor

While these responces may be of some use to me, I'm really just looking for a way to clone the easiest. I have 2 of the exact same USB keys, 1 i'm currently using in production, and one I'd like to use for backup. The goal here is to use as simple a process as possible to clone my production USB key to my backup USB key. Surly there has to be an easy way to do this?

0 Kudos
AndreTheGiant
Immortal
Immortal

The dd command work at block level, so you USB keys will be identical.

But you have to do "cold" (with ESXi powered off).

There is also a way to do live, but you can have some inconsistency.

Andre

**if you found this or any other answer useful please consider allocating points for helpful or correct answers

Andrew | http://about.me/amauro | http://vinfrastructure.it/ | @Andrea_Mauro
0 Kudos
Dave_Mishchenko
Immortal
Immortal

As Andrew mentions you can use dd for this (ideally with the host shutdown) but the console does include dd as well. Running at the console would risk corruption if for example you ran it at the same time as a system backup was run, but for the most part ESXi runs from a RAM drive.

If maintaining a supported system in important to you, then you would need to stick with vicfg-configbackup.

0 Kudos
fatbobsufc
Contributor
Contributor

For anyone else stumbling onto this thread via google the following tool allowed me to image and SD card with ESXi 4.1 and clone it to another SD card and also a USB memory stick and then successfully boot.

0 Kudos
flubber20111014
Contributor
Contributor

thank fatbobsufc!!

I have just downloaded it and it worked perfectly!

I cloned (in few minutes) my esxi host usb pendrive to a brand new one, plug it in, reboot and I found exactly the identical situation as before!!

great!

Smiley Wink

0 Kudos
sjourney
Contributor
Contributor

Ok I had a Vendor fat finger the root password on 2 of 8 blades I recently purchased. All have factory installed ESXi on USB key. So I took one of the usb keys of which I knew the root password, used the before mentioned software to clone it to one of the other keys. Worked like a charm.

My question is, should I worry about changing anything on the hosts UUID's or something? Running the reset on the console removes the IBM CIM and HBA drivers. So can I just leave it as is? These host will be in the same cluster in VC.

Thanks!

0 Kudos
geppi
Contributor
Contributor

Dave, how would the dd command on the console look for this, i.e. which device paths do I need to use for the if= and of= parameters of dd to live clone the USB stick ?

This would be for my lab box, i.e. not for a production system.

0 Kudos