[go: up one dir, main page]

CN109325012A - Method for modifying virtual machine mirror image partition - Google Patents

Method for modifying virtual machine mirror image partition Download PDF

Info

Publication number
CN109325012A
CN109325012A CN201810897238.7A CN201810897238A CN109325012A CN 109325012 A CN109325012 A CN 109325012A CN 201810897238 A CN201810897238 A CN 201810897238A CN 109325012 A CN109325012 A CN 109325012A
Authority
CN
China
Prior art keywords
image
partition
virtual machine
new
size
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Withdrawn
Application number
CN201810897238.7A
Other languages
Chinese (zh)
Inventor
马桂成
季统凯
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
G Cloud Technology Co Ltd
Original Assignee
G Cloud Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by G Cloud Technology Co Ltd filed Critical G Cloud Technology Co Ltd
Priority to CN201810897238.7A priority Critical patent/CN109325012A/en
Publication of CN109325012A publication Critical patent/CN109325012A/en
Withdrawn legal-status Critical Current

Links

Landscapes

  • Processing Or Creating Images (AREA)
  • Stored Programmes (AREA)

Abstract

本发明涉及桌面云镜像管理技术领域,特别是一种修改虚拟机镜像分区的方法。本发明所述的方法是根据查询到的虚拟机分区情况创建新的镜像;并依照需要修改新镜像的分区;再用新镜像代替原镜像。本发明解决了无法自动修改镜像分区、无法压缩镜像、不能对正在使用镜像的虚拟机生效、无法缩小镜像分区大小等问题;可应用于桌面云镜像管理技术领域。

The present invention relates to the field of desktop cloud image management technology, and in particular to a method for modifying a virtual machine image partition. The method of the present invention is to create a new image according to the queried virtual machine partition situation; and modify the partition of the new image as needed; and then replace the original image with the new image. The present invention solves the problems of being unable to automatically modify the image partition, unable to compress the image, unable to take effect on the virtual machine that is using the image, and unable to reduce the size of the image partition; and can be applied to the desktop cloud image management technology field.

Description

