CN114281239A - Mirror image file writing method and device - Google Patents

Mirror image file writing method and device Download PDF

Info

Publication number
CN114281239A
CN114281239A CN202011039459.4A CN202011039459A CN114281239A CN 114281239 A CN114281239 A CN 114281239A CN 202011039459 A CN202011039459 A CN 202011039459A CN 114281239 A CN114281239 A CN 114281239A
Authority
CN
China
Prior art keywords
disk
image file
zero
data
zero data
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
Application number
CN202011039459.4A
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.)
Huawei Cloud Computing Technologies Co Ltd
Original Assignee
Huawei Cloud Computing Technologies 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 Huawei Cloud Computing Technologies Co Ltd filed Critical Huawei Cloud Computing Technologies Co Ltd
Priority to CN202011039459.4A priority Critical patent/CN114281239A/en
Publication of CN114281239A publication Critical patent/CN114281239A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Stored Programmes (AREA)

Abstract

The application provides a method and a device for writing a mirror image file, which are applied to a server and comprise the following steps: the disk is set to be in an all-zero state, when the image file is written, all-zero data is skipped by detecting all-zero data and non-all-zero data, and only the non-all-zero data is written into the disk, so that a large amount of zero data is prevented from being written, the time for writing the data of the image file into the disk is shortened, and the installation efficiency of an operating system is improved.

Description

