Export VMs

 

Overview

You often need to export a VM. To do that you need a non-vmfs filesystem on the host. Here's how to create one after ESX is installed without leaving space

Details

  • delete the local vmfs created during your take-all-the-defaults install.
If its already installed, then from the console type: fdisk -l

This will list all your dirves/arrays as the system sees them. Find the device that is the drive you want to format/mount. It will be in the format /dev/sdb or similar.

Next you'll need to partition that drive. So now type fdisk /dev/sdb (or whatever your device name is). N for new partition. Make it the size you want or tab neter to accept defaults. Next change the type to Linux with the T command. Make type 83. Now W to write the changes.

Now format the partiton: mke2fs -j -L <volume label> /dev/sdb

Replace <volume label> with the friendly name of this partition (ex. iso) and use actual device instead of /dev/sdb in example.

Now make a mount point for the partiton: mkdir /iso (or label name you used)

OK, last step. vi the /etc/fstab file and add a line that looks like the following using the label you defined above instead of /iso (unless that is what you called it)

LABEL=/iso /iso ext3 defaults 1 2

Test it: mount /iso (or label name). Then: ls -al > /iso/junk. Then: ls -al /iso, you should see a file called junk in this directory. If so, all is good.

References

 
 

Move a dsk between partitions.

vmkfstools -i "./some_serverv.mdk" "/some/place/else/some_server.vmdk"

Export from ESX to Server

To export a virtual disk from VMFS volume, you need to specify ‘2gbsparse’ disk format. Disks in this format can be used with other VMware products.

vmkfstools -i "./some_servervmdk" -d 2gbsparse "/vmimages/some_server.vmdk"

Import a virtual disk

vmkfstools -i "/vmimages/Win XP.vmdk" "/vmfs/volumes/storage1/Win XP/Win XP.vmdk"

Notes

Export Disk Options

Supported Disk Formats When creating or cloning virtual disks, you can use the -d --diskformat suboption to specify format for your disk. Choose an appropriate format:

_zeroedthick_ (default) Space required for the virtual disk is allocated during creation. Any data remaining on the physical device is not erased during creation, but will be zeroed out at a later time during virtual machine read and write operations.

_eagerzeroedthick_ Space required for the virtual disk is allocated at creation time. Unlike with the zeroedthick format, the data remaining on the physical device is zeroed out during creation. Disks in this format might take much longer to create than other types of disks.

_thick_ Space required for the virtual disk is allocated during creation. This type of formatting doesn’t zero out any old data that might be present on this allocated space.

_thin_ Thin-provisioned virtual disk. Unlike with the thick format, space required for the virtual disk is not allocated during creation, but is supplied, zeroed out, on demand at a later time.

_rdm_ Virtual compatibility mode raw disk mapping.

_rdmp_ Physical compatibility mode (pass-through) raw disk mapping.

_raw_ Raw device.

_2gbsparse_ A sparse disk with 2GB maximum extent size. Disks in this format can be used with other VMware products.

Comments