Embodiment
A kind of method of protecting the data of hard disk of the present invention; see also Figure 1 and Figure 2; the data method of protection hard disk of the present invention is applied in a hard disk; after hard disk is employed the program setting protection; in hard disk, cook up defence program storage area 1, hard disk identification code district 2 and backup disk in advance at least and cut apart list area 3; and when computing machine is finished selftest and initialization (BIOS POST); the defence program that elder generation fetch protection program storage area 1 is stored; and handle according to the step that defence program sets; and the step of defence program comprises:
Step 10, computing machine read the hard disk identification code that is stored in advance in the hard disk identification code district 2;
Step 11, computing machine judge that the hard disk identification code is whether identical with the set computer Recognition sign indicating number of computing machine, if, carry out step 12, otherwise, carry out step 15; In the present invention, the computer Recognition sign indicating number can be system management Basic Input or Output System (BIOS) (SMBIOS; System Management BIOS) general unique identifier (Universal Unique Identification, UUID) value of field of form 1 (Type 1);
Step 12, computing machine is judged main sector 4 (the 0th magnetic post of hard disk, the 0th magnetic head, first sector activated of hard disk, the top sector of hard disk just) disk in is cut apart the list area 5 (empty that whether is cleared, meaning promptly, disk is cut apart list area 5 no disk contingency tables), if carry out step 13, otherwise, carry out step 14;
Step 13, computing machine are cut apart each backup disk contingency table that list area 3 stores in advance with backup disk and are copied to disk and cut apart in the list area 5 respectively as a disk contingency table; In the present invention, each backup disk contingency table duplicates hard disk and is stored in all disk contingency tables that the main disk that activates sector 4 is cut apart list area 5 before not protected as yet, so, each backup disk contingency table is copied to disk cut apart in the list area 5, promptly be to be used for recovering disk to cut apart the original state in list area 5;
Step 14, computing machine are handled (function of this boot code is for loading and carry out the start sector program in the activation hard disk cut section) according to the main boot code that activates in the sector 4 again, in order to finish the activation manipulation system, promptly finish; Because computing machine is handled according to boot code again, can read the disk contingency table, the step of the line activating operating system of going forward side by side is prior art, so be not described in detail at this;
Step 15, computing machine judge that disk cuts apart list area 5 and whether be cleared, if, carry out step 18, otherwise, carry out step 16;
Step 16, computing machine are duplicated at present all disk contingency tables of cutting apart list area 5 at disk becomes each backup disk contingency table that this backup disk is cut apart list area 3 respectively;
Step 17, computing machine empty all disk contingency tables that disk is cut apart list area 5;
Step 18, computing machine is handled output notice information according to boot code, cuts apart list area 5 no disk contingency tables in order to the expression disk, promptly finishes.Because computing machine is handled according to boot code again, because of disk is cut apart list area 5 no any disk contingency tables, and then output notice information is prior art, so also no longer be repeated in this description at this.
By above-mentioned treatment step as can be known; when the hard disk identification code of hard disk is identical with the computer Recognition sign indicating number; disk in the hard disk is cut apart list area 5 and just can be stored the disk contingency table; make computing machine can read each disk contingency table, and finish the action of start, otherwise; disk in the hard disk is cut apart list area 5 and will be cleared; so, computing machine can't be finished the processing of activation manipulation system, promptly reaches the purpose of the data of protection hard disk.
Because; hard disk is employed the program setting protection; in hard disk, cook up hard disk identification code district 2, defence program storage area 1 and backup disk in advance at least and cut apart list area 3; could handle according to above-mentioned defence program; and reach the purpose of data of protection hard disk; so; in a preferred embodiment of the present invention; see also shown in Figure 3; computing machine is according to the application setting hard disk protection; cut apart the step of list area 3 in order in hard disk, to cook up hard disk identification code district 2, defence program storage area 1 and backup disk at least, comprising:
Step 20, computing machine is cut apart 5 of list areas at main sector 4 set skip zone 6 and the disks that activate, the promptly main sector 4 of activating is set up defence program storage area 1, hard disk identification code district 2 and backup disk in regular turn and is cut apart list area 3 (as shown in Figure 1) originally in order to store the storage area of boot code (boot code);
Step 21, computing machine write the jmp instruction in skip zone 6, this instruction will skip to defence program storage area 1 in the main address of activating in the sector 4 of beginning of opening;
Step 22, computing machine copies to hard disk identification code district 2 as the hard disk identification code with the computer Recognition sign indicating number;
Step 23, computer backup disk are cut apart 3 of list areas and as preparation disk are cut apart the storage area that all disk contingency tables in the list area 5 save as each backup disk contingency table;
Step 24, guard of computer program storage area 1 write protection program, hard disk identification code district 2 and backup disk are cut apart list area 3 in the main address of activating in the sector 4 of beginning of opening, and promptly finish.
In this embodiment, computing machine reads the step of defence program, for computing machine reads and carry out the instruction of skip zone 6 earlier, is leading the address of activating in the sector 4 of beginning of opening in order to skip to defence program storage area 1, and then is reading and the execute protection program.In addition; when computing machine in the process of execute protection program; hard disk identification code district 2 that fetch protection program storage area 1 is write and backup disk are cut apart list area 3 respectively in the main address of activating in the sector 4 of beginning of opening, and then obtain hard disk identification code and each backup disk contingency table.
In this embodiment, see also shown in Figure 4ly, after hard disk was employed program setting protection, computing machine comprised according to the step of application program cancellation hard disk protection:
Step 30, computing machine judge whether hard disk has the hard disk identification code, if carry out step 31, otherwise, carry out step 34;
Step 31, computing machine judge whether the hard disk identification code is identical with the computer Recognition sign indicating number of present computing machine, if carry out step 32, otherwise, carry out step 33;
Step 32, each backup disk contingency table that computing machine is cut apart list area 3 with backup disk duplicates back disk cuts apart list area 5, cut apart the state of list area 5 in order to recover this disk, and removing defence program storage area 1, hard disk identification code district 2 and backup disk are cut apart list area 3, and reservation boot code, anticipate promptly, protected states of former beginning and end are recovered in the main sector 4 of activating, and promptly finish;
Step 33, computing machine are exported another announcement information, and another announcement information does not allow to remove main defence program storage area 1, hard disk identification code district 2 and the backup disk that activates sector 4 in order to expression and cuts apart list area 3, promptly finishes;
Step 34, computing machine are left the processing of cancellation protection hard disk, promptly finish.
From the above, (boot code promptly in the storage area of step 14), cooks up hard disk identification code district 2, defence program storage area 1 and backup disk and cuts apart list area 3 this embodiment in order to store boot code originally in main activation sector 4.When hard disk be not protected and hard disk after cancellation protection, recover main sector 4 boot code originally that activates, promptly directly according to main sector 4 boot code originally that activates, in order to finish the processing of activation manipulation system.And when hard disk is protected, be to skip to open the begin address of defence program in main activation sector 4 through reading and carry out the instruction of skip zone 6, make hard disk need, in order to reach the purpose of the data in the protection hard disk according to the defence program execution.
In this embodiment; computing machine activates sector 4 originally in order to store boot code (boot code according to application program the master; be in the storage area of step 14); advise out hard disk identification code district 2; defence program storage area 1 and backup disk are cut apart list area 3; be (to be that step 14) is edited in fact to boot code originally; in order to add aforesaid step 10~step 13 and step 15~step 17; so; this kind practice may cause boot code originally to wreck; and then cause hard disk to be activated; perhaps main activate sector 4 in the skip zone 6 and disk cut apart the storage data space of 5 of list areas; be not enough to be used for store originally in order to store boot code; defence program storage area 1; hard disk identification code district 2 and backup disk are cut apart list area 3; so; in another embodiment of the present invention, see also Fig. 5 and shown in Figure 6, computing machine is according to the application setting hard disk protection; in order in hard disk, to advise out hard disk identification code district 2 at least; defence program storage area 1 and backup disk are cut apart the step of list area 3, comprising:
Step 40, computing machine is set up a calling zone 81 in boot code (boot code) residue storage area afterwards in the storage area 80 in order to storage boot code (boot code) originally in the main sector 4 of activating;
Step 41, computing machine are found out disk and are cut apart one of them idle disk contingency table 82 in the list area 5;
Step 42, computing machine writes the address that interrupt instruction (as: the INT 13h of BIOS) reaches idle disk contingency table 82 in calling zone 81;
Step 43, computing machine writes the address of specifying an idle sector in the hard disk at idle disk contingency table 82, and with this idle sector as new activation sector 9;
Step 44, computing machine is provided with new skip zone 90, hard disk identification code district 2, backup disk in regular turn and cuts apart list area 3, boot code and open beginning district 91 and defence program storage area 1 new the activation in the sector 9, as shown in Figure 6;
Step 45, computing machine write skip instruction (as jmp) in skip zone 6, this instruction will skip to calling zone 81 in the main address of activating in the sector 4 of beginning of opening;
Step 46, computing machine is inserted skip instruction in new skip zone 90, and this instruction will skip to defence program storage area 1 in the new address of activating in the sector 9 of beginning of opening;
Step 47, computing machine copies to hard disk identification code district 2 as the hard disk identification code with the computer Recognition sign indicating number;
Step 48, computer backup disk are cut apart list area 3 and still as preparation disk are cut apart the storage area that list area 5 interior all disk contingency tables save as each backup disk contingency table;
Step 49, the 1 storage protection program in guard of computer program storage area, hard disk identification code district 2, backup disk are cut apart list area 3 and are opened the beginning address new the activation in the sector 9, and boot code opens beginning district 91 and open the beginning address main the activation in the sector 4, promptly finish.
By above-mentioned setting, in this embodiment, see also shown in Figure 7ly, computing machine reads the step of defence program, comprising:
Step 50, computing machine read and carry out the skip instruction of skip zone 6, so that skip to calling zone 81 in the main address of activating in the sector 4 of beginning of opening;
Step 51, computing machine read calling zone 81, and the address of using and obtaining idle disk contingency table 82 after execution of step 52, is carried out interrupt instruction again and loaded in the primary memorys so that will newly activate sector 9;
Step 52, computing machine read idle disk contingency table 82, obtain the address of new activation sector 9 at hard disk;
Step 53, computing machine read new skip zone 90, obtain defence program storage area 1 in the new address of activating in the sector 9 of beginning of opening, and promptly read defence program; Go the processing of execute protection program by the step of Fig. 2.
And in this embodiment; when computing machine in the process of execute protection program; hard disk identification code district 2 that fetch protection program storage area 1 is inserted and backup disk are cut apart list area 3 respectively in the new address of activating in the sector 9 of beginning of opening, and then read hard disk identification code and each backup disk contingency table from new activation sector 9 respectively.
In this embodiment, see also shown in Figure 8ly, after hard disk was employed program setting protection, computing machine comprised according to the step of application program cancellation hard disk protection:
Step 60, computing machine judge whether hard disk has the hard disk identification code, if carry out step 61, otherwise, carry out step 64;
Step 61, computing machine judge whether the hard disk identification code is identical with the computer Recognition sign indicating number of present computing machine, if carry out step 62, otherwise, carry out step 63;
Step 62, each backup disk contingency table that computing machine is cut apart list area 3 with backup disk duplicates back disk cuts apart list area 5, cut apart the state of list area 5 in order to recover this disk, remove the new data that sector 9, calling zone 81 and idle disk contingency table 82 are written into that activate, in addition in the skip zone 6 write boot code main activate sector 4 open the beginning address, anticipate promptly, protected states of former beginning and end are recovered in the main sector 4 of activating, and promptly finish;
Step 63, computing machine are exported another announcement information, and another announcement information is cut apart list area 3 in order to defence program storage area 1, hard disk identification code district 2 and backup disk that expression does not allow to remove new activation sector 9, promptly finish;
Step 64, computing machine are left the processing of cancellation protection hard disk, promptly finish.
By as can be known above-mentioned; computing machine does not carry out any editor to hard disk boot code originally; but in the idle storage area of hard disk, edit; so; can reduce the ruined chance of boot code; and needn't consider the storage area of boot code originally, whether be not enough to be used for store originally and cut apart list area 3 in order to store boot code, defence program storage area 1, hard disk identification code district 2 and backup disk.
In these embodiment, it is protected or the step of cancellation protection that computing machine enters setting harddisk with hard disk according to application program, sees also shown in Figure 9ly, comprising:
Step 70, computing machine obtain the computer Recognition sign indicating number that stores in advance in the computing machine; As aforementioned, the computer Recognition sign indicating number can be system management Basic Input or Output System (BIOS) (SMBIOS; System Management BIOS) value of general unique identifier (UUID) field of form 1 (Type 1);
Step 71, computing machine are exported user's menu, and user's menu comprises that one activates a protection hard disk option and a cancellation protection hard disk option;
Step 72, computing machine judge it is that activation protection hard disk option or cancellation protection hard disk option are selected, protect the hard disk option selected if activate, and carry out steps 73, otherwise i.e. expression cancellation protection hard disk option is selected, carry out step 74;
Step 73, computing machine is selected when activating protection hard disk option, cuts apart the step of list area 3 and handles (step process of press Fig. 5), i.e. end according to setting up defence program, hard disk identification code and backup disk;
Step 74, computing machine is selected when cancellation protection hard disk option, handles (step process of pressing Fig. 8) according to the step of cancellation hard disk protection, promptly finishes.
In sum; after the computer for executing application programs; available setting harddisk is protected or the cancellation protection; and after hard disk is set protection; only, could cut apart list area 5 at disk and read the disk contingency table, but not originally hard disk is set at other computing machine of protection originally hard disk being set at the computing machine of protection; then can't cut apart list area 5 and read the disk contingency table, in order to reach the purpose of protecting data stored in the hard disk at disk.
Press, the above only is the preferable specific embodiment of the present invention, only structural attitude of the present invention is not limited thereto, anyly be familiar with this skill person in field of the present invention, can think easily and variation or the equipollent of modification, all can be encompassed in the claim of following this case.