CN103853497A - Disk mirror image block adjusting method, disk mirror image building method and relevant device - Google Patents
Disk mirror image block adjusting method, disk mirror image building method and relevant device Download PDFInfo
- Publication number
- CN103853497A CN103853497A CN201210504938.8A CN201210504938A CN103853497A CN 103853497 A CN103853497 A CN 103853497A CN 201210504938 A CN201210504938 A CN 201210504938A CN 103853497 A CN103853497 A CN 103853497A
- Authority
- CN
- China
- Prior art keywords
- disk image
- disk
- image
- instruction
- block 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.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 84
- 238000012546 transfer Methods 0.000 claims description 4
- 238000012545 processing Methods 0.000 claims description 3
- 238000010586 diagram Methods 0.000 description 11
- 230000008569 process Effects 0.000 description 10
- 230000009286 beneficial effect Effects 0.000 description 8
- 230000006870 function Effects 0.000 description 7
- 238000007726 management method Methods 0.000 description 6
- 238000005516 engineering process Methods 0.000 description 5
- 230000007246 mechanism Effects 0.000 description 4
- 230000008878 coupling Effects 0.000 description 3
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- 238000004891 communication Methods 0.000 description 2
- 230000003044 adaptive effect Effects 0.000 description 1
- 238000013523 data management Methods 0.000 description 1
- 238000005538 encapsulation Methods 0.000 description 1
- 238000002955 isolation Methods 0.000 description 1
- 238000012423 maintenance Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000011160 research Methods 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Images
Landscapes
- Signal Processing For Digital Recording And Reproducing (AREA)
Abstract
An embodiment of the invention discloses a disk mirror image block adjusting method, a disk mirror image building method and a relevant device. The disk mirror image block adjusting method includes receiving an adjusting command for adjusting the block size of a first disk mirror image; building a second disk mirror image, wherein the block size of the second disk mirror image is the block size indicated by the adjusting command; copying data stored in the first disk mirror image into the second disk mirror image. By means of the methods and the device, the data reading writing performance and the storage space utilization rate of the disk mirror images can be improved.
Description
Technical Field
The invention relates to the technical field of computers, in particular to a block adjustment method of a disk image, a disk image creation method and related equipment.
Background
The virtualization technology is a decoupling technology for separating the bottom hardware device from the upper operating system and the application program, and referring to fig. 1, a Virtual Machine Monitor (VMM) layer is introduced to directly manage the bottom hardware resources, and a Virtual Machine (VM) independent of the hardware is created for the upper operating system and the application program.
One or more virtual computers, namely VMs, can be simulated on one physical computer through virtual machine software, and the VMs work like real computers, operating systems and application programs can be installed on the VMs, and the VMs can also access network resources. For applications running in a VM, the VM behaves as if it were a true computer. The virtualization technology is one of the bottom important support technologies of the currently popular Cloud Computing (Cloud Computing) platform, and can greatly improve the resource utilization efficiency of the physical equipment. Compared with the traditional physical computer, the VM has better isolation and encapsulation,
disk image (disk image) is a separate file that holds the entire content and structure representing one storage medium or device, makes a sector-to-sector copy of the source storage medium, and is able to perfectly replicate the structure and content of the device. And the virtualization software maps the corresponding disk mirror image into a disk of the virtual machine through a corresponding disk driver, and all read-write of the internal file of the VM can be driven in the running process of the VM and finally converted into read-write of the disk mirror image. The disk image contains Metadata (Metadata) besides all data of the storage medium or device, wherein the Metadata is defined as information providing of 1 or more aspects of the data, data (data about data) describing the data, such as creation time, creator and data meaning of the data, and the like, and is used for self data management, and fast data reading and higher-level storage characteristic realization of the disk image by a driver are realized. And the disk mirror image is used in combination with a driver under a virtualization platform, so that high-level characteristics such as thin distribution, snapshot and the like can be realized. The storage area in the disk image is divided in the form of blocks, and each block can correspond to a plurality of sectors.
The existing mainstream disk mirroring technology is uniformly fixed for the block size. The inventor of the invention finds that the disk mirror image adopts a uniform fixed block size in research and practice processes, and influences the data read-write performance of the disk mirror image in some scenes and influences the utilization rate of a storage space in some scenes.
Disclosure of Invention
The embodiment of the invention provides a block adjustment method of a disk mirror image, a disk mirror image creation method and related equipment, so as to improve the data read-write performance and the storage space utilization rate of the disk mirror image.
The first aspect of the present invention provides a method for adjusting a block of a disk image, including:
receiving an adjusting instruction for the size of a first disk mirror image block;
creating a second disk image, wherein the block size of the second disk image is the block size indicated by the adjusting instruction;
and copying the data stored in the first disk image to the second disk image.
With reference to the first aspect, in a first possible implementation,
before the receiving the instruction for adjusting the size of the first disk mirror block, the method further includes:
receiving a disk mirror image creating instruction; creating a first disk image, wherein the capacity of the first disk image is the capacity indicated by the disk image creating instruction, and the block size of the first disk image and the capacity meet a preset corresponding relationship;
or,
receiving a disk mirror image creating instruction; and creating a first disk image, wherein the capacity of the first disk image is the capacity indicated by the disk image creating instruction, and the block size of the first disk image is the block size indicated by the disk image creating instruction.
With reference to the first aspect or the first possible implementation manner of the first aspect, in a second possible implementation manner, if the capacity of the first disk image is equal to S bytes, the block size of the first disk image is equal to 2mByte, wherein, 2n-1<S≤2nAnd m is more than or equal to 9 and less than or equal to n-17, wherein n and m are positive integers.
With reference to the first aspect, the first possible implementation manner of the first aspect, or the second possible implementation manner of the first aspect, in a third possible implementation manner, after the receiving the instruction to adjust the size of the first disk mirror block, the method further includes: before the first disk image is closed, if a write operation instruction indicating that first data is written into the first disk image is received and the data stored in the first disk image is not copied to the second disk image, respectively writing the first data into the first disk image and the second disk image.
With reference to the first aspect, or the first possible implementation manner of the first aspect, or the second possible implementation manner of the first aspect, or the third possible implementation manner of the first aspect, in a fourth possible implementation manner, when a first virtual machine is shutdown, where the first virtual machine is a virtual machine that uses the first disk image, if data stored in the first disk image has been copied to the second disk image, the second disk image is closed; if the data stored in the first disk image is not copied to the second disk image, the second disk image may be closed after the data stored in the first disk image is copied to the second disk image.
The second aspect of the present invention provides a disk image creating method, including:
receiving a disk mirror image creating instruction;
and creating a first disk image, wherein the capacity of the first disk image is the capacity indicated by the disk image creating instruction, and the block size of the first disk image and the capacity meet a preset corresponding relationship.
In combination with the second aspect, in a first possible embodiment,
if the capacity of the first disk image is equal to S bytes, the block size of the first disk image is equal to 2mByte, wherein, 2n-1<S≤2nAnd m is more than or equal to 9 and less than or equal to n-17, wherein n and m are positive integers.
The third aspect of the present invention provides a disk image creating method, including:
receiving a disk mirror image creating instruction;
and creating a first disk image, wherein the capacity of the first disk image is the capacity indicated by the disk image creating instruction, and the block size of the first disk image is the block size indicated by the disk image creating instruction.
A fourth aspect of the present invention provides a block adjusting apparatus for a disk image, which may include:
the receiving unit is used for receiving an adjusting instruction of the size of the first disk mirror image block;
the creating unit is used for creating a second disk mirror image, wherein the block size of the second disk mirror image is the block size indicated by the adjusting instruction;
and the data transfer unit is used for copying the data stored in the first disk image to the second disk image.
In combination with the fourth aspect, in a first possible embodiment,
the receiving unit is further configured to receive a disk mirror creation instruction before receiving an instruction to adjust the size of the first disk mirror block; the creating unit is further configured to create a first disk image, where the capacity of the first disk image is the capacity indicated by the disk image creating instruction, and a preset correspondence relationship is satisfied between the block size of the first disk image and the capacity.
Or,
the receiving unit is further configured to receive a disk mirror creation instruction before receiving an instruction to adjust the size of the first disk mirror block; the creating unit is further configured to create a first disk image, where a capacity of the first disk image is a capacity indicated by the disk image creating instruction, and a block size of the first disk image is a block size indicated by the disk image creating instruction.
With reference to the fourth aspect or the first possible implementation manner of the fourth aspect, in a second possible implementation manner, the apparatus further includes:
and the data reading and writing unit is used for respectively writing the first data into the first disk mirror image and the second disk mirror image if a writing operation instruction indicating that the first data is written into the first disk mirror image is received and the data stored in the first disk mirror image is not copied to the second disk mirror image after the receiving unit receives the adjustment instruction of the size of the first disk mirror image block and before the first disk mirror image is closed.
A fifth aspect of the present invention provides a disk image creating apparatus, which may include:
the receiving unit is used for receiving a disk mirror image creating instruction;
the device comprises a creating unit, a storage unit and a processing unit, wherein the creating unit is used for creating a first disk image, the capacity of the first disk image is the capacity indicated by a disk image creating instruction, and the block size of the first disk image and the capacity meet a preset corresponding relation.
In combination with the fifth aspect, in a first possible embodiment,
if the capacity of the first disk image is equal to S bytes, thenThe first disk image has a block size equal to 2mByte, wherein, 2n-1<S≤2nAnd m is more than or equal to 9 and less than or equal to n-17, wherein n and m are positive integers.
A sixth aspect of the present invention provides a disk image creating apparatus, which may include:
the receiving unit is used for receiving a disk mirror image creating instruction;
the creating unit is configured to create a first disk image, where a capacity of the first disk image is a capacity indicated by the disk image creating instruction, and a block size of the first disk image is a block size indicated by the disk image creating instruction.
As can be seen from the above, in the block adjustment scheme of the disk mirror image according to the embodiment of the present invention, after receiving the instruction for adjusting the block size of the first disk mirror image, the second disk mirror image is created according to the block size indicated by the instruction for adjusting; and copying the data stored in the first disk image to the created second disk image. The size of the disk mirror image block is adjusted according to the block size adjusting instruction as required, so that the size of the disk mirror image block is more flexible, the requirement of matching a specific scene better is facilitated, and the data reading and writing performance and the storage space utilization rate of the disk mirror image are further improved.
On the other hand, in the disk image creating scheme provided in this embodiment, after the disk image creating instruction is received, the first disk image is created according to the capacity indicated by the received disk image creating instruction, and a preset corresponding relationship is satisfied between the block size of the first disk image and the capacity of the first disk image. Because the disk mirror image with the corresponding capacity and the corresponding block size is created according to the indicated capacity and the block size corresponding to the capacity, the disk mirror image creation mechanism enables the block size of the created disk mirror image to be more flexible, which is beneficial to better matching the specific scene requirements and further beneficial to improving the data read-write performance and the storage space utilization rate of the disk mirror image.
In another aspect, in another disk image creation scheme provided in this embodiment, after receiving the disk image creation instruction, the first disk image is created according to the capacity and block size indicated by the received disk image creation instruction. Because the disk mirror image is created according to the indicated capacity and the indicated block size and according to the needs, the disk mirror image creation mechanism enables the block size of the created disk mirror image to be more flexible, which is beneficial to better matching the needs of specific scenes and further beneficial to improving the data read-write performance and the storage space utilization rate of the disk mirror image.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic flowchart of a block adjustment method for a disk image according to an embodiment of the present invention;
fig. 2 is a schematic flowchart of a method for creating a disk image according to an embodiment of the present invention;
fig. 3 is a flowchart illustrating another disk image creating method according to an embodiment of the present invention;
FIG. 4 is a flowchart illustrating another method for adjusting blocks of a disk image according to an embodiment of the present invention;
FIG. 5-a is a block adjustment apparatus for disk mirroring according to an embodiment of the present invention;
FIG. 5-b is a block adjustment apparatus for disk mirroring according to an embodiment of the present invention;
FIG. 5-c is a block adjustment apparatus for disk mirroring according to an embodiment of the present invention;
FIG. 6 is a schematic diagram of a computer provided by an embodiment of the invention;
fig. 7 is a schematic diagram of a disk image creating apparatus according to an embodiment of the present invention;
FIG. 8 is a schematic diagram of another computer provided by an embodiment of the present invention;
fig. 9 is a schematic diagram of another disk image creating apparatus according to an embodiment of the present invention;
FIG. 10 is a schematic diagram of another computer provided by an embodiment of the invention.
Detailed Description
The embodiment of the invention provides a disk image block adjusting method, a disk image creating method and related equipment, aiming at improving the data reading and writing performance and the storage space utilization rate of a disk image.
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The following are detailed below.
The terms "first," "second," "third," "fourth," and the like in the description and in the claims, as well as in the drawings, if any, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are, for example, capable of operation in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, or system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
An embodiment of the block adjustment method for a disk image in the present invention includes: receiving an adjusting instruction for the size of a first disk mirror image block; creating a second disk image, wherein the block size of the second disk image is the block size indicated by the adjusting instruction; and copying the data stored in the first disk image to the second disk image.
Referring to fig. 1, fig. 1 is a schematic flowchart of a block adjustment method for a disk image according to an embodiment of the present invention. As shown in fig. 1, a block adjustment method for a disk image according to an embodiment of the present invention may include the following steps:
101. receiving an adjusting instruction for the size of a first disk mirror image block;
in some embodiments of the invention, the received resize instruction for the first disk image block size may include a block size indication, where the block size indication may be used to indicate a target block size (e.g., 2MB bytes, 4MB, 8MB, or other block size) to be resized. The adjustment instruction for the size of the first disk image block may be issued by a disk image driver of the first disk image, or may be issued by a VM (for convenience of reference, it may be referred to as a first VM) using the first disk image, or may be issued by another object or a user. Further, the instruction for adjusting the block size of the first disk image may further include an identifier of the first disk image, but it may also be determined by other means that the block size of the first disk image is to be adjusted, for example, if the instruction for adjusting the block size of the first disk image is issued by the first VM using the first disk image, the instruction may be defaulted to be the instruction for adjusting the block size of the first disk image. Or if the adjustment instruction of the block size of the first disk image includes the identifier of the first VM using the first disk image, it may be determined that the block size of the first disk image is to be adjusted according to the identifier of the first VM, and so on.
In some embodiments of the present invention, before receiving the instruction to adjust the size of the first disk mirror block, the method may further include: receiving a disk mirror image creating instruction; and creating a first disk image, wherein the capacity of the first disk image is the capacity indicated by the disk image creating instruction, and the block size of the first disk image and the capacity meet a preset corresponding relationship.
For example, if the capacity of the first disk image is equal to S bytes, the block size of the first disk image is equal to 2mByte, wherein, 2n-1<S≤2nAnd m is more than or equal to 9 and less than or equal to n-17, wherein n and m are positive integers. Certainly, the block size and the capacity of the first disk image may also satisfy other preset corresponding relationships, which is not illustrated here, and the main purpose is to create the first disk image with the block size and the capacity matched with each other.
For example, if the capacity of the first disk image is less than or equal to 256GB, the block size of the first disk image may be equal to 2 MB; if the capacity of the first disk image is between 256GB and 512GB, the block size of the first disk image may be equal to 4 MB; if the capacity of the first disk image is between 512GB and 1TB, the block size of the first disk image may be equal to 8 MB; if the capacity of the first disk image is equal to between 1TB and 2TB, the block size of the first disk image can be equal to 16 MB; if the capacity of the first disk image is equal to between 2TB and 4TB, the block size of the first disk image may be equal to 32MB, and so on, although not limited to the exemplary correspondence.
In other embodiments of the present invention, before receiving the instruction to adjust the size of the first disk mirror block, the method may further include: receiving a disk mirror image creating instruction; and creating a first disk image, wherein the capacity of the first disk image is the capacity indicated by the disk image creating instruction, and the block size of the first disk image is the block size indicated by the disk image creating instruction.
In some embodiments of the present invention, after receiving the disk image creating instruction, it may further be determined whether the block size indicated by the disk image creating instruction is equal to the power x of 2, if not, a disk image creating failure instruction may be returned to indicate that the disk image cannot be created as needed, and if so, the step of creating the first disk image is performed.
In some embodiments of the present invention, after receiving the disk image creating instruction, it may further be determined whether a block size (for convenience of description, the indicated block size is used for B representation) indicated by the first disk image block size adjusting instruction is equal to x power of 2, and if so, the step of creating the first disk image is performed, where the block size of the first disk image created in this scenario is a block size of B bytes indicated by the disk image creating instruction; if not, and 2x-1<B<2xThen can be, for example, 2x-1Byte or 2xTaking bytes as the block size indicated by the adjusting instruction to execute the step of creating the first disk image, wherein the block size of the first disk image created in the scene is 2x-1Or 2xA byte. Wherein x is a natural number, and preferably x is 9 or more.
102. Creating a second disk image;
and the block size of the second disk image is the block size indicated by the adjusting instruction.
In some embodiments of the invention, the capacity of the created second disk image may be greater than or equal to the capacity of the first disk image.
In some embodiments of the present invention, after receiving the instruction for adjusting the size of the first disk mirror block, it may further be determined whether the block size indicated by the instruction for adjusting the size of the first disk mirror block is equal to the power x of 2, where x is a natural number, and x is preferably greater than or equal to 9; if not, returning a first disk image block size adjustment failure instruction to indicate that the block size cannot be adjusted as required, and if so, executing the step of creating the second disk image.
In other embodiments of the present invention, after receiving an instruction for adjusting the size of a first disk mirror block, it may be determined whether a block size B (for convenience of description, the indicated block size is used for B representation) indicated by the instruction for adjusting the size of the first disk mirror block is equal to the power of x of 2, and if so, a step of creating a second disk mirror image is performed, where the block size of the second disk mirror image created in this scenario is B bytes, which is the block size indicated by the instruction for creating a disk mirror image; if not, and 2x-1<B<2xThen can be, for example, 2x-1Byte or 2xAnd executing the step of creating the second disk image by taking bytes as the block size indicated by the adjusting instruction, wherein the block size of the second disk image created in the scene is 2x-1Or 2xA byte. Wherein x is a natural number, and preferably x is 9 or more.
103. And copying the data stored in the first disk image to the second disk image.
In some embodiments of the present invention, the data stored in the first disk image may be copied to the second disk image in a sector-to-sector copy manner. Further, after copying the data stored in the first disk image to the second disk image, the disk image used by the first VM using the first disk image may be converted into the second disk image, and the first disk image may be closed.
In some embodiments of the present invention, receiving an instruction to adjust the size of the first disk mirror block may further include: before the first disk image is closed, if a write operation instruction indicating that first data is written into the first disk image is received and the data stored in the first disk image is not copied to the second disk image (at this time, the first disk image is still in a block size adjustment state), the first data can be written into the first disk image and the second disk image respectively. For example, after receiving an instruction for adjusting the block size of the first disk image, an identifier of the first disk image and an indication of the block size adjustment state, etc. may be written into the image configuration file to identify that the current first disk image is in the block size adjustment state, and subsequently, it may be determined that the first disk image is still in the block size adjustment state according to the identifier of the first disk image and the indication of the block size adjustment state written into the image configuration file, and of course, it may also be identified whether the first disk image is in the block size adjustment state by other means. Further, after copying the data stored in the first disk image to the second disk image, a data copy completion identifier corresponding to the first disk image may be written into the image configuration file to identify that the size adjustment of the first disk image block is completed. And subsequently, determining that the block size adjustment of the first disk image is finished according to the data copy completion identifier, written in the image configuration file, corresponding to the first disk image.
In some embodiments of the present invention, when the first VM is powered off, if the data stored in the first disk image has been copied to the second disk image, the second disk image may be closed; if the data stored in the first disk image is not copied to the second disk image, the second disk image may be closed after the data stored in the first disk image is copied to the second disk image. The first VM is a VM using the first disk image. For example, if after copying the data stored in the first disk image to the second disk image, the data copy completion identifier corresponding to the first disk image is written into the image configuration file, the image configuration file may be read when the first VM is powered off, if the data copy completion identifier corresponding to the first disk image is written into the read image configuration file, it is determined that the data stored in the first disk image has been copied to the second disk image (that is, the size adjustment of the block of the first disk image has been completed), and if the data copy completion identifier corresponding to the first disk image is not written into the read image configuration file, it is determined that the data stored in the first disk image has not been copied to the second disk image (that is, the size adjustment of the block of the first disk image has not been completed). Of course, whether the first disk mirroring block size adjustment state has ended may be identified by other means.
It can be seen that, in the block adjustment scheme of the disk image in this embodiment, after receiving the instruction for adjusting the block size of the first disk image, the second disk image is created according to the block size indicated by the instruction for adjusting; and copying the data stored in the first disk image to the created second disk image. The size of the disk mirror image block is adjusted according to the block size adjusting instruction as required, so that the size of the disk mirror image block is more flexible, the requirement of matching a specific scene better is facilitated, and the data reading and writing performance and the storage space utilization rate of the disk mirror image are further improved.
An embodiment of the disk image creating method of the present invention, wherein a disk image creating method may include: receiving a disk mirror image creating instruction; and creating a first disk image, wherein the capacity of the first disk image is the capacity indicated by the disk image creating instruction, and the block size of the first disk image and the capacity meet a preset corresponding relationship.
Referring to fig. 2, fig. 2 is a schematic flowchart of a disk image creating method according to an embodiment of the present invention. As shown in fig. 2, a method for creating a disk image according to an embodiment of the present invention may include the following steps:
201. and receiving a disk image creating instruction.
In some embodiments of the invention, the received disk image creation instruction may include a disk image capacity indication indicating a target capacity of the requested disk image. The disk image creation instruction may be issued by a disk image drive, or may be issued by a VM (for convenience of reference, may be referred to as a first VM) that needs to use a disk image, or may be issued by another object or a user, for example.
202. And creating a first disk image, wherein the capacity of the first disk image is the capacity indicated by the disk image creating instruction, and the block size of the first disk image and the capacity meet a preset corresponding relationship.
In some embodiments of the present invention, the predetermined correspondence between the block size and the capacity of the first disk image may be as follows: if the capacity of the first disk image is equal to S bytes, the block size of the first disk image is equal to 2mByte, wherein, 2n-1<S≤2nAnd m is more than or equal to 9 and less than or equal to n-17, wherein n and m are positive integers. Certainly, the block size and the capacity of the first disk image may also satisfy other preset corresponding relationships, which is not illustrated here, and the main purpose is to create the first disk image with the block size and the capacity matched with each other.
For example, if the capacity of the first disk image is less than or equal to 256GB, the block size of the first disk image may be equal to 2 MB; if the capacity of the first disk image is between 256GB and 512GB, the block size of the first disk image may be equal to 4 MB; if the capacity of the first disk image is between 512GB and 1TB, the block size of the first disk image may be equal to 8 MB; if the capacity of the first disk image is equal to between 1TB and 2TB, the block size of the first disk image can be equal to 16 MB; if the capacity of the first disk image is equal to between 2TB and 4TB, the block size of the first disk image may be equal to 32MB, and so on, although not limited to the exemplary correspondence.
It can be seen that, in the disk image creating scheme of this embodiment, after the disk image creating instruction is received, the first disk image is created according to the capacity indicated by the received disk image creating instruction, and a preset corresponding relationship is satisfied between the block size of the first disk image and the capacity of the first disk image. Because the disk mirror image with the corresponding capacity and the corresponding block size is created according to the indicated capacity and the block size corresponding to the capacity, the disk mirror image creation mechanism enables the block size of the created disk mirror image to be more flexible, which is beneficial to better matching the specific scene requirements and further beneficial to improving the data read-write performance and the storage space utilization rate of the disk mirror image.
Another embodiment of the disk image creating method of the present invention, wherein another disk image creating method may include: receiving a disk mirror image creating instruction; and creating a first disk image, wherein the capacity of the first disk image is the capacity indicated by the disk image creating instruction, and the block size of the first disk image is the block size indicated by the disk image creating instruction.
Referring to fig. 3, fig. 3 is a schematic flowchart of another disk image creating method according to an embodiment of the present invention. As shown in fig. 3, another disk image creating method provided by the embodiment of the present invention may include the following steps:
301. and receiving a disk image creating instruction.
In some embodiments of the invention, the received disk image creation instruction may include a disk image capacity indication and a block size indication, wherein the disk image capacity indication indicates a target capacity of the requested disk image; the block size indication may be used to indicate a target block size to be adjusted. The disk image creation instruction may be issued by a disk image drive, or may be issued by a VM (for convenience of reference, may be referred to as a first VM) that needs to use a disk image to be created, or may be issued by another object or a user, for example.
302. And creating a first disk image, wherein the capacity of the first disk image is the capacity indicated by the disk image creating instruction, and the block size of the first disk image is the block size indicated by the disk image creating instruction.
In some embodiments of the present invention, after receiving the disk image creating instruction, it may further be determined whether the block size indicated by the disk image creating instruction is equal to the power x of 2, if not, a disk image creating failure instruction may be returned to indicate that the disk image cannot be created as needed, and if so, the step of creating the first disk image is performed.
In the present inventionIn other embodiments, after receiving the disk image creating instruction, it may further be determined whether a block size indicated by the first disk image block size adjusting instruction (for convenience of description, the indicated block size is denoted by B) is equal to x power of 2, and if so, the step of creating the first disk image is performed, where the block size of the first disk image created in this scenario is B bytes, which is the block size indicated by the disk image creating instruction; if not, and 2x-1<B<2xThen can be, for example, 2x-1Byte or 2xTaking bytes as the block size indicated by the adjusting instruction to execute the step of creating the first disk image, wherein the block size of the first disk image created in the scene is 2x-1Or 2xA byte. Wherein x is a natural number, and preferably x is 9 or more.
It can be seen that, in the disk image creation scheme of this embodiment, after receiving the disk image creation instruction, the first disk image is created according to the capacity and the block size indicated by the received disk image creation instruction. Because the disk mirror image is created according to the indicated capacity and the indicated block size and according to the needs, the disk mirror image creation mechanism enables the block size of the created disk mirror image to be more flexible, which is beneficial to better matching the needs of specific scenes and further beneficial to improving the data read-write performance and the storage space utilization rate of the disk mirror image.
To facilitate a better understanding and an implementation of the above-described aspects of the embodiments of the present invention, some application scenarios are described below.
Referring to fig. 4, fig. 4 is a schematic flowchart of another block adjustment method for a disk image according to an embodiment of the present invention. As shown in fig. 4, another block adjustment method for a disk image according to an embodiment of the present invention may include the following steps:
401. the disk mirror image drive receives an adjustment instruction for the size of a disk mirror image A block;
wherein, it is assumed that the disk image a is currently used by the first VM in operation.
In some embodiments of the invention, the received resize instruction for a disk image a block size may include a block size indication, where the block size indication may be used to indicate a target block size (e.g., 2MB bytes, 4MB, 8MB, or other block size) to be resized.
402. The disk mirror image drive judges whether the size of a target block is equal to x power bytes of 2 or not;
wherein x is a natural number, and x is preferably greater than or equal to 9;
if yes, go to step 403;
if not, go to step 404.
403. The disk image drive prompts that the block size of disk image a cannot be adjusted as needed.
404. And the disk image driver writes the path, the name and the block adjustment state indication of the disk image A into the image configuration file.
405. Creating a disk mirror image B;
and the block size of the disk image B is the block size indicated by the adjusting instruction, and the capacity of the disk image B is greater than or equal to the capacity of the disk image A.
406. And the disk image drive starts a data copying thread to copy the sectors from the disk image A to the disk image B.
In particular, when the corresponding sector of the disk image B is found to be already in use, the copying of data to the sector of the disk image B (because the data in the sector of the disk image B may be the latest data) may be skipped, and the copying of data of other sectors may be continued.
407. And after the sector copy from the disk image A to the disk image B is finished, the disk image drive converts the disk image used by the first VM into the disk image B. And the disk image drive writes a data copy completion identifier corresponding to the disk image A in the image configuration file to identify that the block size adjustment of the disk image A is finished. The disk image drive may also shut down disk image a.
In some embodiments of the present invention, before the disk image a is closed, if the disk image drive receives a write operation instruction indicating to write the first data into the disk image a and the data stored in the disk image a is not yet copied to the disk image B (at this time, the disk image a is still in the block size adjustment state), the first data may be written into the disk image a and the disk image B, respectively.
In some embodiments of the present invention, when the first VM is powered off, if the data stored in the disk image a has been copied to the disk image B (for example, the data copy completion identifier corresponding to the disk image a is written in the image configuration file), the disk image B may be turned off; if the data stored in the disk image a has not been copied to the disk image B (for example, the path, name, and block adjustment status indication written to the disk image a is written in the image configuration file, but the data copy completion identifier corresponding to the disk image a has not been written), the disk image B may be closed after the data stored in the disk image a has been copied to the disk image B.
For the condition that the first VM is in a standby state or a ready-to-shutdown state, the first VM usually does not write data into the disk image in this state, and if the block size of the disk image is adjusted at this time, the maintenance of the image configuration file may not be required.
It is understood that the above application scenarios are only examples, and in practical applications, adaptive adjustment may be performed according to different schemes of the application scenarios.
To facilitate a better implementation of the above-described aspects of embodiments of the present invention, the following also provides relevant means for implementing the above-described aspects.
Referring to fig. 5-a, fig. 5-a is a schematic diagram of a disk image block adjustment apparatus 500 according to an embodiment of the present invention, where the disk image block adjustment apparatus 500 may include: a receiving unit 510, a creating unit 520, and a data transferring unit 530.
The receiving unit 510 receives an instruction for adjusting the size of the first disk image block.
In some embodiments of the invention, the resize instruction for the first disk image block size received by receiving unit 510 may include a block size indication, where the block size indication may be used to indicate a target block size (e.g., 2MB bytes, 4MB, 8MB, or other block size) to be resized. The adjustment instruction for the size of the first disk image block may be issued by a disk image driver of the first disk image, or may be issued by a VM (for convenience of reference, it may be referred to as a first VM) using the first disk image, or may be issued by another object or a user. Further, the instruction for adjusting the block size of the first disk image may further include an identifier of the first disk image, but it may also be determined by other means that the block size of the first disk image is to be adjusted, for example, if the instruction for adjusting the block size of the first disk image is issued by the first VM using the first disk image, the instruction may be defaulted to be the instruction for adjusting the block size of the first disk image. Or if the adjustment instruction of the block size of the first disk image includes the identifier of the first VM using the first disk image, it may be determined that the block size of the first disk image is to be adjusted according to the identifier of the first VM, and so on.
And a creating unit 520, configured to create a second disk image, where a block size of the second disk image is the block size indicated by the foregoing adjusting instruction.
A data transfer unit 530, configured to copy the data stored in the first disk image to the second disk image.
In some embodiments of the present invention, the receiving unit 510 may be further configured to receive a disk image creating instruction before receiving the adjusting instruction for the size of the first disk image block; the creating unit 520 may be further configured to create a first disk image, where a capacity of the first disk image is a capacity indicated by the disk image creating instruction, and a preset corresponding relationship is satisfied between a block size of the first disk image and the capacity.
For example, if the capacity of the first disk image is equal to S bytes, the block size of the first disk image is equal to 2mByte, wherein, 2n-1<S≤2nAnd m is more than or equal to 9 and less than or equal to n-17, wherein n and m are positive integers. Certainly, the block size and the capacity of the first disk image may also satisfy other preset corresponding relationships, which is not illustrated here, and the main purpose is to match the block size and the capacity of the created first disk image.
In other embodiments of the present invention, the receiving unit 510 may be further configured to receive a disk image creating instruction before receiving the instruction to adjust the size of the first disk image block; the creating unit 520 is further configured to create a first disk image, where a capacity of the first disk image is a capacity indicated by the disk image creating instruction, and a block size of the first disk image is a block size indicated by the disk image creating instruction.
In some embodiments of the present invention, after the receiving unit 510 receives the disk image creating instruction, the creating unit 520 may first determine whether the block size indicated by the disk image creating instruction is equal to x power of 2, if not, may return a disk image creating failure instruction to indicate that the disk image cannot be created as needed, and if so, create the first disk image.
In some other embodiments of the present invention, after the receiving unit 510 receives the disk image creating instruction, the creating unit 520 may further determine whether a block size (for convenience of description, the indicated block size is used for B representation) indicated by the first disk image block size adjusting instruction is equal to x power of 2, and if so, create the first disk image, where the block size of the first disk image created in this scenario is B bytes, which is the block size indicated by the disk image creating instruction; if not, and 2x-1<B<2xThen can be, for example, 2x-1Byte or 2xBytes are used as the block size indicated by the adjusting instruction to create the first disk image, and the block size of the first disk image created in the scene is 2x-1Or 2xA byte. Wherein x is a natural number, and preferably x is 9 or more.
Referring to fig. 5-b, in other embodiments of the present invention, a disk mirrored block alignment apparatus 500 may further include: the data reading and writing unit 540 is configured to, after the receiving unit 510 receives the instruction for adjusting the size of the first disk mirror block and before the first disk mirror is closed, if a write operation instruction indicating that first data is written to the first disk mirror is received and the data stored in the first disk mirror is not copied to the second disk mirror, respectively write the first data to the first disk mirror and the second disk mirror.
Referring to fig. 5-c, in other embodiments of the present invention, a disk mirrored block alignment apparatus 500 may further include: the management unit 550 is configured to, when the first virtual machine is powered off, close the second disk image if the first virtual machine is a virtual machine using the first disk image and data stored in the first disk image has been copied to the second disk image; if the data stored in the first disk image is not copied to the second disk image, the second disk image may be closed after the data stored in the first disk image is copied to the second disk image.
For example, after receiving the adjustment instruction of the block size of the first disk image, the management unit 550 may identify that the current first disk image is in the block size adjustment state by writing an identifier of the first disk image and an indication of the block size adjustment state into the image configuration file, and then may determine that the first disk image is still in the block size adjustment state according to the identifier of the first disk image and the indication of the block size adjustment state written into the image configuration file, or of course, may identify whether the first disk image is in the block size adjustment state by other means. Further, after the data transfer unit 530 copies the data stored in the first disk image to the second disk image, the management unit 550 may write a data copy completion identifier corresponding to the first disk image into the image configuration file to identify that the size adjustment of the first disk image block is completed. And subsequently, determining that the block size adjustment of the first disk image is finished according to the data copy completion identifier, written in the image configuration file, corresponding to the first disk image.
If the management unit 550 writes the data copy completion identifier corresponding to the first disk image into the image configuration file after copying the data stored in the first disk image to the second disk image, the management unit 550 may read the image configuration file when the first VM is powered off, determine that the data stored in the first disk image has been copied to the second disk image (that is, the size adjustment of the block of the first disk image has been completed) if the data copy completion identifier corresponding to the first disk image is written into the read image configuration file, and determine that the data stored in the first disk image has not been copied to the second disk image (that is, the size adjustment of the block of the first disk image has not been completed) if the data copy completion identifier corresponding to the first disk image is not written into the read image configuration file. Of course, the management unit 550 may identify whether the first disk mirroring block size adjustment state has ended in other ways.
It can be understood that the functions of the functional modules of the block adjustment apparatus 500 for a disk image in this embodiment may be specifically implemented according to the method in the foregoing method embodiment, and the specific implementation process may refer to the related description of the foregoing method embodiment, which is not described herein again.
Referring to fig. 6, fig. 6 is a schematic diagram of a computer 600 according to an embodiment of the present invention, the computer 600 may include an input device 610, an output device 620, a memory 630, and a processor 640 (the number of the processors 640 in the computer may be 1 or more, and 1 processor is taken as an example in fig. 6). In some embodiments of the present invention, the input device 610, the output device 620, the memory 630 and the processor 640 may be connected by a bus or other means, wherein the bus connection is taken as an example in fig. 6.
Wherein, the processor 640 executes the following steps:
receiving an adjusting instruction for the size of a first disk mirror image block; creating a second disk mirror image, wherein the block size of the second disk mirror image is the block size indicated by the adjusting instruction; and copying the data stored in the first disk image to the second disk image.
In some embodiments of the invention, the resize instruction received by the processor 640 for the first disk image block size may include a block size indication, where the block size indication may be used to indicate a target block size (e.g., 2MB bytes, 4MB, 8MB, or other block size) to be resized. The adjustment instruction for the size of the first disk image block may be issued by a disk image driver of the first disk image, or may be issued by a VM (for convenience of reference, it may be referred to as a first VM) using the first disk image, or may be issued by another object or a user. Further, the instruction for adjusting the block size of the first disk image may further include an identifier of the first disk image, but it may also be determined by other means that the block size of the first disk image is to be adjusted, for example, if the instruction for adjusting the block size of the first disk image is issued by the first VM using the first disk image, the instruction may be defaulted to be the instruction for adjusting the block size of the first disk image. Or if the adjustment instruction for the block size of the first disk image includes the identifier of the first VM using the first disk image, the processor 640 may determine that the block size of the first disk image is to be adjusted according to the identifier of the first VM, and so on.
In some embodiments of the invention, processor 640 may further perform the following steps prior to receiving the resize instruction for the first disk image block:
receiving a disk mirror image creating instruction; and creating a first disk image, wherein the capacity of the first disk image is the capacity indicated by the disk image creating instruction, and the block size of the first disk image and the capacity meet a preset corresponding relationship.
For example, if the capacity of the first disk image is equal to S bytes, the block size of the first disk image is equal to 2mByte, wherein, 2n-1<S≤2nAnd m is more than or equal to 9 and less than or equal to n-17, wherein n and m are positive integers. Certainly, the block size and the capacity of the first disk image may also satisfy other preset corresponding relationships, which is not illustrated here, and the main purpose is to create the first disk image with the block size and the capacity matched with each other.
In other embodiments of the invention, the processor 640 may further perform the following steps before receiving the instruction to resize the first disk image block:
receiving a disk mirror image creating instruction; and creating a first disk image, wherein the capacity of the first disk image is the capacity indicated by the disk image creating instruction, and the block size of the first disk image is the block size indicated by the disk image creating instruction.
In some embodiments of the present invention, after receiving the disk image creating instruction, the processor 640 may first determine whether a block size indicated by the disk image creating instruction is equal to x power of 2, if not, may return a disk image creating failure instruction to indicate that the disk image cannot be created as needed, and if so, execute the step of creating the first disk image.
In some embodiments of the present invention, after receiving the disk image creating instruction, the processor 640 may first determine whether a block size (for convenience of description, the indicated block size is indicated by B) indicated by the first disk image block size adjusting instruction is equal to x power of 2, and if so, execute a step of creating the first disk image, where the block size of the first disk image created in this scenario is B bytes, which is the block size indicated by the disk image creating instruction; if not, and 2x-1<B<2xThen can be, for example, 2x-1Byte or 2xTaking bytes as the block size indicated by the adjusting instruction to execute the step of creating the first disk image, wherein the block size of the first disk image created in the scene is 2x-1Or 2xA byte. Wherein x is a natural number, and preferably x is 9 or more.
In some embodiments of the present invention, the processor 640 may copy the data stored in the first disk image to the second disk image in a sector-to-sector copy manner. Further, after copying the data stored in the first disk image to the second disk image, the disk image used by the first VM using the first disk image may be converted into the second disk image, and the first disk image may be closed.
In some embodiments of the present invention, after the processor 640 receives the instruction to adjust the size of the first disk mirror block, the method may further include: before the first disk image is closed, if a write operation instruction indicating that first data is written into the first disk image is received and the data stored in the first disk image is not copied to the second disk image (at this time, the first disk image is still in a block size adjustment state), the first data can be written into the first disk image and the second disk image respectively. For example, after receiving an instruction for adjusting the block size of the first disk image, the processor 640 may identify that the current first disk image is in the block size adjustment state by writing an identifier of the first disk image and an indication of the block size adjustment state into the image configuration file, and the subsequent processor 640 may determine that the first disk image is still in the block size adjustment state according to the identifier of the first disk image and the indication of the block size adjustment state written into the image configuration file, and of course, may also identify whether the first disk image is in the block size adjustment state by other means. Further, after copying the data stored in the first disk image to the second disk image, the processor 640 may write a data copy completion identifier corresponding to the first disk image into the image configuration file to identify that the size adjustment of the first disk image block is completed. The subsequent processor 640 may determine that the block size adjustment of the first disk image has ended according to the data copy completion identifier, written in the image configuration file, corresponding to the first disk image.
In some embodiments of the present invention, when the first VM is powered off, if the data stored in the first disk image has been copied to the second disk image, the processor 640 may close the second disk image; if the data stored in the first disk image has not been copied to the second disk image, the processor 640 may close the second disk image after the data stored in the first disk image is copied to the second disk image. Wherein the first VM is a VM that uses the first disk image.
It can be understood that the functions of the functional modules of the computer 600 in this embodiment may be specifically implemented according to the method in the foregoing method embodiment, and the specific implementation process may refer to the related description of the foregoing method embodiment, which is not described herein again.
Referring to fig. 7, fig. 7 is a schematic structural diagram of a disk image creating apparatus 700 according to an embodiment of the present invention, where the disk image creating apparatus 700 may include:
a receiving unit 710 and a creating unit 720.
The receiving unit 710 is configured to receive a disk image creation instruction.
In some embodiments of the present invention, the disk image creating instruction received by the receiving unit 710 may include a disk image capacity indication, where the disk image capacity indication indicates a target capacity of the requested disk image. The disk image creation instruction may be issued by a disk image drive, or may be issued by a VM (for convenience of reference, may be referred to as a first VM) that needs to use a disk image, or may be issued by another object or a user, for example.
The creating unit 720 is configured to create a first disk image, where the capacity of the first disk image is the capacity indicated by the disk image creating instruction, and a preset corresponding relationship is satisfied between the block size of the first disk image and the capacity.
In some embodiments of the present invention, the predetermined correspondence between the block size and the capacity of the first disk image may be as follows: if the capacity of the first disk image is equal to S bytes, the block size of the first disk image is equal to 2mByte, wherein, 2n-1<S≤2nAnd m is more than or equal to 9 and less than or equal to n-17, wherein n and m are positive integers. When in useHowever, the block size and the capacity of the first disk image may also satisfy other preset corresponding relationships, which are not illustrated herein, and the main purpose is to create a first disk image with a block size and a capacity that match each other.
It can be understood that the functions of the functional modules of the disk image creating apparatus 700 in this embodiment may be specifically implemented according to the method in the foregoing method embodiment, and the specific implementation process may refer to the related description of the foregoing method embodiment, which is not described herein again.
Referring to fig. 8 and fig. 8 are schematic diagrams of a computer 800 according to an embodiment of the present invention, the computer 800 may include an input device 810, an output device 820, a memory 830 and a processor 840 (the number of the processors 840 in the computer may be 1 or more, and 1 processor is taken as an example in fig. 8). In some embodiments of the invention, the input device 810, the output device 820, the memory 830 and the processor 840 may be connected by a bus or other means, wherein the connection by a bus is exemplified in fig. 8.
Wherein processor 840 performs the following steps:
receiving a disk mirror image creating instruction; and creating a first disk image, wherein the capacity of the first disk image is the capacity indicated by the disk image creating instruction, and the block size of the first disk image and the capacity meet a preset corresponding relationship.
In some embodiments of the invention, the disk image creation instruction received by processor 840 may include a disk image capacity indication indicating a target capacity for the requested disk image. The disk image creation instruction may be issued by a disk image drive, or may be issued by a VM (for convenience of reference, may be referred to as a first VM) that needs to use a disk image, or may be issued by another object or a user, for example.
In some embodiments of the present invention, the predetermined correspondence between the block size and the capacity of the first disk image may be as follows: if it is firstThe capacity of a disk image is equal to S bytes, and the block size of the first disk image is equal to 2mByte, wherein, 2n-1<S≤2nAnd m is more than or equal to 9 and less than or equal to n-17, wherein n and m are positive integers. Certainly, the block size and the capacity of the first disk image may also satisfy other preset corresponding relationships, which is not illustrated here, and the main purpose is to match the block size and the capacity of the created first disk image.
It can be understood that the functions of the functional modules of the computer 800 in this embodiment may be specifically implemented according to the method in the foregoing method embodiment, and the specific implementation process may refer to the related description of the foregoing method embodiment, which is not described herein again.
Referring to fig. 9, fig. 9 is a schematic diagram of another disk image creating apparatus 900 according to an embodiment of the present invention, where the disk image creating apparatus 900 may include: a receiving unit 910 and a creating unit 920.
The receiving unit 910 is configured to receive a disk image creating instruction.
In some embodiments of the present invention, the disk image creating instruction received by the receiving unit 910 may include a disk image capacity indication and a block size indication, where the disk image capacity indication indicates a target capacity of the requested disk image; the block size indication may be used to indicate a target block size to be adjusted. The disk image creation instruction may be issued by a disk image drive, or may be issued by a VM (for convenience of reference, may be referred to as a first VM) that needs to use a disk image to be created, or may be issued by another object or a user, for example.
The creating unit 920 is configured to create a first disk image, where a capacity of the first disk image is a capacity indicated by the disk image creating instruction, and a block size of the first disk image is a block size indicated by the disk image creating instruction.
In some embodiments of the present invention, after the receiving unit 910 receives the disk image creating instruction, the creating unit 920 may further determine whether the block size indicated by the disk image creating instruction is equal to x power of 2, if not, return a disk image creating failure instruction (to indicate that the disk image cannot be created as needed), and if so, create the first disk image.
In other embodiments of the present invention, after the receiving unit 910 receives the disk image creating instruction, the creating unit 920 may determine whether a block size (for convenience of description, the indicated block size is used for B representation) indicated by the first disk image block size adjusting instruction is equal to x times of 2, and if so, create the first disk image, where the block size of the first disk image created in this scenario is B bytes of the block size indicated by the disk image creating instruction; if not, and 2x-1<B<2xThen can be, for example, 2x-1Byte or 2xBytes are used as the block size indicated by the adjusting instruction to create the first disk image, and the block size of the first disk image created in the scene is 2x-1Or 2xA byte. Wherein x is a natural number, and preferably x is 9 or more.
It can be understood that the functions of the functional modules of the disk image creating apparatus 900 in this embodiment may be specifically implemented according to the method in the foregoing method embodiment, and the specific implementation process may refer to the related description of the foregoing method embodiment, which is not described herein again.
Referring to fig. 10, fig. 10 is a schematic diagram of a computer 1000 according to an embodiment of the present invention, where the computer 1000 may include an input device 1010, an output device 1020, a memory 1030, and a processor 1040 (the number of the processors 1040 in the computer may be 1 or more, and 1 processor is taken as an example in fig. 10). In some embodiments of the invention, the input device 1010, the output device 1020, the memory 1030, and the processor 1040 may be connected by a bus or other means, wherein the bus connection is exemplified in fig. 10.
Wherein, processor 1040 performs the following steps:
receiving a disk mirror image creating instruction; and creating a first disk image, wherein the capacity of the first disk image is the capacity indicated by the disk image creating instruction, and the block size of the first disk image is the block size indicated by the disk image creating instruction.
In some embodiments of the present invention, the disk image creating instruction received by processor 1040 may include a disk image capacity indication and a block size indication, where the disk image capacity indication indicates a target capacity of the requested disk image; the block size indication may be used to indicate a target block size to be adjusted. The disk image creation instruction may be issued by a disk image drive, or may be issued by a VM (for convenience of reference, may be referred to as a first VM) that needs to use a disk image to be created, or may be issued by another object or a user, for example.
In some embodiments of the present invention, after receiving the disk image creating instruction, processor 1040 may further determine whether a block size indicated by the disk image creating instruction is equal to x power of 2, if not, may return a disk image creating failure instruction to indicate that the disk image cannot be created as needed, and if so, execute the step of creating the first disk image.
In other embodiments of the present invention, after receiving the disk image creating instruction, the processor 1040 may further determine whether a block size (for convenience of description, the indicated block size is indicated by B) indicated by the first disk image block size adjusting instruction is equal to x power of 2, and if so, execute the step of creating the first disk image, where the block size of the first disk image created in this scenario is B bytes, which is the block size indicated by the disk image creating instruction; if not, and 2x-1<B<2xThen can be, for example, 2x-1Byte or 2xTaking bytes as the block size indicated by the adjusting instruction to execute the step of creating the first disk image, wherein the block size of the first disk image created in the scene is 2x-1Or 2xA byte. Wherein x is a natural number, x is greater than or equal toIt is preferably at 9.
It can be understood that the functions of the functional modules of the computer 1000 in this embodiment may be specifically implemented according to the method in the foregoing method embodiment, and the specific implementation process may refer to the relevant description of the foregoing method embodiment, which is not described herein again.
An embodiment of the present invention further provides a computer storage medium, where the computer storage medium may store a program, and the program includes, when executed, some or all of the steps of the block adjustment method of the disk image or the disk image creation method described in the foregoing method embodiments.
It should be noted that, for simplicity of description, the above-mentioned method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the present invention is not limited by the order of acts, as some steps may occur in other orders or concurrently in accordance with the invention. Further, those skilled in the art should also appreciate that the embodiments described in the specification are preferred embodiments and that the acts and modules referred to are not necessarily required by the invention.
In the foregoing embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus may be implemented in other manners. For example, the above-described embodiments of the apparatus are merely illustrative, and for example, the above-described division of the units is only one type of division of logical functions, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection of some interfaces, devices or units, and may be an electric or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit may be stored in a computer-readable storage medium if it is implemented in the form of a software functional unit and sold or used as a separate product. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the above methods according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic or optical disk, and other various media capable of storing program codes.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present invention, and not for limiting the same; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.
Claims (14)
1. A block adjustment method of a disk image is characterized by comprising the following steps:
receiving an adjusting instruction for the size of a first disk mirror image block;
creating a second disk image, wherein the block size of the second disk image is the block size indicated by the adjusting instruction;
and copying the data stored in the first disk image to the second disk image.
2. The method of claim 1,
before the receiving the instruction for adjusting the size of the first disk mirror block, the method further includes:
receiving a disk mirror image creating instruction; creating a first disk image, wherein the capacity of the first disk image is the capacity indicated by the disk image creating instruction, and the block size of the first disk image and the capacity meet a preset corresponding relationship;
or,
receiving a disk mirror image creating instruction; and creating a first disk image, wherein the capacity of the first disk image is the capacity indicated by the disk image creating instruction, and the block size of the first disk image is the block size indicated by the disk image creating instruction.
3. The method of claim 2,
if the capacity of the first disk image is equal to S bytes, the block size of the first disk image is equal to 2mByte, wherein, 2n-1<S≤2nAnd m is more than or equal to 9 and less than or equal to n-17, wherein n and m are positive integers.
4. The method according to any one of claims 1 to 3,
after the receiving the instruction for adjusting the size of the first disk mirror block, the method further includes:
before the first disk image is closed, if a write operation instruction indicating that first data is written into the first disk image is received and the data stored in the first disk image is not copied to the second disk image, respectively writing the first data into the first disk image and the second disk image.
5. The method according to any one of claims 1 to 4,
when a first virtual machine is shut down, wherein the first virtual machine is a virtual machine using the first disk image, and if the data stored in the first disk image is copied to the second disk image, the second disk image is closed; if the data stored in the first disk image is not copied to the second disk image, the second disk image may be closed after the data stored in the first disk image is copied to the second disk image.
6. A disk image creation method is characterized by comprising the following steps:
receiving a disk mirror image creating instruction;
and creating a first disk image, wherein the capacity of the first disk image is the capacity indicated by the disk image creating instruction, and the block size of the first disk image and the capacity meet a preset corresponding relationship.
7. The method of claim 6,
if the capacity of the first disk image is equal to S bytes, the block size of the first disk image is equal to 2mByte, wherein, 2n-1<S≤2nAnd m is more than or equal to 9 and less than or equal to n-17, wherein n and m are positive integers.
8. A disk image creation method is characterized by comprising the following steps:
receiving a disk mirror image creating instruction;
and creating a first disk image, wherein the capacity of the first disk image is the capacity indicated by the disk image creating instruction, and the block size of the first disk image is the block size indicated by the disk image creating instruction.
9. A block adjusting apparatus for a disk image, comprising:
the receiving unit is used for receiving an adjusting instruction of the size of the first disk mirror image block;
the creating unit is used for creating a second disk mirror image, wherein the block size of the second disk mirror image is the block size indicated by the adjusting instruction;
and the data transfer unit is used for copying the data stored in the first disk image to the second disk image.
10. The apparatus of claim 9,
the receiving unit is further configured to receive a disk mirror creation instruction before receiving an instruction to adjust the size of the first disk mirror block; the creating unit is further configured to create a first disk image, where the capacity of the first disk image is the capacity indicated by the disk image creating instruction, and a preset correspondence relationship is satisfied between the block size of the first disk image and the capacity.
Or,
the receiving unit is further configured to receive a disk mirror creation instruction before receiving an instruction to adjust the size of the first disk mirror block; the creating unit is further configured to create a first disk image, where a capacity of the first disk image is a capacity indicated by the disk image creating instruction, and a block size of the first disk image is a block size indicated by the disk image creating instruction.
11. The apparatus of claim 9 or 10,
the device further comprises:
and the data reading and writing unit is used for respectively writing the first data into the first disk mirror image and the second disk mirror image if a writing operation instruction indicating that the first data is written into the first disk mirror image is received and the data stored in the first disk mirror image is not copied to the second disk mirror image after the receiving unit receives the adjustment instruction of the size of the first disk mirror image block and before the first disk mirror image is closed.
12. A disk image creating apparatus, comprising:
the receiving unit is used for receiving a disk mirror image creating instruction;
the device comprises a creating unit, a storage unit and a processing unit, wherein the creating unit is used for creating a first disk image, the capacity of the first disk image is the capacity indicated by a disk image creating instruction, and the block size of the first disk image and the capacity meet a preset corresponding relation.
13. The apparatus of claim 12,
if the capacity of the first disk image is equal to S bytes, the block size of the first disk image is equal to 2mByte, wherein, 2n-1<S≤2nAnd m is more than or equal to 9 and less than or equal to n-17, wherein n and m are positive integers.
14. A disk image creating apparatus, comprising:
the receiving unit is used for receiving a disk mirror image creating instruction;
the creating unit is configured to create a first disk image, where a capacity of the first disk image is a capacity indicated by the disk image creating instruction, and a block size of the first disk image is a block size indicated by the disk image creating instruction.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201210504938.8A CN103853497A (en) | 2012-11-30 | 2012-11-30 | Disk mirror image block adjusting method, disk mirror image building method and relevant device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201210504938.8A CN103853497A (en) | 2012-11-30 | 2012-11-30 | Disk mirror image block adjusting method, disk mirror image building method and relevant device |
Publications (1)
Publication Number | Publication Date |
---|---|
CN103853497A true CN103853497A (en) | 2014-06-11 |
Family
ID=50861214
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201210504938.8A Pending CN103853497A (en) | 2012-11-30 | 2012-11-30 | Disk mirror image block adjusting method, disk mirror image building method and relevant device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN103853497A (en) |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20030191911A1 (en) * | 2002-04-03 | 2003-10-09 | Powerquest Corporation | Using disassociated images for computer and storage resource management |
CN1688981A (en) * | 2002-08-09 | 2005-10-26 | 网络装置公司 | Storage virtualization by layering virtual disk objects on a file system |
CN101446976A (en) * | 2008-12-26 | 2009-06-03 | 中兴通讯股份有限公司 | File storage method in distributed file system |
CN101556802A (en) * | 2009-05-25 | 2009-10-14 | 杭州华三通信技术有限公司 | RAID array transposing method and device thereof |
CN102662727A (en) * | 2012-04-05 | 2012-09-12 | 北京天地云箱科技有限公司 | Virtual machine creating method and virtual machine creating device |
-
2012
- 2012-11-30 CN CN201210504938.8A patent/CN103853497A/en active Pending
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20030191911A1 (en) * | 2002-04-03 | 2003-10-09 | Powerquest Corporation | Using disassociated images for computer and storage resource management |
CN1688981A (en) * | 2002-08-09 | 2005-10-26 | 网络装置公司 | Storage virtualization by layering virtual disk objects on a file system |
CN101446976A (en) * | 2008-12-26 | 2009-06-03 | 中兴通讯股份有限公司 | File storage method in distributed file system |
CN101556802A (en) * | 2009-05-25 | 2009-10-14 | 杭州华三通信技术有限公司 | RAID array transposing method and device thereof |
CN102662727A (en) * | 2012-04-05 | 2012-09-12 | 北京天地云箱科技有限公司 | Virtual machine creating method and virtual machine creating device |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US20230138736A1 (en) | Cluster file system-based data backup method and apparatus, and readable storage medium | |
DK3008600T3 (en) | Backup of a virtual machine from a storage snapshot | |
CN102331949B (en) | Methods for generating and restoring memory snapshot of virtual machine, device and system | |
US10831398B2 (en) | Storage device efficiency during data replication | |
US8990164B1 (en) | Systems and methods for performing incremental backups | |
CN102467408B (en) | Method and device for accessing data of virtual machine | |
JP5547727B2 (en) | System and method for tracking changes to volumes | |
CN103412822B (en) | Operation Nonvolatile memory and the method and relevant apparatus of data manipulation | |
US9792075B1 (en) | Systems and methods for synthesizing virtual hard drives | |
CN106062742A (en) | Systems and methods for improving snapshot performance | |
CN104040512A (en) | Method and device for processing storage space and non-volatile computer readable storage medium | |
US8468007B1 (en) | Emulating a peripheral mass storage device with a portable device | |
US8549223B1 (en) | Systems and methods for reclaiming storage space on striped volumes | |
US8930968B2 (en) | Method and driver for processing data in a virtualized environment | |
CN103631537A (en) | Method and device for managing virtual disk | |
US8990815B1 (en) | Synchronizing allocated blocks of virtual disk files across primary and secondary volumes by excluding unused blocks | |
US8990528B2 (en) | Method for fast format of a fully allocated volume when copied from a space efficient volume | |
CN111324414B (en) | NVM storage media emulator | |
CN105607869B (en) | A kind of quick formatting and the method using magnetic disk of virtual machine | |
CN114138424B (en) | Virtual machine memory snapshot generation method and device and electronic equipment | |
CN116841799A (en) | Virtual machine backup method, system, equipment and readable storage medium | |
US8281096B1 (en) | Systems and methods for creating snapshots | |
CN103853497A (en) | Disk mirror image block adjusting method, disk mirror image building method and relevant device | |
CN111399774B (en) | Data processing method and device based on snapshot under distributed storage system | |
CN103064926A (en) | Data processing method and device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20140611 |
|
RJ01 | Rejection of invention patent application after publication |