Disclosure of Invention
The invention provides a backup method and a backup device which can automatically select whether to perform backup according to actual backup conditions.
In order to solve the above technical problem, an embodiment of the present invention provides a backup method, including:
the method comprises the steps that a current partition table and a historical partition table of an operating system are obtained, the current partition table records storage information of a target storage area of the operating system in a current to-be-started state, and the historical partition table records storage information of the target storage area corresponding to each to-be-started state of the operating system in historical time;
and determining whether to back up the storage content of the current target storage area or not based on the content recorded by the current partition table and the historical partition table.
Optionally, the obtaining a current partition table and a historical partition table of the operating system includes:
and in the power-on self-test stage, obtaining a current partition table and a historical partition table of the operating system.
Optionally, the determining whether to back up the storage content of the current target storage area based on the content recorded in the current partition table and the historical partition table includes:
calculating the change rate of the recorded content between the current partition table and a first historical partition table corresponding to the last time when the operating system is in a to-be-started state;
and determining whether to back up the storage content of the current target storage area or not based on the change rate.
Optionally, storing the generated rate of change calculated each time the operating system is in a state to be started in historical time;
the determining whether to back up the storage content of the current target storage area based on the change rate includes:
determining the mean value and the variance of all currently stored change rates;
and determining whether to back up the storage content of the current target storage area or not based on the change rate formed by the auxiliary calculation of the current partition table and the mean value and the variance.
Optionally, the determining whether to back up the storage content of the current target storage area based on the change rate formed by the auxiliary calculation of the current partition table and the mean and the variance includes:
calculating to obtain an adaptive threshold value based on the mean value and the variance;
and determining whether to back up the storage content of the current target storage area or not based on the relation between the change rate formed by the auxiliary calculation of the current partition table and the adaptive threshold.
Optionally, after the determining whether to back up the storage content of the current target storage area based on the relationship between the change rate formed by the current partition table aided calculation and the adaptive threshold, the method further includes:
and storing the change rate formed by the auxiliary calculation of the current partition table, and updating the mean value and the variance based on the change rate formed by the auxiliary calculation of the current partition table.
Optionally, before the obtaining the current partition table and the historical partition table of the operating system, further includes:
judging whether the backup data corresponding to the target storage area is stored currently, if so, obtaining a current partition table and a historical partition table of the operating system, and if not, directly backing up the storage content of the target storage area.
Optionally, before the obtaining the current partition table and the historical partition table of the operating system, further includes:
determining the time difference between the last backup completion time of the target storage area and the current time;
and judging the relation between the time difference and a time threshold, if the difference exceeds the time threshold, directly backing up the storage content of the current target storage area, and if the difference does not exceed the time threshold, acquiring a current partition table and a historical partition table of the operating system.
Optionally, the storage content of the target storage area includes a system file and/or a data file of the operating system.
Another embodiment of the present invention also provides a backup device, including:
the system comprises an obtaining module, a judging module and a judging module, wherein the obtaining module is used for obtaining a current partition table and a historical partition table of an operating system, the current partition table records the storage information of a target storage area of the operating system in a current to-be-started state, and the historical partition table records the storage information of the target storage area corresponding to each to-be-started state of the operating system in historical time;
and the backup module is used for determining whether to backup the storage content of the current target storage area according to the content recorded by the current partition table and the historical partition table.
Based on the disclosure of the embodiment, the embodiment of the invention has the advantages that whether the operating system needs to be backed up currently or not can be determined according to the content recorded by the current partition table and the historical partition table of the operating system, no user input operation is needed in the whole process, the user backup process is simplified, the phenomena of redundant backup and untimely backup cannot occur, and the backup efficiency and precision are greatly improved.
Detailed Description
The following detailed description of specific embodiments of the present invention is provided in connection with the accompanying drawings, which are not intended to limit the invention.
It will be understood that various modifications may be made to the embodiments disclosed herein. The following description is, therefore, not to be taken in a limiting sense, but is made merely as an exemplification of embodiments. Other modifications will occur to those skilled in the art within the scope and spirit of the disclosure.
The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate embodiments of the disclosure and, together with a general description of the disclosure given above, and the detailed description of the embodiments given below, serve to explain the principles of the disclosure.
These and other characteristics of the invention will become apparent from the following description of a preferred form of embodiment, given as a non-limiting example, with reference to the accompanying drawings.
It should also be understood that, although the invention has been described with reference to some specific examples, a person of skill in the art shall certainly be able to achieve many other equivalent forms of the invention, having the characteristics as set forth in the claims and hence all coming within the field of protection defined thereby.
The above and other aspects, features and advantages of the present disclosure will become more apparent in view of the following detailed description when taken in conjunction with the accompanying drawings.
Specific embodiments of the present disclosure are described hereinafter with reference to the accompanying drawings; however, it is to be understood that the disclosed embodiments are merely examples of the disclosure that may be embodied in various forms. Well-known and/or repeated functions and structures have not been described in detail so as not to obscure the present disclosure with unnecessary or unnecessary detail. Therefore, specific structural and functional details disclosed herein are not to be interpreted as limiting, but merely as a basis for the claims and as a representative basis for teaching one skilled in the art to variously employ the present disclosure in virtually any appropriately detailed structure.
The specification may use the phrases "in one embodiment," "in another embodiment," "in yet another embodiment," or "in other embodiments," which may each refer to one or more of the same or different embodiments in accordance with the disclosure.
Hereinafter, embodiments of the present invention will be described in detail with reference to the accompanying drawings.
As shown in fig. 1, an embodiment of the present invention provides a backup method, including:
the method comprises the steps that a current partition table and a historical partition table of an operating system are obtained, the current partition table records storage information of a target storage area of the operating system in a current to-be-started state, and the historical partition table records storage information of the target storage area corresponding to the operating system in each to-be-started state in historical time;
and determining whether to back up the storage content of the current target storage area or not based on the content recorded by the current partition table and the historical partition table.
For example, the operating system stores a plurality of partition tables, which are small subsets that divide the data of a large table into partitions, and are of the types FAT16, FAT32, NTFS, exFAT, Ext2/3/4, HFS +, VMFS. In addition, the type division of the partition table mainly includes: range, list, and hash partitions. The basis for partitioning is mainly according to its table internal properties. The current partition table records storage information of a target storage area, that is, storage information of the target storage area in the current to-be-started state of the operating system, where the operating system is not yet started, for example, the storage information is only storage information of the target storage area in a BIOS stage starting process, and the target storage area may be, for example, a storage area of a system file of the operating system, a metafile of an application program, and the like, and is not particularly limited, but may also be a data file, that is, another file other than the system file of the operating system, and the target storage area may be any storage area in a hard disk or a storage area provided by another storage device. The historical partition table records storage information of a target storage area corresponding to each time the operating system is in a to-be-started state in historical time, for example, the storage information of the target storage area recorded by the partition table in the process of starting and using equipment by a user in a past time period. And after the current partition table and the historical partition table are obtained, the system comprehensively determines whether to back up the storage content of the current target storage area or not based on the content recorded by the current partition table and the historical partition table.
Based on the disclosure of the above embodiment, it can be known that the embodiment has the beneficial effects that whether the operating system needs to be backed up currently can be determined according to the content recorded by the current partition table and the historical partition table of the operating system, no user input operation is required in the whole process, the user backup process is simplified, the phenomena of redundant backup and untimely backup cannot occur, and the backup efficiency and precision are greatly improved.
Specifically, as shown in fig. 2, in the embodiment, obtaining the current partition table and the historical partition table of the operating system includes:
in the power-on self-test stage, a current partition table and a historical partition table of the operating system are obtained.
For example, in this embodiment, the current partition table and the historical partition table of the operating system are obtained when the system is in the BIOS start stage, but may also be in other program running stages for implementing the BIOS function, which is not specifically determined.
Further, as shown in fig. 2 and fig. 3, in this embodiment, determining whether to back up the storage content of the current target storage area based on the content recorded in the current partition table and the historical partition table includes:
calculating the change rate of the recorded contents between the current partition table and a first historical partition table corresponding to the last time when the operating system is in a state to be started;
and determining whether to back up the storage content of the current target storage area based on the change rate.
For example, taking the content stored in the target area as the system file of the operating system as an example, when the user used the device last time, the system file is modified, for example, part of the content is deleted, and part of the content is added, and the result data of the operation process is recorded in the partition table when the device is used this time. The partition table corresponds to a first historical partition table corresponding to the last time the operating system is in a state to be started. When a user shuts down the electronic device and restarts the electronic device at the current time, the corresponding started partition table is the partition table when the user started the device last time, the device judges whether the contents of the two partition tables change or not by comparing the current partition table with the first historical partition table, and determines the change rate based on the change, if the change rate meets the corresponding threshold value, the change is large, the contents of the target storage area need to be backed up, and if the change rate does not meet the corresponding threshold value, the change is small, and the contents of the target storage area do not need to be backed up. In this embodiment, since the user deletes or adds the stored content, the corresponding change rate is large, that is, the change is large, and in order to avoid the loss of the stored content, it is determined that the content of the target storage area needs to be backed up in this embodiment.
Specifically, as shown in fig. 2 and 4, the present embodiment stores the generated change rate calculated by the operating system each time the operating system is in the standby state during the historical time;
determining whether to back up the storage content of the current target storage area based on the change rate comprises the following steps:
determining the mean value and the variance of all currently stored change rates;
and determining whether to back up the storage content of the current target storage area based on the change rate formed by the auxiliary calculation of the current partition table and the mean value and the variance.
For example, in this embodiment, the change rate calculated by the device based on the contents of the historical partition table and the current partition table is recorded each time the operating system is in the to-be-started state. When the device is determining whether to back up the content of the current target storage area, the device may calculate the mean and variance thereof based on all the change rates of the current storage, and then determine whether to back up the storage content of the current target storage area based on the change rates formed by the auxiliary calculation of the current partition table and the mean and variance.
Further, the embodiment determines whether to back up the storage content of the current target storage area based on the change rate formed by the auxiliary calculation of the current partition table and the mean and the variance, and includes:
calculating to obtain an adaptive threshold value based on the mean value and the variance;
and determining whether to back up the storage content of the current target storage area or not based on the relation between the change rate formed by the auxiliary calculation of the current partition table and the adaptive threshold.
For example, each time the operating system is started, a partition storing the operating system backed-up files is backed up by the partition table, and the change rate C1 between the current partition table layout2 at the time of the operating system startup and the first partition table layout1 backed up at the time of the operating system startup is calculated. When the next time of starting, the change rates of layout3 and layout2 are calculated, the change rates are recorded as C2, and the like, and a sequence C (C1, C2... Cn) for recording the change rate of the partition table when the operating system is started each time is formed.
At each boot of the operating system, the mean (C1+ C2+.. + Cn-1)/(n-1) and variance σ n-1 of Cn (rate of change) calculated at this boot are compared with the mean (C1+ C2+. cnn-1) and variance σ n-1 of C1, C2... Cn-1 of the previous n-1 boots as follows:
triggering backup if Cn ≧ (C1+ C2+. + Cn-1)/(n-1) +2 xsigma n-1, putting Cn into the sequence C, and recalculating the mean value and the variance;
if Cn < (C1+ C2+. + Cn-1)/(n-1) +2 × σ n-1, not triggering backup, and simultaneously putting Cn into the sequence C, and recalculating the mean value and the variance;
in this embodiment, when Cn ≧ C (C1+ C2+ ·+ Cn-1)/(n-1) +2 × σ n-1, it is considered that the operating system (file) change rate is at the top 5%, then backup is triggered.
For convenience of calculation, a statistical model of the change rate is established based on the calculation and comparison processes in this embodiment, and the specific type of the model is not fixed, and may be, for example, a normal distribution model.
Further, after determining whether to back up the storage content of the current target storage area based on the relationship between the change rate formed by the auxiliary calculation of the current partition table and the adaptive threshold, the embodiment further includes:
and storing the change rate formed by the auxiliary calculation of the current partition table, and updating the mean value and the variance based on the change rate formed by the auxiliary calculation of the current partition table.
That is, each new calculated change rate is stored, and the stored change rate set changes due to the addition of the new change rate, so that the device recalculates the mean and variance based on the currently calculated change rate and the previously stored change rate, and stores the new mean and variance for use in determining whether to perform backup at the next device start.
Optionally, before obtaining the current partition table and the historical partition table of the operating system, the present embodiment further includes:
judging whether the backup data corresponding to the target storage area is stored currently, if the backup data is stored, obtaining a current partition table and a historical partition table of the operating system, and if the backup data is not stored, directly backing up the storage content of the current target storage area.
Or
Before obtaining the current partition table and the historical partition table of the operating system, the method further comprises the following steps:
determining the time difference between the last backup completion time of the target storage area and the current time;
and judging the relation between the time difference and the time threshold, if the difference exceeds the time threshold, directly backing up the storage content of the current target storage area, and if the difference does not exceed the time threshold, acquiring a current partition table and a historical partition table of the operating system.
For example, when the computer is powered on, the BIOS starts, and the following determination is made:
(1) determining whether the storage content of the target storage area has backup or not, if not, immediately carrying out backup or outputting a prompt to suggest a user to carry out backup;
(2) whether backup is carried out within a certain time interval T (for example, T can be set to be 3 months) or not, if not, backup is carried out immediately, or a prompt is output to suggest a user to carry out backup;
(3) if the two layers of judgment are both determined, the judgment steps are executed, whether the change rate of the operating system file is larger than a self-adaptive threshold value or not is judged based on the partition table, and if the change rate of the operating system file is larger than the self-adaptive threshold value, automatic backup is executed or a prompt is output to suggest a user to backup.
As shown in fig. 5, another embodiment of the present invention further provides a backup apparatus, including:
the obtaining module is used for obtaining a current partition table and a historical partition table of the operating system, the current partition table records the storage information of a target storage area in the current to-be-started state of the operating system, and the historical partition table records the storage information of the target storage area in each to-be-started state of the corresponding operating system in historical time;
and the backup module is used for determining whether to backup the storage content of the current target storage area according to the content recorded by the current partition table and the historical partition table.
For example, the operating system stores a plurality of partition tables, which are small subsets that divide the data of a large table into partitions, and are of the types FAT16, FAT32, NTFS, exFAT, Ext2/3/4, HFS +, VMFS. In addition, the type division of the partition table mainly includes: range, list, and hash partitions, the partitioning is based mainly on their table internal properties. The current partition table records storage information of a target storage area, that is, storage information of the target storage area in which the operating system is not started yet in the current to-be-started state, for example, the storage information is only storage information of the target storage area in a BIOS stage starting process, the target storage area may be, for example, a storage area of a system file of the operating system, a metafile of an application program, and the like, and is not specifically determined, and the target storage area may be any storage area in a hard disk, or a storage area provided by another storage device. The historical partition table records storage information of a target storage area corresponding to each time the operating system is in a to-be-started state in historical time, for example, the storage information of the target storage area recorded by the partition table in the process of starting and using equipment by a user in a past time period. When the obtaining module obtains the current partition table and the historical partition table, the backup module comprehensively determines whether to backup the storage content of the current target storage area or not based on the content recorded by the current partition table and the historical partition table.
Based on the disclosure of the above embodiment, it can be known that the embodiment has the beneficial effects that whether the operating system needs to be backed up currently can be determined according to the content recorded by the current partition table and the historical partition table of the operating system, no user input operation is required in the whole process, the user backup process is simplified, the phenomena of redundant backup and untimely backup cannot occur, and the backup efficiency and precision are greatly improved.
Optionally, the obtaining a current partition table and a historical partition table of the operating system includes:
and in the power-on self-test stage, obtaining a current partition table and a historical partition table of the operating system.
Optionally, the determining whether to back up the storage content of the current target storage area based on the content recorded in the current partition table and the historical partition table includes:
calculating the change rate of the recorded content between the current partition table and a first historical partition table corresponding to the last time when the operating system is in a to-be-started state;
and determining whether to back up the storage content of the current target storage area or not based on the change rate.
Optionally, storing the generated rate of change calculated each time the operating system is in a state to be started in historical time;
the determining whether to back up the storage content of the current target storage area based on the change rate includes:
determining the mean value and the variance of all currently stored change rates;
and determining whether to back up the storage content of the current target storage area or not based on the change rate formed by the auxiliary calculation of the current partition table and the mean value and the variance.
Optionally, the determining whether to back up the storage content of the current target storage area based on the change rate formed by the auxiliary calculation of the current partition table and the mean and the variance includes:
calculating to obtain an adaptive threshold value based on the mean value and the variance;
and determining whether to back up the storage content of the current target storage area or not based on the relation between the change rate formed by the auxiliary calculation of the current partition table and the adaptive threshold.
Optionally, after the determining whether to back up the storage content of the current target storage area based on the relationship between the change rate formed by the current partition table aided calculation and the adaptive threshold, the method further includes:
and storing the change rate formed by the auxiliary calculation of the current partition table, and updating the mean value and the variance based on the change rate formed by the auxiliary calculation of the current partition table.
Optionally, the method further comprises:
the first judging module is used for judging whether backup data corresponding to the target storage area is stored currently, if the backup data is stored, obtaining a current partition table and a historical partition table of the operating system, and if the backup data is not stored, directly backing up the storage content of the current target storage area.
Optionally, the method further comprises:
the second judgment module is used for determining the time difference value between the last backup completion time of the target storage area and the current time;
and judging the relation between the time difference and a time threshold, if the difference exceeds the time threshold, directly backing up the storage content of the current target storage area, and if the difference does not exceed the time threshold, acquiring a current partition table and a historical partition table of the operating system.
Optionally, the storage content of the target storage area includes a system file of the operating system.
A backup system in this embodiment includes:
at least one of the processors 602 is configured to,
a memory 604 communicatively coupled to the at least one processor,
the memory stores instructions executable by the one processor to be executed by the at least one processor to implement the method as described above.
Fig. 6 is a schematic diagram of a connection relationship between components of a backup system according to an embodiment of the present application. As shown in fig. 6, the backup system 600 in the present embodiment may include one or more of the following components: processing component 602, memory 604, power component 606, multimedia component 608, audio component 610, input/output (I/O) interface 612, sensor component 614, and communication component 616.
The processing component 602 generally controls the overall operation of the backup system 600. The processing component 602 may include one or more processors 620 to execute instructions to perform all or a portion of the steps of the methods described above. Further, the processing component 602 can include one or more modules that facilitate interaction between the processing component 602 and other components. For example, the processing component 602 can include a multimedia module to facilitate interaction between the multimedia component 608 and the processing component 602.
Memory 604 is configured to store various types of data to support operations at backup system 600. Examples of such data include instructions for any application or method operating on the backup system 600, such as text, pictures, videos, and so forth. The memory 604 may be implemented by any type or combination of volatile or non-volatile memory devices such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disks.
The power component 606 provides power to the various components of the backup system 600. The power components 606 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power supplies for the backup system 600.
The multimedia component 608 includes a screen that provides an output interface between the backup system 600 and the user. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 608 may also include a front facing camera and/or a rear facing camera. The front camera and/or the rear camera may receive external multimedia data when the backup system 600 is in an operation mode, such as a shooting mode or a video mode. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
The audio component 610 is configured to output and/or input audio signals. For example, audio component 610 may include an alarm and a microphone configured to receive external audio signals when protection monitoring system 600 is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signal may further be stored in the memory 604 or transmitted via the communication component 616. In some embodiments, audio component 610 further includes a speaker for outputting audio signals.
The I/O interface 612 provides an interface between the processing component 602 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to: a home button, a volume button, a start button, and a lock button.
The sensor component 614 includes one or more sensors for providing various aspects of status assessment for the backup system 600. For example, the sensor component 614 may include an acoustic sensor. Additionally, the sensor component 614 may detect an open/closed status of the backup system 600, the relative positioning of components, such as a display and keypad of the backup system 600, the sensor component 614 may also detect a change in the position of the backup system 600 or a component of the backup system 600, the presence or absence of user contact with the backup system 600, the orientation or acceleration/deceleration of the backup system 600, and a change in the temperature of the backup system 600. The sensor assembly 614 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 614 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 614 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component 616 is configured to enable the backup system 600 to provide communication capabilities with other devices and cloud platforms in a wired or wireless manner. The backup system 600 may access a wireless network based on a communication standard, such as WiFi, 2G, or 3G, or a combination thereof. In an exemplary embodiment, the communication component 616 receives broadcast signals or broadcast related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 616 further includes a Near Field Communication (NFC) module to facilitate short-range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, Ultra Wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, the backup system 600 may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, micro-controllers, microprocessors, or other electronic components for performing the above-described methods.
The present invention also provides a computer-readable storage medium having instructions that, when executed by a processor corresponding to a backup system, enable the backup system to implement the method as described above.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention 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, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. 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 processor, 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.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.
The above embodiments are only exemplary embodiments of the present invention, and are not intended to limit the present invention, and the scope of the present invention is defined by the claims. Various modifications and equivalents may be made by those skilled in the art within the spirit and scope of the present invention, and such modifications and equivalents should also be considered as falling within the scope of the present invention.