Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The method of using qemu-img tool to convert other format image files to VHD or RAW format

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Editor to share with you the use of qemu-img tools to convert other format image files into VHD or RAW format, I believe that most people do not know much, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

ECS only supports importing images in RAW, VHD, and qcow2 formats. Other image files need to be converted and then imported. This article describes how to use the qemu-img tool to convert image files in other formats to VHD or RAW format. Qemu-img can convert images of RAW, qcow2, VMDK, VDI, VHD (vpc), VHDX, qcow1 or QED to VHD format, as well as RAW and VHD formats.

Local Windows operating system

Follow these steps to install qemu-img and convert the image file format:

Download qemu-img and complete the installation. The installation path for this example is C:\ Program Files\ qemu.

Configure environment variables for qemu-img:

Select start > computer, and right-click Properties.

In the left navigation bar, click Advanced system Settings.

In the system Properties dialog box, click the Advanced tab, and click the environment variable.

In the environment variables dialog box, locate Path in the system variables section and click Edit. If the Path variable does not exist, click New.

Add a system variable value:

If you are editing a system variable, add C:\ Program Files\ qemu to the value of the variable, and the values of different variables are separated by semicolons (;).

If you are creating a new system variable, enter Path at the variable name and C:\ Program Files\ qemu at the variable value.

Test whether the environment variable is configured successfully: open the Windows command prompt and run qemu-img-- help. If the display is normal, the environment variable is configured.

At the command prompt, use cd [directory where the source mirror file is located] to change the file directory, such as cd D:\ ConvertImage.

Run the qemu-img convert-f qcow2-O raw centos.qcow2 centos.raw command to convert the image file format, where:

The parameter value of-f is in the format of the source image file.

The parameter values of-O (must be uppercase) are the destination image format, the source image file name, and the destination file name.

After the conversion is complete, the destination file appears in the same directory as the source image file.

Local Linux operating system

Follow these steps to install qemu-img and convert the image file format:

Install qemu-img, with the following example:

If the local operating system is Ubuntu, run apt install qemu-img.

If the local operating system is CentOS, run yum install qemu-img.

Run the qemu-img convert-f qcow2-O raw centos.qcow2 centos.raw command to convert the image file format, where:

The parameter value of-f is in the format of the source image file.

The parameter values of-O (must be uppercase) are the destination image format, the source image file name, and the destination file name.

After the conversion is complete, the destination file appears in the same directory as the source image file.

common problem

If the installation of qemu-img reports an error and there is no clear indication of which dependent libraries are missing, you can install all dependent libraries according to the libraries shown in cloud-init 's requirements.txt file and run pip install-r requirements.txt.

Next step

Import a custom image

The above is all the contents of the method of using qemu-img tool to convert other format image files into VHD or RAW format. Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report