A method of modification virtual machine image subregion
Technical field
The present invention relates to desktop cloud mirror image administrative skill field, especially a kind of method for modifying virtual machine image subregion.
Background technique
There are more and more desktop cloud platforms to be applied to inside each enterprise now, each enterprise demand is very It is personalized;It much requires and existing server is utilized, such as create cloud desktop based on existing server;In this way The disk configuration of cloud desktop is usually also required to personalization.Traditional mode mainly by way of manual, needs to make according to user The cloud desktop for making the disk partition to meet the requirements of the customers is supplied to user's use, can there is following hidden danger in this way:
First is that a secondary mirror will be remake by hand according to each customer demand when desktop cloud project is more and more Picture.Actually the software of cloud desktop is all consistent with operating system, and only disk partition and CPU configuration are different.And CPU configuration is logical It is all often that dynamic adjusts, and system disk subregion is then mirror image default.And a completely new mirror image is made, it is various to installing by bare machine Software is very time-consuming and laborious.
Second is that client wants to adjust partition size again actually in use process, need into each cloud desktop Inside operating system, the subregion of each cloud desktop is modified by hand in the same way, and the usual quantity of the desktop of desktop cloud all compares Huger, such efficiency is very low, and manual operation user makes mistakes.
To solve the above-mentioned problems, a kind of method for modifying virtual machine image subregion is needed.It is virtual by a kind of modification The method of machine mirrored partition, in a manner of full-automatic, efficient, mirrored partition can not be modified automatically, can not press by being able to solve Contracting mirror image cannot come into force to the virtual machine that mirror image is used, can not reduce the problems such as mirror image partition size.
Summary of the invention
Present invention solves the technical problem that being to provide a kind of method for modifying virtual machine image subregion;Solving can not be certainly Dynamic modification mirrored partition, mirror image can not be compressed, cannot be come into force to the virtual machine that mirror image is used, can not to reduce mirrored partition big The problems such as small.
The technical solution that the present invention solves above-mentioned technical problem is:
The method is to create new mirror image according to the virtual machine partitions situation inquired;And according to needing to modify new mirror The subregion of picture;Former mirror image is replaced with new mirror image again.
The method includes the following steps:
Step 1: checking subregion service condition;
Step 2: creating new mirror image;
Step 3: modifying new mirrored partition;
Step 4: compressing new image file;
Step 5: replacing former mirror image using new mirror image;
Step 6: starting virtual machine;
Described checks subregion service condition, refers to the service condition for checking former mirrored partition, includes title, type, The mirror image is used with space, available space, total size and which virtual machine;
The type containing type has subregion, block device;
The subregion refers to disk partition.
The new mirror image of creation is the new image file for creating a size and former mirror image striking resemblances.
The new mirrored partition of modification, which refers to, all shuts down the virtual machine that former mirror image is used, then by former mirror image Information imported into inside new mirror image while modifying new mirrored partition size.
The new mirrored partition size of the modification refers to increase or reduces the size of mirrored partition;If desired mirror image is reduced Subregion, first judges whether available space is greater than the space of diminution, if so then execute mirror image partition size is reduced;Otherwise modification is shown Mirrored partition failure.
The new image file of compression refers to the actual size for compressing new image file;Image file is by increase Afterwards, authentic document size can expand automatically, at this time in order to save memory space, then need to compress the actual size of mirror image, compression The logic size of mirror image can't change afterwards.
Replacing former mirror image using new mirror image is that original mirror image is replaced by new mirror image, realizes mirrored partition modification.
The starting virtual machine is the virtual machine that starting uses the mirror image, and virtual machine will load repair during startup Mirrored partition after changing.
For the present invention by a kind of method for modifying virtual machine image subregion, mirrored partition, nothing can not be modified automatically by solving Method compression mirror image cannot come into force to the virtual machine that mirror image is used, can not reduce the problems such as mirror image partition size.The present invention is whole A process is full-automatic, does not need manual intervention, is different from general method.The method provided by the present invention can not only extend mirror image point The size in area can also reduce the size of mirrored partition, and a variety of granularities after being different from a kind of backup of virtual machine image grade are restored Method can not extend or reduce automatically subregion.The method provided by the present invention re-compresses mirror image after extending mirror image, guarantees mirror image Physics occupied space minimizes, and maximally utilizes memory space, is suitble to desktop cloud to the very high project of cost requirement, is different from one As method.The method provided by the present invention all uniformly comes into force to the virtual machine based on former mirror image, after restarting virtual machine, point of virtual machine Area's size becomes consistent after mirrored partition is modified, and helps adaptation project individual demand, is different from general method.
Detailed description of the invention
The following further describes the present invention with reference to the drawings:
Fig. 1 is flow chart of the present invention.
Specific embodiment
There are many embodiments of the present invention, illustrates one of implementation method, process by taking desktop cloud platform as an example here Figure is as shown in Figure 1, specific implementation process is as follows
1, check that subregion service condition, process are as follows:
1) information of file system is checked;
2) information of case of non-partitioned is filtered out, is left all to be partition information;
3) the virtual machine list based on former mirror image is inquired.
2, new mirror image is created, process is as follows:
1) size of former mirror image is obtained;
2) a new image file with former mirror image size striking resemblances is created.
3, new mirrored partition is modified, process is as follows:
1) all virtual machines based on former mirror image are closed;
2) judge modification mode, if reduction operation, then judge whether subregion available space is greater than the space of diminution, if Then continue, otherwise reports exception and the process that terminates;If extended operation, then whether host operating system current space available is judged New mirror image is created enough, if then continuing, otherwise reports exception and the process that terminates;
3) former mirror file system is imported into new image file while modifies mirrored partition size.
4, new image file is compressed, process is as follows:
1) by new mirror image boil down to qcow2 format;
2) actual size and logic size of new mirror image are checked;
3) whether decision logic size changes, and exception is reported if changing and the process that terminates.
5, former mirror image is replaced using new mirror image, process is as follows:
1) new be mirrored on mirror image server is uploaded;
2) virtual machine based on former mirror image is all uniformly revised as based on new mirror image.
6, start virtual machine, check the modified partition information of virtual machine.
Whole flow process terminates.

