[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["わかりにくい","hardToUnderstand","thumb-down"],["情報またはサンプルコードが不正確","incorrectInformationOrSampleCode","thumb-down"],["必要な情報 / サンプルがない","missingTheInformationSamplesINeed","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-07-23 UTC。"],[],[],null,["This document shows you how to manually convert an existing virtual disk image\nto the\n[`qcow2`](https://wikipedia.org/wiki/Qcow)\nformat so that you can create and run VMs in VM Runtime on GDC using\nthat source image. You then learn how to create a VM directly from this\nconverted virtual disk image.\n\nThis page is for Operators and Developers who want\nto run existing virtualized workloads in a containerized environment. To learn\nmore about common roles and example tasks that we reference in Google Cloud\ncontent, see\n[Common GKE user roles and tasks](/kubernetes-engine/enterprise/docs/concepts/roles-tasks).\n\nVM Runtime on GDC automatically converts an existing disk image to\nthe `qcow2` format during deployment if needed. However, if you want to create\nmultiple VMs from a non-`qcow2` virtual disk image, VM Runtime on GDC\nmust convert the image every time. This process to convert the image to the\n`qcow2` format increases the amount of time it takes to create and start the VM.\nTo reduce the time it takes to create each VM, convert the virtual disk image to\nthe `qcow2` format first, as shown in this document.\n\nBefore you begin\n\nTo create a VM after you convert your existing virtual disk image, you need\naccess to the following resources:\n\n- Access to Google Distributed Cloud version 1.12.0 (`anthosBareMetalVersion: 1.12.0`) or higher cluster. You can use any cluster type capable of running workloads. If needed, [try Google Distributed Cloud on Compute Engine](/kubernetes-engine/distributed-cloud/bare-metal/docs/try/gce-vms) or see the [cluster creation overview](/kubernetes-engine/distributed-cloud/bare-metal/docs/installing/creating-clusters/create-clusters-overview).\n- The `virtctl` client tool installed as a plugin for `kubectl`. If needed, [install the virtctl client tool](/kubernetes-engine/distributed-cloud/bare-metal/docs/vm-runtime/quickstart#install_the_virtctl_client_tool).\n\nConvert a virtual disk image\n\nIn this document, you use the\n[QEMU disk image utility](https://www.qemu.org/docs/master/tools/qemu-img.html)\nto convert existing virtual disk images to the `qcow2` format. The `qemu-img`\ntool can convert virtual disk images from multiple formats, such as `vmdk` or\n`vhdx`, to the `qcow2` format for use with VM Runtime on GDC.\n\nTo convert virtual disk images to the `qcow2` format, complete the following\nsteps:\n\n1. Install the `qemu-utils` package using your Linux distro's package manager.\n\n Ubuntu \n\n apt-get install qemu-utils\n\n RHEL \n\n yum install qemu-utils\n\n2. Use `qemu-img` to convert the existing virtual disk image:\n\n qemu-img convert -f \u003cvar label=\"existing_disk_image_format\" translate=\"no\"\u003eEXISTING_DISK_IMAGE_FORMAT\u003c/var\u003e -O qcow2 \\\n \u003cvar label=\"existing_disk_image_name\" translate=\"no\"\u003eEXISTING_DISK_IMAGE_NAME\u003c/var\u003e \\\n \u003cvar label=\"converted_disk_image_name\" translate=\"no\"\u003eCONVERTED_DISK_IMAGE_NAME\u003c/var\u003e.qcow2\n\n Replace the following values:\n - \u003cvar translate=\"no\"\u003eEXISTING_DISK_IMAGE_FORMAT\u003c/var\u003e: the format of your existing virtual disk image, such as `vmdk`.\n - \u003cvar translate=\"no\"\u003eEXISTING_DISK_IMAGE_NAME\u003c/var\u003e: the path and name of your existing virtual disk image.\n - \u003cvar translate=\"no\"\u003eCONVERTED_DISK_IMAGE_NAME\u003c/var\u003e: the path and name for your converted `qcow2` virtual disk image.\n\n For more information on the `qemu-img` tool, such as the different image format\n options, see the\n [QEMU disk image utility documentation](https://www.qemu.org/docs/master/tools/qemu-img.html).\n\nCreate a VM with your converted image\n\nIf you want to see your converted virtual disk image in action, create a VM and\nuse the local `qcow2`-formatted image created in the previous section. For\nproduction use, you should upload your converted virtual disk image to a central\nrepository and then\n[create a VM boot disk from HTTP source](/kubernetes-engine/distributed-cloud/bare-metal/docs/vm-runtime/create-manage-disks#from_image)\nor\n[from Cloud Storage using a Secret](/kubernetes-engine/distributed-cloud/bare-metal/docs/vm-runtime/create-storage-credentials#use_a_secret_to_import_an_image).\n\nTo use your local converted virtual disk image, complete the following steps:\n\n1. Create a VM in your cluster:\n\n kubectl virt create vm \u003cvar label=\"vm_name\" translate=\"no\"\u003eVM_NAME\u003c/var\u003e \\\n --os-type \u003cvar label=\"os_type\" translate=\"no\"\u003eOS_TYPE\u003c/var\u003e \\\n --image \u003cvar label=\"converted_disk_image_name\" translate=\"no\"\u003eCONVERTED_DISK_IMAGE_NAME\u003c/var\u003e.qcow2\n\n This command creates a VM with the defaults of 2 CPU, 4 Gi memory.\n\n Replace the following values:\n - \u003cvar translate=\"no\"\u003eVM_NAME\u003c/var\u003e: name for your VM\n - \u003cvar translate=\"no\"\u003eOS_TYPE\u003c/var\u003e: the OS type of your converted virtual disk image. Can be `linux` or `windows`.\n - \u003cvar translate=\"no\"\u003eCONVERTED_DISK_IMAGE_NAME\u003c/var\u003e: the path and name of your converted `qcow2` virtual disk image from the previous section.\n2. It can take 10-20 minutes to create the VM from your locally converted\n virtual disk image, depending on the size of your image. Check the status of\n the VM with the `kubectl` command:\n\n kubectl get gvm \u003cvar label=\"vm_name\" translate=\"no\"\u003eVM_NAME\u003c/var\u003e\n\n Replace \u003cvar translate=\"no\"\u003eVM_NAME\u003c/var\u003e with the name of your VM.\n\n The following example output shows the VM in a `Running` state when the\n process is complete: \n\n NAME STATUS AGE IP\n MY_VM Running 64s 192.168.2.124\n\nWhat's next\n\nYou can upload your converted virtual disk image in `qcow2` format to an HTTP\nsource or Cloud Storage. The following documents show you how to then create a\nVM from those sources:\n\n- [Create a VM boot disk from HTTP source](/kubernetes-engine/distributed-cloud/bare-metal/docs/vm-runtime/create-manage-disks#from_image)\n- [Create a VM boot disk from Cloud Storage using a Secret](/kubernetes-engine/distributed-cloud/bare-metal/docs/vm-runtime/create-storage-credentials#use_a_secret_to_import_an_image)"]]