Backup virtual esx machines to usb drive


I noted this while researching a backup question for VMware – useful to know that the esx can talk directly to the usb device !!

so heres the info

Storage USB devices can be used to back up virtual machines. By default, USB devices are supported on ESX 3.x. The USB drivers are pre-loaded in ESX 3.5.

The following filesystems are supported:
FAT32 read/write.
ext3 read/write
NTFS read only

To copy data from Service Console to a USB device:
Plug in the storage USB device

Run the following command to determine which device name the kernel assigned to it:

tail /var/log/dmesg

Run the following command to create a mount point:

mkdir /mnt/usb

Run the following command to mount the drive:

mount /dev/[device_name] /mnt/usb -t [filesystem_type]

Note:
Replace [device_name] with your device name found in step 2
Replace [filesystem_type] with vfat (FAT32) or ext3

Run the following command to unmount the device:

umount /dev/[device_name]

To export the VMDK (virtual disk):

vmkfstools -i /vmfs/volumes/[datastore_name]/[vm_name]/[vm_name].vmdk /mnt/usb/[vm_name].vmdk -d 2gbsparse

To import the VMDK (virtual disk):

vmkfstools -i /[path_to_USB_mount]/[vm_name].vmdk /vmfs/volumes/[datastore_name]/[vm_name]/[vm_name].vmdk

To copy the configuration files for a virtual machine:

cd /vmfs/volumes/[datastore_name]/[vm_name]
tar -czvf [vm_name].tar.gz *.vmx *.log *.nvram *.vmxf *.vmsd
cp [vm_name].tar.gz /mnt/usb

To extract the configuration files of a virtual machine:

tar -xzvf [vm_name].tar.gz /vmfs/volumes/[datastore_name]/[vm_name]

so there you have it – another little tip for working with your vmware ESX server and Vms….