Claims (8)

1.一种修改虚拟机镜像分区的方法,其特征在于:所述的方法是根据查询到的虚拟机分区情况创建新的镜像;并依照需要修改新镜像的分区;再用新镜像代替原镜像。1. a method for revising virtual machine image partition, it is characterized in that: described method is to create new image according to the virtual machine partition situation inquired; And revise the partition of new image as needed; Replace original image with new image again . 2.根据权利要求1所述的方法,其特征在在于:所述的方法包括如下步骤:2. method according to claim 1 is characterized in that: described method comprises the steps: 步骤1:查看分区使用情况;Step 1: Check the partition usage; 步骤2:创建新镜像;Step 2: Create a new image; 步骤3:修改新镜像分区;Step 3: Modify the new mirror partition; 步骤4:压缩新镜像文件;Step 4: Compress the new image file; 步骤5:使用新镜像代替原镜像;Step 5: Use the new image to replace the original image; 步骤6:启动虚拟机。Step 6: Start the virtual machine. 3.根据权利要求2所述的方法,其特征在于:所述的查看分区使用情况,是指查看原镜像分区的使用情况,包含名称、类型、已用空间、可用空间、总大小以及哪些虚拟机正在使用该镜像;3. method according to claim 2 is characterized in that: described checking partition usage, refers to checking the usage of original mirror partition, including name, type, used space, available space, total size and which virtual machine is using the image; 所述的类型包含类型有分区、块设备;The types described include partitions and block devices; 所述的分区是指磁盘分区。The mentioned partitions refer to disk partitions. 4.根据权利要求2所述的方法,其特征在于:所述的创建新镜像是创建一个大小和原镜像一模一样的新镜像文件。4 . The method according to claim 2 , wherein the creating a new image is to create a new image file whose size is exactly the same as that of the original image. 5 . 5.根据权利要求2所述的方法,其特征在于:所述的修改新镜像分区是指将正在使用原镜像的虚拟机全部关机,然后将原镜像的信息导入到新镜像里面同时修改新镜像分区大小。5. method according to claim 2 is characterized in that: described modification new image partition is to refer to the virtual machine that is using original image all shut down, then the information of original image is imported into the new image and simultaneously revises new image Partition size. 所述的修改新镜像分区大小,是指增加或缩小镜像分区的大小;若需要缩小镜像分区,先判断可用空间是否大于缩小的空间,若是则执行缩小镜像分区大小;否则显示修改镜像分区失败。The modifying the size of the new mirror partition refers to increasing or reducing the size of the mirror partition; if the mirror partition needs to be reduced, first determine whether the available space is larger than the reduced space, and if so, perform the reduction of the mirror partition size; otherwise, it will display that the mirror partition modification failed. 6.根据权利要求2所述的方法,其特征在于:所述的压缩新镜像文件是指压缩新镜像文件的实际大小;镜像文件经过增大之后,真实文件大小会自动扩大,此时为了节省存储空间,则需要压缩镜像的真实大小,压缩后镜像的逻辑大小并不会发生变化。6. method according to claim 2 is characterized in that: described compressing new image file refers to the actual size of compressing new image file; after image file increases, real file size can be expanded automatically, at this moment in order to save Storage space, you need to compress the actual size of the image, and the logical size of the image will not change after compression. 7.根据权利要求2所述的方法,其特征在于:使用新镜像代替原镜像是通过新镜像替换原来的镜像,实现镜像分区修改。7 . The method according to claim 2 , wherein: replacing the original image with the new image is to replace the original image with the new image to realize the modification of the image partition. 8 . 8.根据权利要求1所述的方法,其特征在于:所述的启动虚拟机是启动使用该镜像的虚拟机,虚拟机在启动过程中就会加载修改后的镜像分区。8 . The method according to claim 1 , wherein the starting the virtual machine is to start the virtual machine using the image, and the virtual machine will load the modified image partition during the starting process. 9 .
CN201810897238.7A 2018-08-08 2018-08-08 Method for modifying virtual machine mirror image partition Withdrawn CN109325012A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810897238.7A CN109325012A (en) 2018-08-08 2018-08-08 Method for modifying virtual machine mirror image partition

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810897238.7A CN109325012A (en) 2018-08-08 2018-08-08 Method for modifying virtual machine mirror image partition