Mirror image file writing method and device
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method and an apparatus for writing an image file.
Background
Image (image) is a form of file storage, and data on one disk has an identical copy on another disk, i.e. an image. In the field of computers, in order to facilitate downloading and use by users, a series of specific files can be made into an image file according to a preset format through an image file making tool. The user writes the image file into the disk, so that an operating system which is the same as that of the computer with the image file can be obtained.
Since the image file is usually large, the time taken to write the image file to the disk is also long.
Disclosure of Invention
The application provides a method and a device for writing an image file, which are used for shortening the time for writing the image file into a disk.
In a first aspect, the present application provides an image file writing method, which may be implemented by a network device (e.g., a server, a host), or may be implemented by a component of the network device, such as a processing device, a circuit, a chip, and so on in the network device. Setting a disk of the server to be in an all-zero state; writing a mirror image file into the disk, wherein the mirror image file comprises adjacent all-zero data and non-all-zero data; and under the condition that the all-zero data is detected, skipping the all-zero data, and writing the non-zero data in the magnetic disk.
Through the design, the disk is set to be in the all-zero state, when the image file is written in, all-zero data is skipped by detecting all-zero data and non-all-zero data, and only the non-all-zero data is written in the disk, so that a large amount of zero data is prevented from being written in, the time for writing the data of the image file in the disk is shortened, and the installation efficiency of the operating system is improved.
In one possible implementation, the method further includes: and jumping to a preset address according to the size of the all-zero data under the condition of detecting the all-zero data, and writing non-zero data in the preset address.
In a possible implementation method, whether a data block in the image file is the all-zero data is detected according to a preset size.
Through the design, the granularity of the data written into the disk can be adjusted by adjusting the preset size of the database, so that the accuracy of writing the data into the disk position is ensured on the basis of shortening the time for writing the data indicated by the mirror image file into the disk.
In a possible implementation method, the local disk is a Solid State Disk (SSD); before setting the disk of the server to an all-zero state, the method further comprises: and receiving first indication information sent by a cloud management node, wherein the first indication information is used for indicating that the image file is written into the disk.
Through the design, the time for setting the SSD to be in the all-zero state is short, so that the SSD can be set to be reset after the cloud management node indicates the server to install the image file, and the process is simpler and more convenient.
In a possible implementation method, the local disk is a mechanical hard disk (HDD); before setting the disk of the server to an all-zero state, the method further comprises: receiving second indication information for setting the disk to be in an all-zero state sent by the cloud management node; after setting the disk of the server to an all-zero state, the method further comprises the following steps: and receiving first indication information sent by a cloud management node, wherein the first indication information is used for indicating that the image file is written into the disk.
Through the design, the user setting the HDD in the all-zero state is possibly longer, so that the HDD can be set to be cleared before the cloud management node indicates the server to install the image file, and the phenomenon that the server waits for a longer time when installing the image file is avoided.
In a second aspect, the present application further provides an apparatus, where the apparatus includes multiple functional units, and the functional units may perform functions performed by the steps in the method of the first aspect. These functional units may be implemented by hardware or software. In one possible design, the apparatus includes a processing unit. For the beneficial effects achieved by the apparatus, please refer to the description of the first aspect, which is not described herein again.
In a third aspect, an embodiment of the present application further provides an apparatus, which includes a processor and a memory, where the memory stores program instructions, and the processor executes the program instructions in the memory to implement the method provided in the first aspect. For the beneficial effects achieved by the apparatus, please refer to the description of the first aspect, which is not described herein again.
In a fourth aspect, the present application further provides a computer-readable storage medium having stored therein instructions, which, when executed on a computer, cause the computer to perform the method provided by the first aspect.
In a fifth aspect, the present application further provides a computer chip, where the chip is connected to a memory, and the chip is used to read and execute a software program stored in the memory, and execute the method provided in the first aspect.
Drawings
Fig. 1 is a schematic diagram of a possible network architecture provided in an embodiment of the present application;
fig. 2 is a schematic diagram illustrating a process of issuing a bare metal server according to an embodiment of the present disclosure;
fig. 3 is a schematic flowchart illustrating a corresponding flow of a method for writing an image file according to an embodiment of the present application;
fig. 4 is a schematic diagram illustrating comparison of states before and after a disk is cleared according to an embodiment of the present application;
fig. 5 is a schematic diagram of disk data represented by an image file according to an embodiment of the present application;
fig. 6 is a schematic view of a writing scenario of an image file according to an embodiment of the present application;
fig. 7 is a schematic view of a complete flow corresponding to a method for writing an image file corresponding to an SSD according to an embodiment of the present application;
FIG. 8 is a schematic view of a complete flow corresponding to a method for writing an image file corresponding to an HDD according to an embodiment of the present application;
fig. 9 is a schematic diagram of a parallel execution scenario of downloading and writing an image file according to an embodiment of the present application;
FIG. 10 is a schematic structural diagram of an apparatus provided in an embodiment of the present application;
fig. 11 is a schematic structural diagram of another apparatus provided in an embodiment of the present application.
Detailed Description
Hereinafter, some terms in the embodiments of the present application are explained to facilitate understanding by those skilled in the art.
A memory-state operating system OS, which is a micro operating system running on a memory.
Disk (disk), refers to a memory that stores data using magnetic recording technology. The magnetic disk is the main storage medium of the computer, can store a large amount of binary data, and can keep the data from losing after power failure. Magnetic disks include, but are not limited to: solid State Disks (SSDs) and mechanical hard disks (HDDs).
And 3, the bare metal server is a physical server which can provide exclusive cloud resources for the tenant. The process of installing or reinstalling the operating system for the bare metal server may be referred to as a process of issuing the bare metal server. The application will take a bare metal server as an example subsequently, and provides a method for writing the image file in the issuing process of the bare metal server.
At present, the issuing process of a bare metal server generally depends on a preboot execution environment (PXE) technology, where the PXE technology supports a client to download an image from a remote server through a network, and thus supports starting an operating system through the network, and during the starting process, the client requires a Dynamic Host Configuration Protocol (DHCP) server to allocate an IP address, and then uses a file transfer protocol (TFTP) to download a WeChat operating system (a memory state OS running in a memory) to a local memory for execution, and the memory state OS completes writing of an image file of the operating system selected by a tenant.
Since the disk space represented by the image file is usually relatively large, and a user may reserve a large amount of disk space for applications, documents, and the like, in the image making stage, the reserved disk space is all zero data. In the mirror image file writing stage, the data of the disk space represented by the mirror image file needs to be written into the local disk byte by byte, which takes a long time. Some practical examples are shown in table 1 below.
TABLE 1
Size of reserved space Disk write rate Time consumed for writing
100GB 100MB/s 17min
100GB 400MB/s 4min
200GB 100MB/s 34min
200GB 400MB/s 8min
In view of this, the embodiment of the present application provides a method for writing an image file, in which a disk of a bare metal server is set to an all-zero state; the mirror image file comprises adjacent all-zero data and non-all-zero data, and in the process of writing the mirror image file into the disk, under the condition that all-zero data is detected, all-zero data is skipped over, and non-zero data is written into the disk.
The following describes in detail an image file writing method provided in an embodiment of the present application with reference to specific drawings and embodiments. As will be described below by taking a bare metal server as an example, in fact, the embodiment of the present application does not limit the type of server to which the method for writing an image file provided by the present application can be applied.
Fig. 1 is a schematic diagram of a system architecture to which the embodiment of the present invention may be applied. As shown in fig. 1, the system includes a cloud management node 100 and a bare metal server 101.
The cloud management node 100 and the bare metal server 101 are located in the same cloud management network, and it should be understood that the same cloud management network may include a plurality of cloud management nodes (fig. 1 illustrates one cloud management node as an example, but this is not limited in this embodiment of the present application), and each cloud management node is configured to manage one or more bare metal servers (fig. 1 illustrates one bare metal server as an example, but this is not limited in this embodiment of the present application).
Specifically, the cloud management node 100 is responsible for managing power-on, power-off, restart, cloud entry, release, and the like of the bare metal server 101.
It should be understood that fig. 1 is merely an example, and in fact, the cloud management network may further include more or fewer devices than fig. 1, for example, a dhcp service, a tftp service, and the like (not shown in fig. 1) may be further included, the dhcp service may be used to allocate an ip address to a bare metal server, the tftp service may be used to provide a PXE file for the bare metal server, and the like, the dhcp service may be deployed on the dhcp server, the tftp service may be deployed on the tftp server, and a specific deployment form of the cloud management network is not limited in this embodiment of the application.
Referring to fig. 2, a schematic diagram of a issuing process of a bare metal server is provided for the embodiment of the present application, and the method may be applied to the system shown in fig. 1. The method comprises the following steps:
step 201: and the cloud management node controls the bare metal server to be powered on.
Step 202: and the bare metal server loads the memory state OS through the PXE.
Step 203: the bare metal server sends first indication information to the cloud management node, wherein the first indication information is used for indicating that the loading of the memory state OS is completed.
Step 204: and the cloud management node acquires a download address of the image file of the operating system from the image service.
Step 205: the cloud management node sends second indication information to the bare metal server, wherein the second indication information comprises a mirror image file downloading address of the operating system and is used for indicating the bare metal server to install the operating system; correspondingly, the bare metal server receives the second indication information.
Step 206: and the memory state OS of the bare metal server downloads the corresponding image file of the operating system according to the download address in the second indication information.
Step 207: and loading the image file by the memory state OS of the bare metal server, and installing the operating system.
Specifically, the memory state OS writes the image file into the local disk of the bare metal server, and subsequently, after the operation start and installation are completed, the bare metal server is powered off or restarted, the memory state OS is cleared by power failure, and the bare metal server can load the operating system.
Step 208: after the mirror image file is written, the bare metal server sends third indication information to the cloud management node, wherein the third indication information is used for indicating that the mirror image file is written completely.
Step 209: and the cloud management node controls the bare metal server to restart, and the operating system is loaded after the bare metal server is restarted.
It should be noted that the above-mentioned issuing process of the bare metal server is only an example, and actually, there are various issuing methods of the bare metal server, which is not limited in this embodiment of the present application.
The process of writing the image file by the bare metal server is specifically described as follows.
Fig. 3 is a schematic flowchart corresponding to the image file writing method provided in the embodiment of the present application. The main execution body of the process may be the bare metal server in fig. 1 or fig. 2, or may be a component of the bare metal server, such as a memory state OS running in a memory. As shown in fig. 3, the process may include the following steps:
step 301: and setting the disk of the bare metal server to be in an all-zero state.
The all-zero state means that the disk is blank, or all data of the disk is zero. Fig. 4 is a schematic diagram showing a front-back comparison of an apparatus for setting a disk to be an all-zero device according to an embodiment of the present application.
Specifically, according to the type of the disk, the mode of setting the disk to the all-zero state may be different for different types of disks. For example, for a solid state disk, a secure erase technique may be used to erase dirty data from the disk, where the disk is in an all-zero state after the erase. It should be noted that the secure erase technique is a fast and efficient way to remove dirty data, that is, the time to remove dirty data of the SSD is short, and then, due to the feature of the secure erase technique, the timing to set the SSD to the all-zero state may also be flexible, for example, before the bare metal server receives the second indication information sent by the cloud management node to indicate that the operating system is installed, or after the bare metal server receives the second indication information.
For another example, for a mechanical hard disk, dirty data from the disk may be purged using secure formatting techniques. The secure formatting technique can be understood as writing 0 data to the disk byte by byte within the disk, and thus takes a long time. In order not to influence the time for writing the image file, for the mechanical hard disk, before the bare metal server issues the image file, the bare metal server may be instructed to perform secure formatting on the HDD, so that the HDD is in an all-zero state. As will be described in detail below.
Step 302: and in the stage of writing the mirror image file into the disk, skipping all-zero data when all-zero data is detected, and writing non-zero data into the disk.
Fig. 5 is a schematic diagram illustrating data of a disk space represented by an image file. The mirror image file comprises all zero data and non-zero data which are adjacent.
In this embodiment of the present application, the all-zero data refers to a data block with a preset size formed by consecutive data in the image file, and the data in the data block is continuous all-zero. For example, the image file includes a header area and a data area, the header area includes control information for indicating information such as an address of the data area, and the data area includes data to be written to the disk. Assuming that the predetermined size is 2M, starting from the start position of the data area to the position of 2M, the area is a data block with the predetermined size, and if the data in the data block are all 0, the data contained in the data block are all zero data. If the data contained in the data block is not all 0, the data contained in the data block is non-all-zero data. Referring to fig. 5, the disk data represented by the image file at least includes the following all-zero data: data block 0, data block 2, data block 3, data block 5, and data block 7, taking data block 3 as an example, the data in data block 3 is all 0. The image file at least comprises the following non-all-zero data: data block 1, data block 4, and data block 6, taking data block 1 and data block 6 as an example, the data in data block 1 includes at least one 1, and the data in data block 6 is all 1.
It should be noted that the preset size of the data block shown in fig. 5 is only an example, and may also be another preset value, for example, 3M or another value, which is not limited in this embodiment of the application.
Illustratively, when an image file is written, two pointers are maintained in the bare metal server, where the two pointers respectively represent two addresses, for example, a pointer 1 and a pointer 2, where the pointer 1 represents a start address of the image file read this time, and the pointer 2 represents an address of a location to be written to the disk. In one example, the address of the image file and the address of the disk may be identified using byte addresses. For example, the total number of bytes that can be carried by the entire disk, and the number of bytes corresponding to each disk location may be used as the address corresponding to the disk location.
For example, referring to fig. 6, starting from the start position of the data area of the image file, there is one data block in a space with a preset size, that is, the data blocks are equal in size, and the size of the data blocks is a preset value. The bare metal server reads the start location of the image file and records the start location (assumed to be the a-th byte) via pointer 1, and, the address (assumed to be 0) of the starting position of the disc to be written is recorded by the pointer 2, and at the same time, the data block 0 starts to be read, if the data block 0 is all-zero data, the all-zero data is skipped, pointer 1 records the address (a + b) of the start position of the next data block (data block 1), at the same time, the current address (0) of pointer 2 is added with the number of byte addresses corresponding to the preset size (2M), assuming that the byte corresponding to 2M is b bytes, the address of pointer 2 is modified to be b, it can be understood that the disk address corresponding to pointer 2 corresponds to the start address of the data block to be written in the image file, namely, the address of the modified pointer 2 is the address of the disk to be written corresponding to the next data block (data block 1) of the image file.
Similarly, if the data block 1 is read and the data block 1 is non-zero data, the data block 1 of the image file is read from the address (a + b) indicated by the pointer 1, and the data block 1 is written from the address of the disk corresponding to the pointer 2 (b). After the writing is completed, the address of the pointer 1 is modified to the start address (a +2b) of the data block 2, and the current address (b) of the pointer 2 is added to the byte address corresponding to the preset size (2M), that is, 2 b. And the like until the mirror image file is completely written into the disk.
The following describes a method for writing image files of different types of disks by using a specific embodiment.
Fig. 7 is a schematic flow chart corresponding to the image file writing method of the SSD according to the present application. Wherein, steps 701 to 705, 707 to 708, and 709 to 710 in fig. 7 are respectively the same as steps 201 to 205, 206 to 207, and 208 to 209 in fig. 2, and are not repeated here, and only the differences are explained below:
step 706: and the memory state OS carries out safe erasing on the SSD, so that the SSD is in an all-zero state.
Step 709: and when the memory state OS writes the downloaded image file into a local disk, skipping all-zero data when detecting all-zero data, and writing non-zero data into the disk.
It should be noted that the above steps are only an example, and the timing sequence for downloading the image file (step 707) and setting the SSD all-zero state (step 706) in the embodiment of the present application is not limited, and may be executed simultaneously, or may be executed first in step 707 and then in step 706, or may be executed first in step 706 and then in step 707, which is not limited in the embodiment of the present application.
Referring to fig. 8, a flowchart corresponding to the method for writing the image file of the HDD according to the present application is shown. In fig. 8, steps 801 to 803, steps 807 to 810, and steps 812 to 813 are respectively the same as steps 201 to 203, steps 204 to 206, and steps 208 to 809 in fig. 2, and are not repeated here, and only differences are described below:
step 804: and the cloud management node sends fourth indication information to the bare metal server, wherein the fourth indication information is used for indicating that the disk is cleared. Correspondingly, the bare metal server receives fourth indication information sent by the cloud management node.
Step 805: and the memory state OS of the bare metal server carries out safe formatting on the HDD.
Step 806: and the memory state OS of the bare metal server sends fifth indication information to the cloud management node, wherein the fifth indication information is used for indicating that the disk is in an all-zero state. Correspondingly, the cloud management node receives fifth indication information sent by the bare metal server.
It should be noted that the above steps are only an example, and the timing sequence for downloading the image file (step 809) and setting the all-zero state of the HDD (step 805) in the embodiment of the present application is not limited, and may be executed simultaneously, or may be executed first in step 809 and then in step 805, or may be executed first in step 805 and then in step 809, which is not limited in the embodiment of the present application.
Step 810: and when the memory state OS writes the downloaded image file into a local disk, skipping all-zero data when detecting all-zero data, and writing non-zero data into the disk.
It should be noted that, in the foregoing manner, after the HDD is in the all-zero state, the bare metal server is instructed to install the operating system, and the tenant leases which bare metal server of the operating system is, so that the bare metal server installed with the corresponding operating system can be directly provided to the tenant. Of course, when the tenant makes a lease request, the release process may be completed according to the operating system specified by the tenant, which is not limited in the embodiment of the present application. If the tenant makes a lease request, the bare metal server is instructed to install the operating system, after step 806, the cloud management node may instruct the bare metal server to power down, instruct the bare metal server to power up after receiving the lease request of the user, and execute step 807 after the bare metal server is powered up again to complete the memory state OS start.
It should be noted that fig. 7 and fig. 8 illustrate two disk cleaning processes by taking an applicable disk type as an example, and it is needless to say that both the HDD and the SSD can be applied to any one of the two processes, which is not limited in the embodiment of the present application.
In the two embodiments, in one implementation, the memory-state OS may write the image file into the local disk after the image file is completely downloaded. In another practical way, referring to fig. 9, the memory state OS may write the currently downloaded image file to the local disk in parallel when downloading the image file.
By the mode, the disk is set to be in the all-zero state, when the image file is written in, only the non-all-zero data is written in the disk by detecting the all-zero data and the non-all-zero data, and a large amount of zero data is prevented from being written in, so that the time for writing the image file in the disk is shortened, and the installation efficiency of the operating system is improved.
Based on the same inventive concept as the method embodiment, an embodiment of the present application further provides an apparatus for executing the method executed in the method embodiment, and related features may refer to the method embodiment, which is not described herein again, and as shown in fig. 10, the apparatus includes a communication unit 1001 and a processing unit 1002.
The processing unit 1002 is configured to set a disk of the server to an all-zero state; writing a mirror image file into the disk, wherein the mirror image file comprises adjacent all-zero data and non-all-zero data; and under the condition that the all-zero data is detected, skipping the all-zero data, and writing the non-zero data in the magnetic disk.
In a possible implementation manner, the processing unit 1002 is specifically configured to jump to a preset address according to the size of all-zero data when the all-zero data is detected, and write non-zero data at the preset address.
In a possible implementation manner, the processing unit 1002 is further configured to detect whether a data block in the image file is the all-zero data according to a preset size.
In a possible implementation manner, the local disk is a solid state disk SSD; the communication unit 1001 is further configured to receive first indication information sent by a cloud management node, where the first indication information is used to indicate that the image file is written in the disk.
In one possible implementation, the local disk is a mechanical hard disk HDD; the communication unit 1001 is further configured to receive second indication information that the cloud management node sends the disk in an all-zero state; and receiving first indication information sent by a cloud management node, wherein the first indication information is used for indicating that the image file is written into the disk.
Similar to the above concept, as shown in fig. 11, the present application provides a device 1100, where the device 1100 may be applied to any network device in the scenario shown in fig. 1, such as a bare metal server, and performs the steps performed by the main body in the methods shown in fig. 2, fig. 3, fig. 7, or fig. 8.
The device 1100 may include a processor 1101 and a memory 1102. Further, the apparatus may further include a communication interface 1104, which may be a transceiver, or a network card. Further, the device 1100 may also include a bus system 1103.
The processor 1101, the memory 1102 and the communication interface 1104 may be connected via the bus system 1103, the memory 1102 may store instructions, and the processor 1101 may be configured to execute the instructions stored in the memory 1102 to control the communication interface 1104 to receive or send a signal, so as to complete the steps of executing the main body in the method shown in fig. 2, fig. 3, fig. 7 or fig. 8.
The memory 1102 may be integrated in the processor 1101 or may be a different physical entity from the processor 1101.
As an implementation manner, the function of the communication interface 1104 may be realized by a transceiver circuit or a dedicated chip for transceiving. The processor 1101 may be considered to be implemented by a dedicated processing chip, processing circuit, processor, or general purpose chip.
As another implementation manner, a manner of using a computer may be considered to implement the first computing node or the function of the first computing node provided in the embodiment of the present application. That is, program code that implements the functions of the processor 1101 and the communication interface 1104 is stored in the memory 1102, and a general-purpose processor can implement the functions of the processor 1101 and the communication interface 1104 by executing the code in the memory.
For the concepts, explanations, and detailed descriptions related to the technical solutions provided in the present application and other steps related to the apparatus 1100, reference may be made to the descriptions of the foregoing methods or other embodiments, which are not described herein again.
In an example of the present application, the apparatus 1100 may be configured to execute the steps of the main body in the processes shown in fig. 2, fig. 3, fig. 7, or fig. 8. For example, processor 1101 is configured to set a disk of the server to an all zero state; writing a mirror image file into the disk, wherein the mirror image file comprises adjacent all-zero data and non-all-zero data; and under the condition that the all-zero data is detected, skipping the all-zero data, and writing the non-zero data in the magnetic disk.
For descriptions of the processor 1101 and the communication interface 1104, reference may be made to descriptions of the flows shown in fig. 2, fig. 3, fig. 7, or fig. 8, which are not described herein again.
Based on the above embodiments, the present application further provides a computer storage medium, in which a software program is stored, and the software program can implement the method provided by any one or more of the above embodiments when being read and executed by one or more processors. The computer storage medium may include: u disk, removable hard disk, read only memory, random access memory, magnetic or optical disk, etc. for storing program codes.
Based on the above embodiments, the present application further provides a computer program product, where the computer program product includes computer instructions, and when the computer instructions are executed by a computer, the computer is caused to execute the method provided by any one or more of the above embodiments.
Based on the above embodiments, the present application further provides a chip, where the chip includes a processor, and is configured to implement the functions related to any one or more of the above embodiments, such as obtaining or processing information or messages related to the above methods. Optionally, the chip further comprises a memory for storing program instructions and data for execution by the processor. The chip may also contain chips and other discrete devices.
It should be understood that in the embodiments of the present application, the processor may be a Central Processing Unit (CPU), and the processor may also be other general purpose processors, Digital Signal Processors (DSPs), application-specific integrated circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other programmable logic devices, transistor logic devices, discrete hardware components, etc., or any combination thereof designed to implement or operate the described functions. A general-purpose processor may be a microprocessor, but in the alternative, the processor may be any conventional processor, controller, microcontroller, or state machine. A processor may also be implemented as a combination of computing devices, e.g., a digital signal processor and a microprocessor, a plurality of microprocessors, one or more microprocessors in conjunction with a digital signal processor core, or any other similar configuration.
The memory may include both read-only memory and random access memory, and provides instructions and data to the processor. The portion of memory may also include non-volatile random access memory.
The bus system may include a power bus, a control bus, a status signal bus, and the like, in addition to the data bus. For clarity of illustration, however, the various buses are labeled as a bus system in the figures. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware in a processor or instructions in the form of software. The steps of a method disclosed in connection with the embodiments of the present application may be directly implemented by a hardware processor, or may be implemented by a combination of hardware and software modules in a processor. The software module may be located in ram, flash memory, rom, prom, or eprom, registers, etc. storage media as is well known in the art. The storage medium is located in a memory, and a processor reads information in the memory and completes the steps of the method in combination with hardware of the processor. To avoid repetition, it is not described in detail here.
Optionally, the computer-executable instructions in the embodiments of the present application may also be referred to as application program codes, which are not specifically limited in the embodiments of the present application.
Those of ordinary skill in the art will understand that: the various numbers of the first, second, etc. mentioned in this application are only used for the convenience of description and are not used to limit the scope of the embodiments of this application, but also to indicate the sequence. "and/or" describes the association relationship of the associated objects, meaning that there may be three relationships, e.g., a and/or B, which may mean: a exists alone, A and B exist simultaneously, and B exists alone. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship. "at least one" means one or more. At least two means two or more. "at least one," "any," or similar expressions refer to any combination of these items, including any combination of singular or plural items. For example, at least one (one ) of a, b, or c, may represent: a, b, c, a-b, a-c, b-c, or a-b-c, wherein a, b, c may be single or multiple. "plurality" means two or more, and other terms are analogous. Furthermore, for elements (elements) that appear in the singular form "a," an, "and" the, "they are not intended to mean" one or only one "unless the context clearly dictates otherwise, but rather" one or more than one. For example, "a device" means for one or more such devices.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the application to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website site, computer, server, or data center to another website site, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device including one or more available media integrated servers, data centers, and the like. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.
The steps of a method or algorithm described in the embodiments herein may be embodied directly in hardware, in a software element executed by a processor, or in a combination of the two. The software cells may be stored in RAM memory, flash memory, ROM memory, EPROM memory, EEPROM memory, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art. For example, a storage medium may be coupled to the processor such the processor can read information from, and write information to, the storage medium. In the alternative, the storage medium may be integral to the processor. The processor and the storage medium may reside in an ASIC.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
Although the present application has been described in conjunction with specific features and embodiments thereof, it will be evident that various modifications and combinations can be made thereto without departing from the spirit and scope of the application. Accordingly, the specification and figures are merely exemplary of the present application as defined in the appended claims and are intended to cover any and all modifications, variations, combinations, or equivalents within the scope of the present application. It will be apparent to those skilled in the art that various changes and modifications may be made in the present application without departing from the scope of the application. Thus, if such modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include such modifications and variations.

