官术网_书友最值得收藏!

Migrating a VMware image

We can migrate a VMware based image, vmdk, to other disk image formats. This can be achieved using an image conversion utility. This same utility can be used to verify that the conversion worked properly. Once the image has been converted, it can be uploaded to OpenStack Image Service.

Getting ready

To begin with, ensure you are logged in to our Ubuntu client where we will be doing the image conversion. Make sure you have qemu-util installed; if not, you may install it using the following:

sudo apt-get install qemu-utils

How to do it...

Carry out the following steps to convert a VMDK image to the QCOW2 format:

  1. Verify the image using the following command:
    qemu-img info custom-iso-1415990568-disk1.vmdk 
    
  2. You will get the following output:
    image: custom-iso-1415990568-disk1.vmdk
    file format: vmdk
    virtual size: 39G (41943040000 bytes)
    disk size: 2.7G
    cluster_size: 65536
    Format specific information:
     cid: 2481477841
     parent cid: 4294967295
     create type: monolithicSparse
     extents:
     [0]:
     virtual size: 41943040000
     filename: custom-iso-1415990568-disk1.vmdk
     cluster size: 65536
     format: 
    
  3. Convert the image using the following command:
    qemu-img convert -f vmdk -O qcow2 -c \-p custom-iso-1415990568-disk1.vmdk \custom-iso-1415990568-disk1.qcow2
    

    Here, -f is the input disk image format, -O is the output format, -c target should be compressed QCOW format only), and -p show progress.

  4. Verify the converted image as follows and it should show that the images are identical if all went as expected:
    qemu-img compare -s -f vmdk \-F qcow2 custom-iso-1415990568-disk1.vmdk \custom-iso-1415990568-disk1.qcow2 
    Images are identical.
    

How it works...

The qemu-img convert command-line tool works on multiple formats, including VMDK. Conversion to VMDK or other desired formats would work as well. Since the QCOW format supports image compression, it can be useful to get a smaller image which then can grow.

主站蜘蛛池模板: 灵武市| 荥经县| 芜湖市| 绿春县| 塔河县| 鄯善县| 盐城市| 苍南县| 灌阳县| 鸡西市| 如皋市| 绥棱县| 景德镇市| 宁海县| 顺昌县| 林甸县| 大竹县| 中西区| 阿巴嘎旗| 桂阳县| 万载县| 迁安市| 绥化市| 太保市| 岢岚县| 东乡族自治县| 平舆县| 横山县| 女性| 繁峙县| 威远县| 兴业县| 新民市| 绥化市| 玉林市| 天柱县| 龙游县| 玉田县| 肥乡县| 深水埗区| 蒲城县|