{"id":2507,"date":"2016-07-23T06:59:13","date_gmt":"2016-07-22T18:59:13","guid":{"rendered":"http:\/\/www.zoyinc.com\/?p=2507"},"modified":"2016-07-23T06:59:14","modified_gmt":"2016-07-22T18:59:14","slug":"cloning-an-esxi-usb-boot-flash-drive","status":"publish","type":"post","link":"http:\/\/www.zoyinc.com\/?p=2507","title":{"rendered":"Cloning an ESXi USB boot flash drive"},"content":{"rendered":"<p>I have a couple of ESXi servers at home that I boot from USB keys &#8211; see the post\u00a0<a  href=\"http:\/\/www.zoyinc.com\/?p=1202\">Running ESXi 5.1 from a USB key<\/a>. The problem is that using a USB imaging tool doesn&#8217;t seem to work. When I boot up ESX I get an error:<\/p>\n<pre class=\"crayon:false;\">BANK5: invalid configuration.\r\nBANK6: not a VMware boot bank\r\nNo hypervisor found<\/pre>\n<p>The problem would seem to be that the imaging tools are fine, its just that when you do this on a Windows platform and probably more specifically a Windows 7 or 10, then Windows messes around with the partition numbering or something.<\/p>\n<p>So the solution, as much as it is a little painful, is to use Linux to do the restore.<\/p>\n<h2>Creating the backup image<\/h2>\n<p>I use the &#8220;USB Imaging Tool&#8221; by Alexander Beug\u00a0 <a  href=\"http:\/\/www.alexpage.de\/\">http:\/\/www.alexpage.de\/<\/a>. Simply plug the ESXi key into your Windows PC run the tool and you see:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-2518\" src=\"http:\/\/www.zoyinc.com\/wp-content\/uploads\/2016\/07\/USBImageTool01-300x181.gif\" alt=\"USB Image Tool\" width=\"300\" height=\"181\" srcset=\"http:\/\/www.zoyinc.com\/wp-content\/uploads\/2016\/07\/USBImageTool01-300x181.gif 300w, http:\/\/www.zoyinc.com\/wp-content\/uploads\/2016\/07\/USBImageTool01-150x90.gif 150w, http:\/\/www.zoyinc.com\/wp-content\/uploads\/2016\/07\/USBImageTool01-498x300.gif 498w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>Note: Apparently a number of USB flash disk manufacturers are changing their disks to suit Windows ReadyBoost. This means they appear to the O\/S as a USB hard drive rather than a flash disk. This means they do not show up in the USB Imaging Tool or some other similar applications.<\/p>\n<p>Just click on &#8220;Backup&#8221; and save to a file.<\/p>\n<h2>Restoring a USB flash disk image<\/h2>\n<p>Restoring the image is the fun bit. It would appear that programs such as USB Image Tool probably work fine, but for some reason because it is running in Windows it appears that Windows does something to the partition numbering on the flash disk.<\/p>\n<p>An ESXi USB flash disk&#8217;s partitions look like this in Windows disk management tool:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-2523 size-full\" src=\"http:\/\/www.zoyinc.com\/wp-content\/uploads\/2016\/07\/ESXPartitionsWindows03.jpg\" alt=\"ESX Partitions Windows\" width=\"700\" height=\"64\" srcset=\"http:\/\/www.zoyinc.com\/wp-content\/uploads\/2016\/07\/ESXPartitionsWindows03.jpg 700w, http:\/\/www.zoyinc.com\/wp-content\/uploads\/2016\/07\/ESXPartitionsWindows03-150x14.jpg 150w, http:\/\/www.zoyinc.com\/wp-content\/uploads\/2016\/07\/ESXPartitionsWindows03-300x27.jpg 300w, http:\/\/www.zoyinc.com\/wp-content\/uploads\/2016\/07\/ESXPartitionsWindows03-500x46.jpg 500w\" sizes=\"auto, (max-width: 700px) 100vw, 700px\" \/><\/p>\n<p>The result is that if you restore the image with the USB Image Tool and attempt to boot it you get:<\/p>\n<pre class=\"crayon:false;\">BANK5: invalid configuration.\r\nBANK6: not a VMware boot bank\r\nNo hypervisor found<\/pre>\n<p>There are many ways to work around this problem but I was looking for one that was &#8220;relatively easy&#8221; and worked for me. It may not be perfect for me but it was the best of an unfortunate set of choices.<\/p>\n<table class=\"zsteps\">\n<tbody>\n<tr>\n<td>1.<\/td>\n<td>Boot a PC, any PC, with the Debian Live USB key &#8211; see the post <a  href=\"http:\/\/www.zoyinc.com\/?p=2353\">Create a Debian Live USB flash drive<\/a> for more details.<\/p>\n<p>You can use an PC for this but given you will be wiping disks it may make sense to remove any other disks or use a PC which isn&#8217;t critical.<\/td>\n<\/tr>\n<tr>\n<td>2.<\/td>\n<td>Do not insert the destination USB key just yet !!<\/td>\n<\/tr>\n<tr>\n<td>3.<\/td>\n<td>Now run &#8220;lsblk&#8221; to see what disks and partitions you have:<\/p>\n<pre class=\"crayon:false;\">root@debian:~# lsblk\r\nNAME\u00a0\u00a0 MAJ:MIN RM\u00a0 SIZE RO TYPE MOUNTPOINT\r\nsda\u00a0\u00a0\u00a0\u00a0\u00a0 8:0\u00a0\u00a0\u00a0 0 74.5G\u00a0 0 disk\r\n\u2514\u2500sda1\u00a0\u00a0 8:1\u00a0\u00a0\u00a0 0 74.5G\u00a0 0 part\r\nsdb\u00a0\u00a0\u00a0\u00a0\u00a0 8:16\u00a0\u00a0 0\u00a0 7.5G\u00a0 0 disk\r\n\u2514\u2500sdb1\u00a0\u00a0 8:17\u00a0\u00a0 0\u00a0 1.2G\u00a0 0 part \/lib\/live\/mount\/medium\r\nsr0\u00a0\u00a0\u00a0\u00a0 11:0\u00a0\u00a0\u00a0 1 1024M\u00a0 0 rom\r\nloop0\u00a0\u00a0\u00a0 7:0\u00a0\u00a0\u00a0 0\u00a0 1.1G\u00a0 1 loop \/lib\/live\/mount\/rootfs\/filesystem.squashfs<\/pre>\n<\/td>\n<\/tr>\n<tr>\n<td>4.<\/td>\n<td>Now insert the destination USB key and run lsblk again:<\/p>\n<pre class=\"crayon:false;\">root@debian:~# lsblk\r\nNAME\u00a0\u00a0 MAJ:MIN RM\u00a0 SIZE RO TYPE MOUNTPOINT\r\nsda\u00a0\u00a0\u00a0\u00a0\u00a0 8:0\u00a0\u00a0\u00a0 0 74.5G\u00a0 0 disk\r\n\u2514\u2500sda1\u00a0\u00a0 8:1\u00a0\u00a0\u00a0 0 74.5G\u00a0 0 part\r\nsdb\u00a0\u00a0\u00a0\u00a0\u00a0 8:16\u00a0\u00a0 0\u00a0 7.5G\u00a0 0 disk\r\n\u2514\u2500sdb1\u00a0\u00a0 8:17\u00a0\u00a0 0\u00a0 1.2G\u00a0 0 part \/lib\/live\/mount\/medium\r\n<span style=\"background-color: #ffff00;\">sdc\u00a0\u00a0\u00a0\u00a0\u00a0 8:32\u00a0\u00a0 1\u00a0 7.5G\u00a0 0 disk<\/span>\r\n<span style=\"background-color: #ffff00;\">\u2514\u2500sdc1\u00a0\u00a0 8:33\u00a0\u00a0 1\u00a0 1.2G\u00a0 0 part<\/span>\r\nsr0\u00a0\u00a0\u00a0\u00a0 11:0\u00a0\u00a0\u00a0 1 1024M\u00a0 0 rom\r\nloop0\u00a0\u00a0\u00a0 7:0\u00a0\u00a0\u00a0 0\u00a0 1.1G\u00a0 1 loop \/lib\/live\/mount\/rootfs\/filesystem.squashfs<\/pre>\n<p>You can see immediately which is the new disk by comparing the results of lsblk before and after inserting the key.<\/td>\n<\/tr>\n<tr>\n<td>5.<\/td>\n<td>At this point you need to be able to access the backup image. In my case it was on a shared disk so I ran:<\/p>\n<pre class=\"crayon:false;\">mkdir \/nas2\r\nmount -t cifs -o username=joeblogs,password=joespasswd \/\/192.168.202.35\/backups \/nas2<\/pre>\n<\/td>\n<\/tr>\n<tr>\n<td>6.<\/td>\n<td>We now need to install &#8220;dcfldd&#8221; which is a slightly enhanced version of dd. What I like about it is that it gives you progress info while it copies.<\/p>\n<p>Install it by running:<\/p>\n<pre class=\"crayon:false;\">apt-get install dcfldd<\/pre>\n<\/td>\n<\/tr>\n<tr>\n<td>7.<\/td>\n<td>Now run fdisk against the destination flash disk to double check the sector<\/p>\n<pre class=\"crayon:false;\">root@debian:\/# fdisk -l \/dev\/sdc\r\n\r\nDisk \/dev\/sdc: 7.5 GiB, 8004304896 bytes, 15633408 sectors\r\nUnits: sectors of 1 * 512 = 512 bytes\r\n<span style=\"background-color: #ffff00;\">Sector size (logical\/physical): 512 bytes<\/span> \/ 512 bytes\r\nI\/O size (minimum\/optimal): 512 bytes \/ 512 bytes\r\nDisklabel type: dos\r\nDisk identifier: 0x06760b31\r\n\r\nDevice\u00a0\u00a0\u00a0\u00a0 Boot Start\u00a0\u00a0\u00a0\u00a0 End Sectors\u00a0 Size Id Type\r\n\/dev\/sdc1\u00a0 *\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 64 2573503 2573440\u00a0 1.2G 17 Hidden HPFS\/NTFS<\/pre>\n<p>So you can see the sector size is 512 bytes<\/td>\n<\/tr>\n<tr>\n<td>8.<\/td>\n<td>Now run dcfldd:<\/p>\n<pre class=\"crayon:false; \">dcfldd bs=512\u00a0 if=\"\/nas2\/esxi\/ESXA\/ESXA USB Key 16-7-2016 V2.img\" of=\/dev\/sdc<\/pre>\n<p>So in the above you can see the image file is located at:<\/p>\n<p style=\"padding-left: 30px;\">Image file: \/nas2\/esxi\/ESXA\/ESXA USB Key 16-7-2016 V2.img<br \/>\nBlock size: 512<br \/>\nDestination disk: \/dev\/sdc<\/p>\n<p>The result will be similar to:<\/p>\n<pre class=\"crayon:false;  \">root@debian:\/# dcfldd bs=512\u00a0 if=\"\/nas2\/esxi\/ESXA\/ESXA USB Key 16-7-2016 V2.img\" of=\/dev\/sdc\r\n15633408 blocks (7633Mb) written.\r\n15633408+0 records in\r\n15633408+0 records out<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have a couple of ESXi servers at home that I boot from USB keys &#8211; see the post\u00a0Running ESXi 5.1 from a USB key. The problem is that using a USB imaging tool doesn&#8217;t seem to work. When I boot up ESX I get an error: BANK5: invalid configuration. BANK6: not a VMware boot [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":1249,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[124],"tags":[317,343,342,314,308],"class_list":["post-2507","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-esxi","tag-boot","tag-esx","tag-esxi","tag-usb","tag-vmware"],"_links":{"self":[{"href":"http:\/\/www.zoyinc.com\/index.php?rest_route=\/wp\/v2\/posts\/2507","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.zoyinc.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.zoyinc.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.zoyinc.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.zoyinc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2507"}],"version-history":[{"count":12,"href":"http:\/\/www.zoyinc.com\/index.php?rest_route=\/wp\/v2\/posts\/2507\/revisions"}],"predecessor-version":[{"id":2530,"href":"http:\/\/www.zoyinc.com\/index.php?rest_route=\/wp\/v2\/posts\/2507\/revisions\/2530"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.zoyinc.com\/index.php?rest_route=\/wp\/v2\/media\/1249"}],"wp:attachment":[{"href":"http:\/\/www.zoyinc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2507"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.zoyinc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2507"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.zoyinc.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2507"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}