Publications (1)

Publication Number Publication Date
CN109325012A true CN109325012A (en) 2019-02-12

Family

ID=65264154

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810897238.7A Withdrawn CN109325012A (en) 2018-08-08 2018-08-08 Method for modifying virtual machine mirror image partition

Country Status (1)

Country Link
CN (1) CN109325012A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111831314A (en) * 2020-06-24 2020-10-27 烽火通信科技股份有限公司 Method and device for patching non-writable partition

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090006534A1 (en) * 2007-06-29 2009-01-01 Microsoft Corporation Unified Provisioning of Physical and Virtual Images
CN107004032A (en) * 2016-11-17 2017-08-01 华为技术有限公司 Image file conversion method and device
CN107015995A (en) * 2016-01-28 2017-08-04 华为技术有限公司 The amending method and device of a kind of image file
CN107844260A (en) * 2016-09-19 2018-03-27 深圳市深信服电子科技有限公司 A kind of method and device of magnetic disk of virtual machine space dilatation

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090006534A1 (en) * 2007-06-29 2009-01-01 Microsoft Corporation Unified Provisioning of Physical and Virtual Images
CN107015995A (en) * 2016-01-28 2017-08-04 华为技术有限公司 The amending method and device of a kind of image file
CN107844260A (en) * 2016-09-19 2018-03-27 深圳市深信服电子科技有限公司 A kind of method and device of magnetic disk of virtual machine space dilatation
CN107004032A (en) * 2016-11-17 2017-08-01 华为技术有限公司 Image file conversion method and device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
运维个西瓜: "修改KVM虚拟机镜像中的文件的几种方法(Guestfish/Guestmount/virt-*tools)", 《CSDN博客》 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111831314A (en) * 2020-06-24 2020-10-27 烽火通信科技股份有限公司 Method and device for patching non-writable partition
CN111831314B (en) * 2020-06-24 2022-11-22 烽火通信科技股份有限公司 Method and device for patching non-writable partition

Similar Documents

Publication Publication Date Title
CN102132258B (en) Firmware update system, information device and program
CN104714811A (en) Method and device for manufacturing difference upgrade package and system difference upgrade method and device
CN103177077B (en) The storage of a kind of APK file and output intent
JP2009530702A (en) Data storage management method and device
CN105468717A (en) Database operation method and device
CN111444104A (en) A Method of OpenStack Functional Testing
US8767253B2 (en) Information processing apparatus and computer program product
US8560501B2 (en) Method for a cloning process to enable cloning a larger system drive to a smaller system
CN109325012A (en) Method for modifying virtual machine mirror image partition
CN101178665A (en) Method and device for realizing configuration transaction
CN106789200A (en) A method for cloud platform custom automatic deployment
CN114020368A (en) Information processing method and device based on state machine and storage medium
CN106685729A (en) Method and system for service configuration management
CN102707907A (en) Device and printer having frame
US12105790B2 (en) Information processing apparatus, method, and program storage medium
EP2006772B1 (en) Database system and method for external backup
CN109213504A (en) A kind of stackable file system and its loading method and upgrade method
CN116301940B (en) A system installation method supporting flexible partition layout
CN107643959A (en) Image file treating method and apparatus
CN101179443A (en) A method, device and system for realizing consistent configuration data in a system
CN109543155A (en) A kind of data automatic update method and system
CN111104367B (en) Method for creating private mirror image based on openstack volume starting virtual machine
CN107450934A (en) A kind of method for making self-defined ESXI system images
CN112559126A (en) Implementation method for permanent storage virtual machine restoration based on openstack cloud management platform
JP2017004332A (en) Information processing apparatus, information processing apparatus control method, and program

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
WW01 Invention patent application withdrawn after publication
WW01 Invention patent application withdrawn after publication

Application publication date: 20190212