Claims (12)

1. A method for writing an image file is applied to a server, and is characterized by comprising the following steps:
setting a disk of the server to be in an all-zero state;
writing a mirror image file into the disk, wherein the mirror image file comprises adjacent all-zero data and non-all-zero data;
and under the condition that the all-zero data is detected, skipping the all-zero data, and writing the non-zero data in the magnetic disk.
2. The method of claim 1, further comprising:
and jumping to a preset address according to the size of the all-zero data under the condition of detecting the all-zero data, and writing non-zero data in the preset address.
3. The method of claim 2, further comprising: and detecting whether the data block in the mirror image file is the all-zero data or not according to a preset size.
4. The method of any of claims 1-3, wherein the local disk is a Solid State Disk (SSD);
before setting the disk of the server to an all-zero state, the method further comprises:
and receiving first indication information sent by a cloud management node, wherein the first indication information is used for indicating that the image file is written into the disk.
5. The method of any of claims 1-3, wherein the local disk is a mechanical hard disk (HDD);
before setting the disk of the server to an all-zero state, the method further comprises:
receiving second indication information for setting the disk to be in an all-zero state sent by the cloud management node;
after setting the disk of the server to an all-zero state, the method further comprises the following steps:
and receiving first indication information sent by a cloud management node, wherein the first indication information is used for indicating that the image file is written into the disk.
6. An apparatus, characterized in that the apparatus comprises a processing unit:
the processing unit is used for setting the disk of the server to be in an all-zero state; writing a mirror image file into the disk, wherein the mirror image file comprises adjacent all-zero data and non-all-zero data; and under the condition that the all-zero data is detected, skipping the all-zero data, and writing the non-zero data in the magnetic disk.
7. The device according to claim 6, wherein the processing unit is specifically configured to jump to a preset address according to the size of the all-zero data and write non-zero data at the preset address when the all-zero data is detected.
8. The apparatus of claim 7, wherein the processing unit is further configured to detect whether a data block in the image file is the all-zero data according to a preset size.
9. The apparatus according to any one of claims 6-8, wherein the apparatus further comprises a communication unit; the local disk is a Solid State Disk (SSD); the communication unit is further configured to receive first indication information sent by a cloud management node, where the first indication information is used to indicate that the image file is written in the disk.
10. The apparatus according to any one of claims 6-8, wherein the apparatus further comprises a communication unit; the local magnetic disk is a mechanical hard disk (HDD);
the communication unit is further configured to receive second indication information that the cloud management node sends the disk is set to be in an all-zero state; and receiving first indication information sent by a cloud management node, wherein the first indication information is used for indicating that the image file is written into the disk.
11. An apparatus comprising one or more processors and one or more memories;
the one or more memories coupled to the one or more processors for storing computer program code comprising computer instructions which, when executed by the one or more processors, cause the terminal device to perform the method of any of claims 1-5.
12. A computer-readable storage medium, comprising a computer program which, when run on a flow orchestration device, causes the flow orchestration device to perform the method according to any one of claims 1-5.
CN202011039459.4A 2020-09-28 2020-09-28 Mirror image file writing method and device Pending CN114281239A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011039459.4A CN114281239A (en) 2020-09-28 2020-09-28 Mirror image file writing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011039459.4A CN114281239A (en) 2020-09-28 2020-09-28 Mirror image file writing method and device

