The implementation method that a kind of computer hard disk data recovers and backs upTechnical field
The present invention relates to the hard disc data safety technique, be specifically related to the implementation method that data are recovered and backed up in a kind of hard disc of computer.
Background technology
Along with popularizing of informationalized development and computing machine, people more and more be unable to do without this effective instrument of computing machine in daily live and work, and corresponding, very important a large number of users data storage is in the hard drive space of computing machine concerning the user.And along with the development of computing machine, computer virus also spreads unchecked day by day, and this security to hard disc of computer has brought acid test.Except computer virus, such as other factors of misoperation of users or system crash or the like, all might cause the very important data of user, file is lost or damage, thereby bring great loss to the user.Therefore, how efficiently and effectively protection and restoring user data become the focus of computer user's concern.Comprehensive present technology status, the recovery of conventional hard disc of computer information and the method for backup mainly comprise following several:
Method one: recover and back up by the backup hard disk.Need be in computing machine when making in this way a backup hard disk that is used to back up this hard disc data be set again the hard disk of storage operating system and user data except being used for.Though this method can back up all user data fully, the reliability height, but the financial burden that a hard disk can increase the user is set separately, this need revise the setting of Basic Input or Output System (BIOS) (BIOS) simultaneously, need certain computer expertise, for the general user, be not easy operation, therefore seem convenient inadequately.
Method two: use CD or floppy disk back up and recover.When making in this way, computer vendors directly is provided with a recovery dish that utilizes CD or floppy disk as carrier when computing machine dispatches from the factory, and has kept operating system and the application of software data of computing machine when dispatching from the factory.When the user's computer system crash, the user can directly use the recovery dish that computing machine is returned to state when dispatching from the factory.Though this method is easy to use, the recovery dish provides with the condiment form, and the user must properly preserve, and can not recover in case just lose again, and is therefore also also inconvenient concerning the user.Simultaneously, make the setting that computing machine can only be returned in this way when dispatching from the factory, can not accomplish backup in good time and recovery, have significant limitation.
Method three: back up and recover by set up different subregions at same hard disk.Some can carry out subregion to hard disk such as fdisk softwares such as GHOST at present, preserve Backup Data at newly-established subregion then, if the data of other subregions are destroyed, can utilize the data in the backup subregion to recover.Though this method is workable, but because newly-established backup subregion and other data are arranged in same hard disk, can not exempt the influence of computer virus or other operations fully, equally may be destroyed, simultaneously these backup files can accessed easily or deletion, so security and reliability are relatively poor.
Method four: back up based on BIOS merely and recover.Being called " hard disc data backup and restoration methods ", Chinese patent application in the applicant's name number is to have proposed a kind of method that backs up and recover based on BIOS merely in 01134778.3 the application for a patent for invention, in this method, control computer realizes that the program of data backup and recovery is fixedly installed in the BIOS chip, the user can press the backup hot key and enter the backup functionality menu in the BIOS start-up course, perhaps press the recovery hot key and enter the restore funcitons menu, thereby carry out system backup or system recovery work respectively.The reliability and the security of this method are indubitable; but it has two shortcomings: at first; the user is cumbersome when practical operation; because only the user just can press corresponding hot key when BIOS starts; the also operation that only computing machine could respond relevant backup and recover when BIOS starts; because the time that BIOS starts is very short; therefore the time that the user begins button occurs through regular meeting and surpassed the schedule time; thereby make computing machine no longer to the user by hot key respond; the user will carry out system recovery or backup then must be restarted computing machine, and is very inconvenient concerning the user.Second, the program that realizes data backup and recovery in this method is fixedly installed in the BIOS chip, if change software, necessary whole replacing BIOS chip, very inconvenient for software modification or upgrading, therefore also limited the use of this method.
Method five: realize recovering and backup based on BIOS and protection subregion.Name the applicant is called
" the hard disc of computer internal information recovers and the implementation method of backup ", Chinese patent application number realize recovering and the method for backup based on BIOS and protection subregion for having proposed in another piece application for a patent for invention of 02104483.X.This method has overcome the shortcoming of method four, realize to recover and the program code of backup is not to be fixedly installed on the BIOS chip, and is arranged in the embedded OS that is different from the routine operation system.When computer starting, can directly enter embedded OS, carry out corresponding program code, thereby realize recovering and backup.This method can only realize the backup mode of the magnetic track of whole subregion to magnetic track, and can not back up some or several files neatly, so its function is restricted greatly.And this method has very strong dependence for BIOS and embedded operating system kernel, must under off-mode, carry out in the use or restart computing machine, and be not very convenient concerning the user.
In sum, though proposed the method for multiple disk recovery/backup at present, but they have certain defective separately, in this several method, the security and the reliability of the 5th kind of method are the highest, but still there is very big defective aspect user's ease for use, concerning the user, making in this way and inconvenience.
Summary of the invention
In view of this, the purpose of this invention is to provide the method that a kind of hard disc of computer internal information that is easier to use recovers and backs up.
Above-mentioned purpose of the present invention is achieved by the following technical solutions:
A kind of backup of hard disc of computer information and the method for recovery comprise the steps:
A. in advance at the high-end protection subregion that marks off of hard disk, and will write the disk read-write driver of computer operating system to the code that the protection subregion opens and closes operation;
B. after receiving the order of carrying out information back-up or recovery, the disk read-write driver is opened the protection subregion, and closes the protection subregion after the protection subregion is finished the operation of information back-up or recovery.
In said method, for the disclosed operating system of source code, writing of step a is to add the code that the protection subregion is operated on the basis of the existing source code of disk read-write driver; For the undocumented operating system of source code, writing of step a is to regroup the disk read-write driver that comprises the code that the protection subregion is operated, and uses the disk read-write driver of regrouping to replace original disk read-write driver then.Wherein, the undocumented operating system of source code can be Windows operating system, and driver standard and Driver Development kit that this operating system of utilization cooperation provides in step a and the technical manual of following the protection subregion are regrouped the disk read-write driver.
In said method; in step a, adopt the ATA-5 standard to divide the protection subregion; the protection subregion comprises kernel and data backup district at least; and be embedded in kernel portion and carry out in the data backup district that hard disk information recovers and the program code of backup, and the program code that the backup file of data backup area is organized and managed.The organization and management here comprises the configuration information that comprises memory location and file attribute at least of each file that writes down sector distributed intelligence, the bibliographic structure information that writes down all backup files and record data backup area at least.And stored position information comprises initial sector information at least, and file attribute information comprises file size and date created information at least.
In said method, in step b, further comprise and compress processing more than or equal to 1 file, and be packaged as an image file what needs backed up, send an order of carrying out backup to the disk read-write driver then; Backup operation comprises the backup space that image file is write the reservation of data backup district, and generate the configuration file of the file attribute information of initial sector, file size and a date created that writes down this image file at least, and upgrade the bibliographic structure information in the kernel.Wherein image file comprises a file header, and file header has write down the file attribute information of each son file in the backup file, and compress mode and reorganization mode information.
In said method, the disk read-write driver further comprises the order that receives a demonstration kernel back-up file directories structure before opening the protection subregion in step b, after opening the protection subregion, further comprise: the bibliographic structure information of fetch protection subregion kernel, and this information is presented on the computer screen, write down the fileinfo that the needs selected by the user recover then; Recovery operation comprises the image file that the compression packing forms that pass through of location this document information correspondence, and the configuration file of generation sends to the disk read-write driver with this image file and when disposing; Further comprise that image file is carried out decompress(ion) to contract and store the step of visible fdisk into after the subregion closing protection.
In said method, can further carry out when opening the protection subregion and encrypt or the anti-virus operation.
In said method, between step a and step b, further comprise the steps:
Utilize hardware trigger that mainboard is powered on and start BIOS, according to hardware trigger mode storage computation machine Starting mode information, wherein computer starting mode information comprises that at least expression starts the information of routine operation system and the information of expression startup embedded OS in the pen recorder of while in hardware;
BIOS reads from pen recorder and judges computer starting mode information; if expression starts the routine operation system; execution in step b then; if expression starts embedded OS; then BIOS operates the hard disk protection subregion; load the Embedded Operating System kernel, start recovery/backup functionality then, recover/back-up processing.
From technical scheme of the present invention as can be seen; owing to revised the disk read-write driver of operating system bottom; make it can be directly open, close the protection subregion and operation such as read-write in the routine operation system; thereby the backup and the recovery that make the user can start shooting again and just can carry out hard disk information are therefore convenient in realization.Under the routine operation system, to the protection subregion when operating, can utilize simultaneously and encrypt and technology such as anti-virus, so in handled easily, can't reduce the security and the reliability of hard disk data protection.
Secondly; be to utilize the protection subregion to carry out data backup and recovery equally; can only carry out the copy of magnetic track in the former technology to magnetic track; can't under the protection subregion, reorganize and manage Backup Data; perhaps can only simply compress and mark; the physical address of recorded data source on disk operated in the time of also can only be according to backup when recovering; be that backup or recovery all are very restricted like this, and after hard disk carries out again subregion and adjusts, just can't normally recover.The present invention embeds the code that data backup area file is organized and managed at protection subregion kernel; can manage and organize in the mode that is similar to the file system management file Backup Data like this; make the user can visit detailed backup file information; can be that unit returns to arbitrarily under the specified path of visible partition freely with the file simultaneously; and the restriction that not chosen by subregion adjustment or backup source; this has surmounted the magnetic track copy mode widely; make the user can be more neatly back up and recover to some files or partial document, more flexible in the use and convenient.
Description of drawings
Fig. 1 is a hard disk protection subregion configuration diagram of the present invention;
Fig. 2 is the planning synoptic diagram of hard disk protection subregion of the present invention;
Fig. 3 recovers and the backup functionality system chart under the operating system of the present invention;
Fig. 4 is to protecting the write operation process flow diagram of subregion under the operating system of the present invention;
Fig. 5 is to protecting the read operation process flow diagram of subregion under the operating system of the present invention;
Fig. 6 is the overview flow chart of the present invention in conjunction with backup under the embedded OS and restoration methods.
Embodiment
The present invention will be described in more detail below in conjunction with the drawings and specific embodiments.
In order to realize high level protection to the hard disk internal information, the present invention still adopted known technology ATA-5 and later on " the Host Protected Area " function in the standard at the high-end protection subregion that is used to preserve backup information that marks off of hard disk.For total system, hard drive space is made up of two parts as shown in Figure 1 like this, and a part is normal hard drive space, i.e. the subregion that can show under operating system; Another part is the protection subregion, and it is sightless under the operating system of routine, can only just can open and revise by special means, thereby have very high security.Hard drive space shows as a hard disk physically like this, logically then shows as two hard disks.
Protection subregion shown in Figure 1 comprises three parts: kernel, dispatch from the factory backup area and data backup district.Wherein kernel has embedded the code of file backup function and system partitioning backup functionality, and the code of restore funcitons, but also can comprise the code of carrying out other functions.The backup area that dispatches from the factory is used for storing user's system partitioning backup file, the hard disc data information when just producer dispatches from the factory.The data backup district adjacent with this zone then is used as the storage space of backup file, and its size can be adjusted by application program as required, thus the authority of effectively protecting the user to use.Simultaneously, the present invention also provides the function of unloading protecting subregion, is visible hard drive space thereby can discharge sightless protection subregion in the DISK to Image space.
Protection subregion framework can see in Fig. 2 that as shown in Figure 2 the protection subregion is to divide from high-end beginning of hard disk, just begin to divide from the last magnetic track of hard disk, and still to take with the sector is the organizational form of unit.Be the Organization And Management in data backup zone in the example explanation protection subregion below with several sectors.Here corresponding the sector of physical hard disk with the sector of Backup Data.Consider that data backup district size can change by application program, therefore for the planning of whole protecting subregion, its size is variable.And for a definite hard disk, the position of Backup Data 1-1 sector is fixing and confirmable, and the framework for the backup area of whole data can be a benchmark with it so.
After the position of having determined 1-1 sector, Backup Data district, determine the size in whole data backup zone, just can determine the position of each sector of backup area then according to mode as shown in Figure 2.Note the situation that this sector, zone distributes in kernel portion, so just with all sectors of whole backup area effectively Organization And Management got up.Except setting up the index information of sector, to write down memory location and some other information of each file under the backup area in the kernel simultaneously, this is similar to a kind of bibliographic structure, can note some attributes of initial sector, file size, foundation date or the like of each file.By the way, we have realized the Management And Organization to the protection partition data.For example the selected file that will back up of user will be packaged into an image file; during this image file write protection subregion; the kernel of protection subregion can generate a configuration file simultaneously; be used for writing down some necessary informations of this image file, for example found the verification of date, file name and association attributes, file size and in the memory location of backup area etc.Like this, the bibliographic structure in the kernel just can have been managed each image file easily by these configuration informations.
Because the protection subregion is sightless for the routine operation system at present; in other words; the disk read-write driver of present routine operation system can only be operated the visible partition of hard disk, and the function of the protection subregion in the hard disk being carried out any operation is not provided.Therefore, after having set up the protection subregion according to the method described above, next need to develop the corresponding driving program, thereby be implemented under the routine operation system protecting the read-write operation of subregion.
Fig. 3 is that the present invention recovers and the backup functionality system chart.As can be seen from Figure 3; the whole functional system can be divided into document processing module, data processing module and operation protection division module; wherein document processing module is mainly used in collection user profile; data processing module is mainly used in data is compressed and operation such as packing, and the operation protection division module then is directly used in and protects subregion to carry out data and order transmits.In backup and the process recovered, can encrypt and operation such as anti-virus, of the present inventionly focus on having revised the operation protection division module at data processing module or operation protection division module.
At first, according to setting up the program code that ATA-5 standard exploitation that the protection section post adopts realizes the opening of protection subregion, shutoff operation, and this part code joined in the driver that the operating system bottom controls disk read-write.That is to say that this part driver has been taken over all read-write operations to hard disk comprehensively, is all to use this part driver to visible fdisk under the normal condition or to the operation of protection subregion.Close tightening security property of technological means such as protection subregion after can also adopting simultaneously encryption, anti-virus and visit to finish immediately, these means all are easy to realize to those skilled in the art, therefore are not elaborated.
In actual conditions, for the disclosed operating system of source code, for example Linux etc. can directly make amendment to the disk read-write driver of operating system bottom, adds the code that the protection subregion is made amendment.And for the operating system of unexposed source code, for example present modal Windows operating system, because it does not disclose the source code of whole operation system, therefore can not get the source code of disk read-write driver yet, thereby can not directly make amendment on this basis.In this case, said process needs to regroup the complete disk read-write driver of a cover in fact.
When regrouping complete disk read-write driver, need to utilize supporting driver standard that provides of Windows operating system and Driver Development kit are provided, and need follow the employed ATA-5 standard of protection partitioning technique.In the ATA-5 standard, stipulated how to open and close the protection subregion; therefore utilize these regulations; can develop the code of the protection subregion being opened, closing etc. operation; the developing instrument here can use C language or assembly language supervisor language; not difficult for the programming personnel of this area as for concrete performance history, therefore introduce no longer in detail here.
Here it is emphasized that; the purpose of regrouping the disk read-write driver is to work out the code that opens and closes the protection subregion; thereby making the protection subregion also is visible and manipulable under the routine operation system; operating system can be as the operation visible partition like this; the protection subregion is carried out identical operations such as read-write, thereby the purpose that has realized under the routine operation system, carrying out file backup and recovery.
After having regrouped complete disk read-write driver, the disk read-write driver that replaces Windows to carry with new disk read-write driver, thus taken over bottom operation to hard disk comprehensively.Like this; under the operating system environment such as Windows of routine; also can operation such as read and write, thereby under the prerequisite of security that does not damage data backup and reliability, can carry out data backup and recovery more easily the protection subregion in the hard drive space.
After having revised the disk read-write driver, describe the method for hard disc data backup of the present invention in detail below with reference to Fig. 4.
At first, application program reads instep 401 needs backed up data, reorganize and data processing such as compression instep 402 pair data then, packing data after handling is made an image file, this image file includes file header, and file header has write down the correlation attribute information of each son file in the backup file or sub-folder and how to have compressed and information such as reorganization.
In the application program ofstep 403 and supporting exploitation of operating system bottom disk read-write driver and use and the disk read-write driver communication of operating system bottom.The disk read-write driver of bottom is carried out command adapted thereto instep 404 then, opens the protection subregion, in this process, can adopt technology such as encryption and anti-virus to improve the security ofoperation.In step 405; in the backup space that the disk read-write driver is reserved the image file write protection subregion set up previously; instep 406; the code of protection subregion kernel generates configuration file; configuration file has write down the relevant information attribute of image file, and in the kernel bibliographic structure registration updating.After having finished above-mentioned steps, the backed up data that needs that is about in the hard disk has backuped among theprotection subregion.In step 407, the disk read-write driver is closed the protection subregion.
By above-mentioned steps, the user can backup to the protection subregion with the mode of the data in the hard disk by file, describes in detail below in conjunction with Fig. 5 and how to carry out file from the protection subregion and recover.
Instep 501, the application program under the operating system sends an instruction that shows backup data information for bottom disk read-write driver, and instep 502, the disk read-write driver is opened the protection subregion, reads bibliographic structure information from protectionsubregion kernel.In step 503, application program is shown to the user with tabulation or form such as file tree with the detailed data information of content in the data backup district andbackup file.In step 504, the user can select to need the file that recovers or need select to recover from the information that shows certain backup, application records user's selection information.
Instep 505, application program is sent one for the disk read-write driver and carries out the order that recovers, and after driver receives this order, sends one instep 506 to the protection subregion and recoversorder.In step 507, protection subregion kernel code searches in all backup informations and consumer positioning recovers needed image file.
Instep 508, bsp driver is carried out read operation to the protection subregion, reads the image file that previous step is located from theprotection subregion.In step 509, bsp driver is closed the protection subregion then.Instep 510, application program this image file that decompresses, and its concrete data that comprise are written to the path of the visible partition of user's appointment in step 511.So far, finished the rejuvenation of data.
When practical application is of the present invention, both can under operating system, use separately, also can with based on BIOS and the protection partitioned method be used.Fig. 6 shows the overview flow chart of latter event.
As can be seen from Figure 6; when computer starting; BIOS at first judges the computer starting pattern; if enter embedded OS; then BIOS operation A TA-5 protects subregion; be written into embedded operating system kernel, carry out the backup in this kernel then and recover code, realize backup and the recovery of magnetic track track wise.If the computer starting modal representation starts the routine operation system, then can under the routine operation system, carry out the backup and the recovery of file-level according to Fig. 4 and step shown in Figure 5.
Be appreciated that above-mentioned explanation is the displaying to spirit of the present invention, not in order to restriction protection scope of the present invention.