Disclosure of Invention
In this summary, concepts in a simplified form are introduced that are further described in the detailed description. This summary of the invention is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used as an aid in determining the scope of the claimed subject matter.
In order to fully utilize the internal space of the ONU device and improve the accuracy of obtaining the backup partition mirror version information, in a first aspect, the present invention provides a dual-mirror management method for the ONU device, where the method includes:
mounting a system file of the backup partition;
acquiring version information of the backup partition according to the system file of the backup partition;
and storing the version information of the backup partition in the storage space of the active partition.
Optionally, the method further includes:
automatically acquiring the address of the backup partition when the active partition runs;
the system file for mounting the backup partition comprises:
and mounting the system file of the backup partition based on the address of the backup partition.
Optionally, the method further includes:
and unloading the system files of the backup partition.
Optionally, the method further includes:
and automatically deleting the historical version information of the backup partition stored in the active partition when the active partition runs.
Optionally, the storing the version information of the backup partition in the storage space of the active partition includes:
and storing the version information of the backup partition in the temporary storage space of the active partition.
Optionally, the method further includes:
and storing the version information of the backup partition in a tmp folder of the active partition.
Optionally, the method further includes:
and when the ONU equipment is upgraded, upgrading operation is carried out based on the version information of the backup partition stored in the active partition.
In a second aspect, the present invention further provides a dual-image management apparatus, including:
the mounting unit is used for mounting the system files of the backup partition on the active partition;
an obtaining unit, configured to obtain version information of the backup partition according to a system file of the backup partition;
and the information unit is used for storing the version information of the backup partition in the storage space of the active partition.
In a third aspect, an electronic device includes: a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor is configured to implement the steps of the dual image management method according to any one of the first aspect when executing the computer program stored in the memory.
In a fourth aspect, the present invention also provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the dual-image management method of any one of the first aspect.
To sum up, the dual-image management method provided in the embodiment of the present application is used for an ONU device, and mainly includes: mounting the system file of the backup partition in the active partition; acquiring version information of the backup partition according to the system file of the backup partition; and storing the version information of the backup partition in the storage space of the active partition. According to the double-mirror image information management method provided by the embodiment of the application, the system files of the backup partitions are mounted, and the active partition directly obtains the mirror image version information through the system files of the mounted backup partitions, so that the situation that the version information is obtained in a trans-partition mode is avoided, and the complexity of codes is reduced. And the acquired version information is stored in the storage space of the active partition without reserving a third space for storing the mirror image version information, so that the utilization rate of the storage space of the ONU equipment is improved.
Additional advantages, objects, and features of the invention will be set forth in part in the description which follows and in part will become apparent to those having ordinary skill in the art upon examination of the following or may be learned from practice of the invention.
Detailed Description
According to the double-mirror image information management method provided by the embodiment of the application, the system files of the backup partitions are mounted, and the active partition directly obtains the mirror image version information through the system files of the mounted backup partitions, so that the situation that the version information is obtained in a trans-partition mode is avoided, and the complexity of codes is reduced. And the acquired version information is stored in the storage space of the active partition without reserving a third space for storing the mirror image version information, so that the utilization rate of the storage space of the ONU equipment is improved.
The terms "first," "second," "third," "fourth," and the like in the description and in the claims of the present application and in the drawings described above, if any, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It will be appreciated that the data so used may be interchanged under appropriate circumstances such that the embodiments described herein may be practiced otherwise than as specifically illustrated or 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, 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. The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments.
Referring to fig. 1, a schematic flow chart of a dual-image management method according to an embodiment of the present application is shown, where a first aspect of the present application provides a dual-image management method for an ONU device, and the method specifically includes:
s110, mounting system files of the backup partitions;
for example, for dual images of an ONU device, each image has its own version information file, and is stored in a file system with the image. But is inaccessible when the mirrored file system is backed up at the time of upgrade. Some double-image management methods are to generate a version information partition separately, and are specially used for storing version information of two partitions, so that storage occupation is increased, and complexity of upgrading codes is increased. During upgrading, the version information of the upgraded mirror image needs to be extracted and written into the version information partition. It is possible that the written result and the actual version information do not coincide.
In order to avoid the problem of inconsistent version information, according to the method provided by the embodiment of the application, the active partition directly obtains the mirror image version information of the system file of the backup partition through an instruction by mounting the system file of the backup partition. By means of mounting, the accuracy of version information can be effectively guaranteed, and meanwhile the complexity of upgrading codes is reduced.
S120, acquiring version information of the backup partition according to the system file of the backup partition;
illustratively, after the operation of mounting the backup partition is finished, the active partition (i.e., the primary partition) may start to obtain the version information of the backup partition image. It can be understood that the process of obtaining the backup partition version information is completed in the main partition, and the information is obtained without cross-partition, so that the load degree of the code is reduced to a certain extent, and the accuracy of the version information obtaining process is improved.
And S130, storing the version information of the backup partition in the storage space of the active partition.
Illustratively, after the version information of the backup partition is obtained, the version information is stored in the corresponding storage space of the active partition. And the data is not stored in a third partition except the active partition and the backup partition, so that the waste of storage space caused by dividing the third partition is avoided.
In summary, according to the dual-mirror image information management method provided by the embodiment of the application, the active partition directly obtains the mirror image version information through the system file of the mounted backup partition by mounting the system file of the backup partition, so that the cross-region acquisition of the version information is avoided, and the complexity of codes is reduced. And the acquired version information is stored in the storage space of the active partition without reserving a third space for storing the mirror image version information, so that the utilization rate of the storage space of the ONU equipment is improved.
In some examples, the method further comprises:
automatically acquiring the address of the backup partition when the active partition runs;
the system file for mounting the backup partition comprises:
and mounting the system file of the backup partition based on the address of the backup partition.
Illustratively, when the active partition runs, the address of the backup partition is automatically acquired, the active partition mounts the backup partition based on the acquired address of the backup partition, then the version information of the system file image of the backup partition is acquired in the above manner, and the version information is stored in the active partition for upgrading the ONU device.
To sum up, the method provided in the embodiment of the present application automatically obtains the address of the backup partition when the active partition runs, and mounts the system file according to the address, thereby obtaining the version information, so that it is ensured that the latest system file image version information of the backup partition can be obtained each time the active partition runs, thereby ensuring that the ONU device can be continuously upgraded.
In some examples, the method further comprises:
and unloading the system files of the backup partition.
Illustratively, after the system file image version information of the backup partition is acquired or before the active partition stops running, the system file of the backup partition is unloaded, so that more running space can be released for the ONU, and the situation that the upgrading logic of the ONU equipment is disordered and the upgrading of the ONU equipment fails due to the fact that the backup partition file is repeatedly mounted when the active partition runs next time can be avoided.
In summary, the method provided in the embodiment of the present application unloads the files of the backup partition before the version information acquisition is completed or the active partition stops running, so as to achieve the effects of releasing the running space and improving the upgrade success rate of the ONU device.
In some examples, the method further comprises:
and automatically deleting the historical version information of the backup partition stored in the active partition when the active partition runs.
Illustratively, the historical version information refers to the version information of the file image of the backup partition system extracted when the active partition is operated last time. In order to avoid the active partition from stopping working unexpectedly, the historical version information is not deleted, and the mirror image version information of the system files of the backup partition is obtained again after the active partition works again. Because the two versions of information exist at the same time, trouble is caused when ONU equipment is upgraded. Therefore, the method actively deletes the historical version information of the backup partition stored in the active partition when the active partition runs, thereby ensuring that only the version information of the system file image of one backup partition is stored in the active partition, and improving the success rate of upgrading the ONU equipment.
In summary, the method provided by the embodiment of the present application automatically deletes the historical version information of the backup partition when the active partition runs, and ensures that only one version information is always stored in the running partition, thereby avoiding logic confusion caused by the upgrading of the ONU, and improving the success rate of the upgrading of the ONU equipment.
In some examples, the storing the version information of the backup partition in the storage space of the active partition includes:
and storing the version information of the backup partition in the temporary storage space of the active partition.
Illustratively, in order to avoid the simultaneous occurrence of the version information of the system file images of a plurality of backup partitions, the image version information of the system files of the backup partitions is stored in the temporary storage space of the active partition, and when the active partition stops working, the version information is automatically deleted, so that only newly acquired version information is stored in the active partition when the active partition operates next time, logic confusion caused by ONU upgrading is avoided, and the success rate of upgrading the ONU equipment is improved.
In summary, according to the method provided by the embodiment of the present application, the image version information is stored in the temporary storage space of the active partition, and when the active partition stops working, the version information is automatically deleted, so that logical confusion caused by the ONU upgrading is avoided, and the success rate of the ONU upgrading is improved.
In some examples, the method further comprises:
and storing the version information of the backup partition in a tmp folder of the active partition.
Illustratively, the tmp file stores a temporary file, the version information of the backup partition is stored in the tmp folder, and when the ONU device deletes the temporary file, the version information can be deleted together, so that the complexity of the code is reduced, and trouble caused by the existence of a plurality of version information in the active partition for upgrading the ONU device is avoided.
In summary, the method provided by the embodiment of the present application stores the version information of the backup partition in the tmp folder of the active partition, thereby reducing the complexity of the code and improving the success rate of the device upgrade.
In some examples, the method further comprises:
and when the ONU equipment is upgraded, upgrading operation is carried out based on the version information of the backup partition stored in the active partition.
Illustratively, when the ONU device performs upgrading, by acquiring version information of a backup partition file stored in the active partition, if the version information of the latest upgrade file is consistent with the version information of the stored backup partition, the upgrading operation is not performed; and if the version information of the latest upgrade file is inconsistent with the version information of the backup partition which cannot be output, performing upgrade operation.
In some examples, the management method of dual mirroring may be implemented by:
s210, inquiring the backup partition and the active partition through # cat/proc/mtd, and receiving the following two lines of codes after inputting the codes:
mtd1: 03200000 00020000 "rootfs_update"
mtd2: 03200000 00020000 "rootfs"
wherein, the partition marked as rootfs _ update is a backup partition, and the partition marked as rootfs is an active partition.
S220, mounting the backup partition through mount-t jffs 2/dev/mtdblock 1/tmp/. rootfs _ update instruction;
s230, reading and saving a version information folder from a file system of the backup partition by utilizing cp-f/tmp/. rootfs _ update/version/tmp/version.B, wherein the name of the saved version information is version.B;
s240, unloading the backup partition through an umount/tmp/rootfs _ update instruction to prevent misoperation;
s250, acquiring version information of the backup partition mirror image by using the instruction/tmp/version.B to complete system upgrading;
and S260, deleting the temporary file in the tmp folder by utilizing an rm-rf/tmp/. rootfs _ update instruction, wherein the temporary file may include a temporary file generated when the backup partition system file is mounted and may also include a version information file, the temporary file generated when the backup partition system file is mounted and deleted can release the running space of the ONU equipment, and the deletion of the version information file can avoid logic confusion caused by the simultaneous existence of a plurality of version information files during next upgrade.
Referring to fig. 2, an embodiment of a dual image management apparatus in the embodiment of the present application may include:
amount unit 21, configured to mount a system file of the backup partition on the active partition;
an obtainingunit 22, configured to obtain version information of the backup partition according to a system file of the backup partition;
aninformation unit 23, configured to store the version information of the backup partition in the storage space of the active partition.
As shown in fig. 3, anelectronic device 300 is further provided in the embodiment of the present application, which includes amemory 310, aprocessor 320, and acomputer program 311 stored in thememory 320 and executable on the processor, and when thecomputer program 311 is executed by theprocessor 320, the steps of any method of the dual-image management are implemented.
Since the electronic device described in this embodiment is a device used for implementing a dual-mirror image management apparatus in this embodiment, based on the method described in this embodiment, a person skilled in the art can understand the specific implementation manner of the electronic device of this embodiment and various variations thereof, so that how to implement the method in this embodiment by the electronic device is not described in detail herein, and as long as the person skilled in the art implements the device used for implementing the method in this embodiment, the device falls within the scope of protection intended by this application.
In a specific implementation, thecomputer program 311 may implement any of the embodiments corresponding to fig. 1 when executed by a processor.
It should be noted that, in the foregoing embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to relevant descriptions of other embodiments for parts that are not described in detail in a certain embodiment.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
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.
Embodiments of the present application further provide a computer program product, where the computer program product includes computer software instructions, and when the computer software instructions are run on a processing device, the processing device is caused to execute a flow of dual-mirror management as in the corresponding embodiment of fig. 1.
The computer program product includes one or more computer instructions. The procedures or functions according to the embodiments of the present application are all or partially generated when the computer program instructions are loaded and executed on a computer. 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 on a computer readable storage medium or transmitted from one computer readable storage medium to another computer readable storage medium, for example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wire (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). A computer-readable storage medium may be any available medium that a computer can store or a data storage device, such as a server, a data center, etc., that is integrated with one or more available media. 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.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, a division of a unit is merely a logical division, and an actual implementation may have another division, 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 through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
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 application 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, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be substantially implemented or contributed to by the prior art, or all or part of the technical solution may be embodied in 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 method of the embodiments of the present application. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The above embodiments are only used to illustrate the technical solutions of the present application, and not to limit the same; although the present application has been described in detail with reference to the foregoing embodiments, it should 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 in the embodiments of the present application.