Publications (1)

Publication Number Publication Date
CN114281239A true CN114281239A (en) 2022-04-05

Family

ID=80867933

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011039459.4A Pending CN114281239A (en) 2020-09-28 2020-09-28 Mirror image file writing method and device

Country Status (1)

Country Link
CN (1) CN114281239A (en)

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020073278A1 (en) * 2000-12-13 2002-06-13 Mcdowell Steven R. Zeroed block optimization in disk mirroring applications
US20120109897A1 (en) * 2010-10-27 2012-05-03 Symantec Corporation System and method for optimizing mirror creation
CN103019895A (en) * 2012-12-28 2013-04-03 华为技术有限公司 File storage method and device
CN103366813A (en) * 2012-03-26 2013-10-23 上海华虹Nec电子有限公司 Erasing method of nonvolatile memory
US8688908B1 (en) * 2010-10-11 2014-04-01 Infinidat Ltd Managing utilization of physical storage that stores data portions with mixed zero and non-zero data
CN104572656A (en) * 2013-10-12 2015-04-29 华为技术有限公司 Method and device for recycling space of disk mirror image
US20160328304A1 (en) * 2015-05-06 2016-11-10 Stephen J. Wark Method of copying a data image from a source to a target storage device in a fault tolerant computer system
CN106502919A (en) * 2016-10-11 2017-03-15 上海东软载波微电子有限公司 A kind of write operation method of Flash flash memories and device
CN108255436A (en) * 2018-01-25 2018-07-06 广东美的制冷设备有限公司 Data access method, access device, home appliance and readable storage medium storing program for executing
CN110795043A (en) * 2019-10-29 2020-02-14 北京浪潮数据技术有限公司 Distributed storage block zero setting method and device, electronic equipment and storage medium
CN111045600A (en) * 2019-11-05 2020-04-21 北京新忆科技有限公司 Method and device for writing data into memory and storage medium

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020073278A1 (en) * 2000-12-13 2002-06-13 Mcdowell Steven R. Zeroed block optimization in disk mirroring applications
US8688908B1 (en) * 2010-10-11 2014-04-01 Infinidat Ltd Managing utilization of physical storage that stores data portions with mixed zero and non-zero data
US20120109897A1 (en) * 2010-10-27 2012-05-03 Symantec Corporation System and method for optimizing mirror creation
CN103366813A (en) * 2012-03-26 2013-10-23 上海华虹Nec电子有限公司 Erasing method of nonvolatile memory
CN103019895A (en) * 2012-12-28 2013-04-03 华为技术有限公司 File storage method and device
CN104572656A (en) * 2013-10-12 2015-04-29 华为技术有限公司 Method and device for recycling space of disk mirror image
US20160328304A1 (en) * 2015-05-06 2016-11-10 Stephen J. Wark Method of copying a data image from a source to a target storage device in a fault tolerant computer system
CN106502919A (en) * 2016-10-11 2017-03-15 上海东软载波微电子有限公司 A kind of write operation method of Flash flash memories and device
CN108255436A (en) * 2018-01-25 2018-07-06 广东美的制冷设备有限公司 Data access method, access device, home appliance and readable storage medium storing program for executing
CN110795043A (en) * 2019-10-29 2020-02-14 北京浪潮数据技术有限公司 Distributed storage block zero setting method and device, electronic equipment and storage medium
CN111045600A (en) * 2019-11-05 2020-04-21 北京新忆科技有限公司 Method and device for writing data into memory and storage medium

