| 1 | |
| 2 | == Transfer Virtual Machine Between VMware ESX 3 Hosts On a USB Drive == |
| 3 | |
| 4 | === On ESX 3.0.3 host: export VM to a USB drive === |
| 5 | |
| 6 | 1) Create a mount point. |
| 7 | |
| 8 | {{{ |
| 9 | # mkdir /mnt/usb |
| 10 | }}} |
| 11 | |
| 12 | 2) Attach a USB drive. |
| 13 | |
| 14 | {{{ |
| 15 | # fdisk -l /dev/sdb |
| 16 | |
| 17 | Disk /dev/sdb: 80.0 GB, 80026361856 bytes |
| 18 | 255 heads, 63 sectors/track, 9729 cylinders |
| 19 | Units = cylinders of 16065 * 512 = 8225280 bytes |
| 20 | |
| 21 | Device Boot Start End Blocks Id System |
| 22 | /dev/sdb1 1 9729 78148161 83 Linux |
| 23 | # |
| 24 | }}} |
| 25 | |
| 26 | 3) Mount the EXT3 file system (that was created in advance by running the "{{{mkfs -t ext3 /dev/sdb1}}}" command on a Linux computer). |
| 27 | |
| 28 | {{{ |
| 29 | # mount -t ext3 /dev/sdb1 /mnt/usb |
| 30 | }}} |
| 31 | |
| 32 | 4) Shutdown the virtual machine, locate its files. |
| 33 | |
| 34 | {{{ |
| 35 | # ls -log /vmfs/volumes/storage1/Cerveza |
| 36 | -rw------- 1 21474836480 Dec 15 16:17 Cerveza-flat.vmdk |
| 37 | -rw------- 1 8664 Dec 15 16:17 Cerveza.nvram |
| 38 | -rw------- 1 339 Nov 17 11:03 Cerveza.vmdk |
| 39 | -rw------- 1 0 Nov 26 2007 Cerveza.vmsd |
| 40 | -rwxr-xr-x 1 1477 Oct 29 21:05 Cerveza.vmx |
| 41 | -rw------- 1 251 Oct 29 20:58 Cerveza.vmxf |
| 42 | -rw-r--r-- 1 26693 Nov 22 2009 vmware-26.log |
| 43 | -rw-r--r-- 1 26330 Mar 15 2010 vmware-27.log |
| 44 | -rw-r--r-- 1 25531 Oct 29 14:28 vmware-28.log |
| 45 | -rw-r--r-- 1 22416 Dec 15 16:17 vmware.log |
| 46 | # |
| 47 | }}} |
| 48 | |
| 49 | 5) Export the virtual disk (took 5 minutes to complete). |
| 50 | |
| 51 | {{{ |
| 52 | # vmkfstools -i /vmfs/volumes/storage1/Cerveza/Cerveza.vmdk \ |
| 53 | /mnt/usb/Cerveza.vmdk -d 2gbsparse |
| 54 | Destination disk format: sparse with 2GB maximum extent size |
| 55 | Cloning disk '/vmfs/volumes/storage1/Cerveza/Cerveza.vmdk'... |
| 56 | Clone: 100% done. |
| 57 | # |
| 58 | }}} |
| 59 | |
| 60 | 6) Copy virtual machine configuration files. |
| 61 | |
| 62 | {{{ |
| 63 | # ( cd /vmfs/volumes/storage1/Cerveza ; \ |
| 64 | tar cvf /mnt/usb/Cerveza.tar *.{nvram,vmsd,vmx,vmxf,log} ) |
| 65 | Cerveza.nvram |
| 66 | Cerveza.vmsd |
| 67 | Cerveza.vmx |
| 68 | Cerveza.vmxf |
| 69 | vmware-26.log |
| 70 | vmware-27.log |
| 71 | vmware-28.log |
| 72 | vmware.log |
| 73 | # |
| 74 | }}} |
| 75 | |
| 76 | 7) Un-mount the USB drive. |
| 77 | |
| 78 | {{{ |
| 79 | # ls -log /mnt/usb |
| 80 | total 3706752 |
| 81 | -rw------- 1 1502150656 Dec 15 16:24 Cerveza-s001.vmdk |
| 82 | -rw------- 1 373096448 Dec 15 16:24 Cerveza-s002.vmdk |
| 83 | -rw------- 1 38862848 Dec 15 16:24 Cerveza-s003.vmdk |
| 84 | -rw------- 1 251199488 Dec 15 16:24 Cerveza-s004.vmdk |
| 85 | -rw------- 1 70057984 Dec 15 16:24 Cerveza-s005.vmdk |
| 86 | -rw------- 1 221839360 Dec 15 16:24 Cerveza-s006.vmdk |
| 87 | -rw------- 1 65339392 Dec 15 16:24 Cerveza-s007.vmdk |
| 88 | -rw------- 1 670367744 Dec 15 16:24 Cerveza-s008.vmdk |
| 89 | -rw------- 1 598802432 Dec 15 16:24 Cerveza-s009.vmdk |
| 90 | -rw------- 1 589824 Dec 15 16:24 Cerveza-s010.vmdk |
| 91 | -rw------- 1 65536 Dec 15 16:24 Cerveza-s011.vmdk |
| 92 | -rw-r--r-- 1 184320 Dec 15 16:26 Cerveza.tar |
| 93 | -rw------- 1 734 Dec 15 16:24 Cerveza.vmdk |
| 94 | drwx------ 2 16384 Dec 15 15:46 lost+found |
| 95 | # |
| 96 | # sync ; umount /mnt/usb |
| 97 | }}} |
| 98 | |
| 99 | === On ESX 3.5 host: restore VM from a USB drive === |
| 100 | |
| 101 | 1) Create a mount point. |
| 102 | |
| 103 | {{{ |
| 104 | # mkdir /mnt/usb |
| 105 | }}} |
| 106 | |
| 107 | 2) Attach a USB drive. Mount the file system. |
| 108 | |
| 109 | {{{ |
| 110 | # mount /dev/sdb1 /mnt/usb |
| 111 | }}} |
| 112 | |
| 113 | 3) Import the virtual disk (took 17 minutes to complete). |
| 114 | |
| 115 | {{{ |
| 116 | # mkdir /vmfs/volumes/storage1/Cerveza |
| 117 | # |
| 118 | # vmkfstools -i /mnt/usb/Cerveza.vmdk \ |
| 119 | /vmfs/volumes/storage1/Cerveza/Cerveza.vmdk |
| 120 | Destination disk format: VMFS thick |
| 121 | Cloning disk '/mnt/usb/Cerveza.vmdk'... |
| 122 | Clone: 100% done. |
| 123 | # |
| 124 | }}} |
| 125 | |
| 126 | 4) Copy virtual machine configuration files. |
| 127 | |
| 128 | {{{ |
| 129 | # cd /vmfs/volumes/storage1/Cerveza |
| 130 | # tar xf /mnt/usb/Cerveza.tar |
| 131 | # |
| 132 | # ls -log |
| 133 | total 20972224 |
| 134 | -rw------- 1 21474836480 Dec 16 15:05 Cerveza-flat.vmdk |
| 135 | -rw------- 1 8664 Dec 15 16:17 Cerveza.nvram |
| 136 | -rw------- 1 400 Dec 16 15:05 Cerveza.vmdk |
| 137 | -rw------- 1 0 Nov 26 2007 Cerveza.vmsd |
| 138 | -rwxr-xr-x 1 1477 Oct 29 21:05 Cerveza.vmx |
| 139 | -rw------- 1 251 Oct 29 20:58 Cerveza.vmxf |
| 140 | -rw-r--r-- 1 26693 Nov 22 2009 vmware-26.log |
| 141 | -rw-r--r-- 1 26330 Mar 15 2010 vmware-27.log |
| 142 | -rw-r--r-- 1 25531 Oct 29 14:28 vmware-28.log |
| 143 | -rw-r--r-- 1 22416 Dec 15 16:17 vmware.log |
| 144 | # |
| 145 | }}} |
| 146 | |
| 147 | 5) Register the virtual machine. |
| 148 | |
| 149 | {{{ |
| 150 | # vmware-cmd -s register /vmfs/volumes/storage1/Cerveza/Cerveza.vmx |
| 151 | register(/vmfs/volumes/storage1/Cerveza/Cerveza.vmx) = 1 |
| 152 | # |
| 153 | # vmware-cmd -l |grep Cerveza |
| 154 | /vmfs/volumes/4d0a6ad8-64d962f4-116a-0015c5f67030/Cerveza/Cerveza.vmx |
| 155 | # |
| 156 | }}} |
| 157 | |