USB Image Tool for Windows easily backs up and restores your complete VMware ESXi hypervisor on USB or SD flash drives, a simple/free clone for peace of mind before patching or upgrading
I created the video below that features a very detailed walk-through of an imaging process that seems to work quite well for me. I tested this heavily when tinkering with various vSphere 6.5 and 6.7 versions in my home lab. While the use of such an tool isn't suited for production server use because it's completely unsupported by VMware, I have found it to be invaluable for lab testing purposes, giving me complete peace of mind that I can avoid long troubleshooting sessions by merely restoring from a complete backup image, much like I do with my Windows and Linux PCs and VMs.
It only takes a few minutes to install ESXi from scratch, but it's the configuration afterward that takes longer, including networking. You can back up the entire configuration of your ESXi server using VMware's official way in KB 2042141, but that doesn't grab your ESXi boot files and any custom VIBs. What about a more thorough way, that handles both the files and the configuration, and is easy to use?
Some scripted configuration backup methods assume a full vSphere, with vCenter or VCSA installed and configured. Not every home lab has that, and some are just a standalone ESXi hosts. This article has you covered.
This cloning technique doesn't preclude you from using the preferred VMware Update Manager method of patching or upgrading, making a backup of your complete ESXi before doing so protects you against troubleshooting issues that might arise afterward. This is especially important if you don't have any official means of VMware support. Isn't your time worth about $10 for a backup?
Let me think this through with you. How about a way to get peace-of-mind, knowing for darn sure that you can roll back an upgrade gone wrong? The basic steps of what's detailed below involve creating a backup image of your known-good USB (or SD) drive where your working ESXi lives, label it, and set it aside. Next, restore from that backup to another USB drive, and label it. Now boot it up on the same server that was imaged. It works! Now upgrade it. If that upgrade to a later ESXi point release or patch level doesn't work out well for you, it's just your copy of ESXi that you've scrogged. No worries, you still have the original USB drive, don't you? Even if you lost the physical original USB "thumb" drive, you still have the image on your Windows system's drive! Get it? Now that's peace of mind.
Let's think about the unsupported thing for a minute. What if all you're trying to do is see how a Spectre/Meltdown related Patch, or how a major upgrade from 6.5 to 6.7 goes? When you're done testing the TARGET USB flash drive, fine, just power down, plug the original SOURCE USB flash drive back in, boot 'er up and you're right back where you were, only much more confident your upgrade will go well back on your SOURCE's fully supported ESXi image. You essentially already had a full dress rehearsal/dry run. Nice!
Using the cloned image on a different system than it came from will likely lead to networking strangeness, even IP conflicts and/or packet loss. Thus, the importance of good labeling, to indicate the exact system you took the backup from. Also, if the ESXi host you're thinking of cloning is a member of a cluster, this cloning technique in this article should work, but I have not fully tested this. The host and the cluster shouldn't notice any change in the "personality" of the booted server, with all the same drivers and networking and such intact, since it's an exact drive image. I have also not fully tested USB Image Tool with ESXi 6.7 yet, but that shouldn't matter, since Disk Image Tool is sector-by-sector cloning anyway, which is filesystem/OS agnostic, thus, all partitions are copied, regardless of the role (core dump, scratch, etc.)
It's also worth noting that for production use, M.2 or SATADOM are preferred media choices for your ESXi install versus SD or USB, see reasons here and here. You can read more about Dell PowerEdge BOSS (Boot Optimized Storage System), which is basically a RAID 1 mirror of two 128GB or 256GB ASATA/AHCI M.2 modules.
The issue in a home or lab situation is that USB and SD are so much more portable and affordable, and you don't have to think about which VMFS you stuck the OS on, it's obvious. USB flash can even be mounted externally, while still allowing a front bezel door to close. It's pretty rare for you to have extra M.2 slots in your home lab, and the SATADOM module takes up a valuable SATA3 slot on SuperServer Bundles, making one of your 6 drive bays unusable. These are just some of the reasons you'll more often find ESXi installed on USB flash/thumb drives in test lab situations.
- Windows system with 1 available USB port, USB 3.0 preferred.
- If you're using SD media for your ESXi instead of USB, you'll also need a built-in SD slot, or a USB based SD to USB adapter. Since USB Image Tool works the same with either USB or SD devices, merely substitute the word SD for all instances of USB in the instructions below.
- VMware ESXi installed on an SD or USB drive.
Any version of ESXi is fine, even the free version, so there's no assumption that you have vCenter/VCSA running.
- Second USB drive of the same or greater capacity.
For example, the compact and popular SanDisk Ultra Fit 32GB USB 3.0 Flash Drive SDCZ43. Overkill size size, since ESXi itself only needs a tiny portion of it, like under 160 MB, but it creates other partitions for a variety of roles, and these drives are only about $10 dollars anyway, so 32GB is the smallest I'd use buy these days anyway. See why the extra space also gains you write endurance in the section highlighted below. The 32GB size is actually cheaper than the increasingly rare 16GB model anyway, and it's what is shipped with every SuperServer Bundle.
SanDisk Ultra Fit 32GB USB 3.0 Flash Drive SDCZ43
- Download USB Image Tool, it's a zip you extract, then just run the portable .exe, for free, with no restrictions. I would suggest you donate to the author once you're convinced it works, letting him know how much you appreciate that he didn't make it nagware/guiltware. It's been around since 2013, is actively being updated, and has a Changelog, FAQ and Forum. Alex seems intent on fixing any ESXi-related issues that come up, with active development happening in alex's coding playground. Windows behavior makes this stuff much trickier than you might think!
- Make note of your ESXi Build Number from ESXi client or vSphere Client, and use a pencil to write it on a blank or erased label tag, including the word SOURCE, and write identical information on a second blank or erased label tag, but instead of SOURCE, write TARGET.
- Shut down your ESXi host you'd like to back up, such as right before doing an easy upgrade to 6.7.
- Attach the SOURCE label to USB drive on the system you just shut down.
- Move the SOURCE to your Windows system.
- Launch USB Image Tool, and following along with the video below.
You may want to jump to the exact spot where I launch USB Image tool, making sure it says "Device Mode" at top left.
- First you'll create an image of your SOURCE drive that gets saved to your internal drive.
- Next you'll attach the TARGET label to an available drive that you're about to write to, and if it has ESXi on it that you don't mind overwriting, clean-up the drive first, made very easy with Rufus.
- Restore from the image to your TARGET drive.
- Insert your TARGET drive into the same server you shut down, boot it back up, it should boot right up, and not even notice you essentially cloned its boot drive. If the new drive is bigger, it won't be likely to benefit, so you won't be able to use USB Image Tool to go back to a smaller USB drive.
- Free-will donate to the author of USB Image Tool. I happily gave him €50 EUR, about $62 USD, because this dude is talented and certainly deserves some support. I don't even know him, but I do know that there seems to be nothing out there quite like what he has created: simple, effective, and supported.
It seems that the usual tools for imaging FAT32 and NTFS partitions on USB and SD cards don't work so well with VMware's ESXi partitions. You really just need sector-by-sector copying. Some of the failures were silence, seeming to clone just great, only to find that the cloned ESXi wouldn't even boot. That's what happens when they try to understand the filesystem and do a copy instead of a sector-by-sector clone/image.
Failed tests, in alphabetical order:
ODIN - Free Disk Imager
Exception of type Internal Exception thrown, cause: The partition format of this drive is not support (only MBR format, no EFI)
Failed to create a bootable drive, I don't have a record of the error.
USB Image Tool
Works great, but I did get this error once:
Could not write to the USB device (Code: 5)!
Please close all open explorer windows for this device.
Access is denied.
I show this issue during the video at this spot, along with the Rufus work-around. Once I could easily get past it repeatedly and reliably, I became much more confident in the USB Image Tool, using it many times since recording the video back on May 6, 2018.
Failed, but I don't recall the error.
If you're running Linux or willing to boot from a live Linux distro, you have many choices including CloneZilla, which is essentially a dd copy. Virtual Hobbit and Andreas Peetz apparently had good luck with it:
Cloning the ESXi boot volume
Nov 20 2015 by VIRTUALHOBBIT at VIRTUALHOBBIT Big IT, Hobbit sized
- How to clone ESXi 5
Dec 09 2012 by Andreas Peetz at VMware Front Experience
Reader feedback is invaluable for an article like this. If you find something lacking or wrong in my instructions, please let me know by dropping a comment below, which really helps everybody out, and I can even correct the article where needed. Thank you!
- How to easily update your VMware Hypervisor from 6.x to 6.7 (ESXi 6.7 Build 8169922) using ESXCLI or VUM
Apr 18 2018
- Meltdown and Spectre side-channel attack risk mitigation information from processor, server, and software vendors
Jan 10 2018, updated many times sinces
- Rufus lets you quickly and easily reformat an ESXi USB flash drive back to full capacity
Sep 10 2013
- vSphere SSD and Flash Device Support (2145210)
by VMware at kb.vmware.com
- VMware ESXi Installation and Setup
by VMware at docs.vmware.com, except from page 11:
Due to the I/O sensitivity of USB and SD devices, the installer does not create a scratch partition on these devices. When installing or upgrading on USB or SD devices, the installer attempts to allocate a scratch region on an available local disk or datastore. If no local disk or datastore is found, /scratch is placed on the ramdisk. After the installation or upgrade, you should reconfigure /scratch to use a persistent datastore. Although a 1GB USB or SD device suffices for a minimal installation, you should use a 4GB or larger device. The extra space is used for an expanded coredump partition on the USB/SD device. Use a high-quality USB flash drive of 16 GB or larger so that the extra flash cells can prolong the life of the boot media, but high-quality drives of 4 GB or larger are sufficient to hold the extended coredump partition.
See Knowledge Base article http://kb.vmware.com/kb/2004784.
- Using SD cards for embedded ESXi and vSAN?
Mar 01 2017 by John Nicholson at Virtual Ramblings
- Virtual SAN Considerations When Booting from a Flash Device
Mar 18 2016 by Rakesh Radhakrishnan at VMware Blogs Virtual Blocks
- How to clone ESXi 5
Dec 09 2012 by Andreas Peetz at VMware Front Experience
- VMware ESXi 6.0 partitions
May 26 2015 by Andrea Mauro at vInfrastructure Blog
/bootbank -> 250 MB
/altbootbank -> 250 MB
/store -> 286 MB
/scratch -> 4 GB