Similar Documents

Publication Publication Date Title
KR101605875B1 (en) Memory apparatus and method for updating firmware of the memory apparatus
TW201729123A (en) Method and server for remote launching deployment utility
US20100064127A1 (en) Method for updating basic input/output system and method for repairing thereof
CN111666111B (en) Multi-node storage system and firmware updating method thereof
US10025670B2 (en) Information processing apparatus, memory dump method, and storage medium
US10997516B2 (en) Systems and methods for predicting persistent memory device degradation based on operational parameters
CN105068836A (en) SAS (serial attached SCSI) network based remotely-shareable start-up system
US20160196085A1 (en) Storage control apparatus and storage apparatus
CN110765032A (en) Method for reading and writing I2C memory based on system management bus interface
US20130024726A1 (en) System and method for removable network attached storage enabling system recovery from backup
US10133654B1 (en) Firmware debug trace capture
US11861349B2 (en) Modular firmware updates in an information handling system
JP6599725B2 (en) Information processing apparatus, log management method, and computer program
CN113190256B (en) Upgrading method, device and equipment
US20070061613A1 (en) Restart method for operating system
US20190087174A1 (en) Background firmware update
JP6515462B2 (en) INFORMATION PROCESSING DEVICE, SETTING METHOD FOR INFORMATION PROCESSING DEVICE, AND SETTING PROGRAM
CN111124294B (en) Sector mapping information management method and device, storage medium and equipment
WO2013115767A1 (en) Booting a server using a remote read-only memory image
CN114281239A (en) Mirror image file writing method and device
CN115794232A (en) VPD (virtual private display) acquisition method, device, equipment and computer-readable storage medium
CN114020308A (en) Camera equipment upgrading method, device, equipment and medium
US10795771B2 (en) Information handling system with reduced data loss in block mode
US20200151119A1 (en) Method and apparatus for performing access control between host device and memory device
EP2613254A2 (en) Apparatus and method for partitioning memory area for application preloading in a wireless terminal

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