CN102063273A - Hard disk management method and device - Google Patents

Hard disk management method and device Download PDF

Info

Publication number
CN102063273A
CN102063273A CN 201010612650 CN201010612650A CN102063273A CN 102063273 A CN102063273 A CN 102063273A CN 201010612650 CN201010612650 CN 201010612650 CN 201010612650 A CN201010612650 A CN 201010612650A CN 102063273 A CN102063273 A CN 102063273A
Authority
CN
China
Prior art keywords
file
sector
read
head
index file
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN 201010612650
Other languages
Chinese (zh)
Other versions
CN102063273B (en
Inventor
周文省
陈礼进
冀建成
胡扬忠
邬伟琪
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Hikvision Digital Technology Co Ltd
Original Assignee
Hangzhou Hikvision Digital Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Hikvision Digital Technology Co Ltd filed Critical Hangzhou Hikvision Digital Technology Co Ltd
Priority to CN 201010612650 priority Critical patent/CN102063273B/en
Publication of CN102063273A publication Critical patent/CN102063273A/en
Application granted granted Critical
Publication of CN102063273B publication Critical patent/CN102063273B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Signal Processing For Digital Recording And Reproducing (AREA)

Abstract

The invention provides a hard disk management method which is used for managing hard disk data fields and comprises the steps of: A, judging the type of a file to be read-written according to the attribute of the file to be read-written, determining the file as a first index file, executing the step B, determining the first index file as a data file and executing the step C, wherein the first index file is an index file used by a user; B, after the presence of a bad track in the sector of the first index file to be read-written is determined, selecting the alternative sector from a second index file to read and write, wherein the second index file is a vacant index file for backup; and C, after the presence of the bad track in the sector of the data file to be read-written is determined, performing read-write operation on the next section of the sector having the bad track. The invention further provides a hard disk management device. By adopting the method and the device provided by the invention, normal read-write can be performed on a hard disk under the situation that the hard disk has the bad track and is not formatted.

Description

Hard disk management method and management devices
Technical field
The present invention relates to computer technology, particularly a kind of hard disk management method and management devices.
Background technology
At present, hard disk is widely used in the electronic products such as computer and video recorder as main storage medium.Hard disk must be through format before using; Below just be example with Fig. 1, simple declaration once adopt file configuration table (File Allocation Table, the FAT) structure of the hard disk of file system, specific as follows:
Adopt the hard disk of FAT file system formatization to comprise: Master boot sector, first reserve sector, primary partition 1, second primary partition 2, primary partition 3 and primary partition 4.Wherein, Master boot sector stores main bootstrap program (MBR) and partition table; Partition table stores the list item of above-mentioned 4 subregions.Each primary partition all comprises boot sector and in order to the data field of storage file content; Wherein, boot sector stores booting operating system record (DBR), second reserve sector, file allocation table 1 (FAT1), file allocation table 2 (FAT2) and root directory.
DBR by jump instruction, manufacturer sign and operating system version number, Basic Input or Output System (BIOS) parameter region (BIOS Parameter Block, BPB), several sections such as expansion BPB, booting operating system program and end mark form.BPB has specified the logic sector size of file system, has also indicated the number of sectors of forming cluster.
FAT1 is stored in the storage space after the reserve sector, and FAT2 is stored in the storage space after the FAT1, and the content of FAT1 and FAT2 is identical, and FAT2 is the backup of FAT1, is used for the recovery of file system.The storage condition of a file in the FAT file system is to indicate by the list item in the FAT partition table.
Root directory is stored in the storage space after the FAT2, is used to save contents and the information of file; The information of file comprises the position of the FAT1 of file size, modification time, current access limit and file.
When utilizing hard disk to carry out the file preservation, handle data field in the primary partition that the mode that employing pre-creates file comprises hard disk, in other words, exactly when carrying out file system format, be its storage space of document creation to be preserved, so that after format is finished, directly the data that file is comprised are written as in the storage space of this document establishment.The method that pre-creates file is: the capacity of the data field that comprises according to a certain primary partition and the size of data file, determine the data file sum that data field that a primary partition comprises can be created; On the data field of this primary partition, create index file and N the fixedly data file of M byte-sized; The above-mentioned information of record in FAT1 and root directory.
After formatting hard disk was finished, the content of the boot sector that Master boot sector, reserve sector and each primary partition comprise forbade that the user makes amendment; After handled data field in the primary partition that the mode that employing pre-creates file comprises hard disk, the data field in the primary partition comprised 2 index files and N data file; Wherein, the content of 2 index files is the same, and an index file uses for the user, and another index file is used for backup; N data file is to be used for preserving data in the data file.The user comes down to write the data that file to be preserved comprises in an index file that comprises to primary partition and data file when hard disk is preserved file.
Because fixed disk file adopts the mode that pre-creates file, when there is bad track in the data field of a certain primary partition of hard disk, will cause read-write to make mistakes, and read and write the data field that has bad track next time again, still can cause read-write to make mistakes, even cause hard disk can't continue operate as normal owing to there being bad track.In order to carry out read-write operation, need again above-mentioned hard disk carry out file system formatization to the hard disk that can't continue operate as normal.
In sum, exist in the data field of hard disk under the situation of bad track, hard disk is not being carried out under the formative situation, can't carry out normal read-write operation.
Summary of the invention
In view of this, the object of the present invention is to provide a kind of hard disk management method, can there be bad track in this method and carry out under the formative situation hard disk being read and write normally at hard disk.
The object of the present invention is to provide a kind of hard disk management device, can there be bad track in this device and carry out under the formative situation hard disk being read and write normally at hard disk.
For achieving the above object, technical scheme of the present invention specifically is achieved in that
A kind of hard disk management method, this method are the management method in hard disc data district, and this method comprises:
A, basis file attribute to be read and write are judged the type for the treatment of reading and writing of files, are defined as first index file, and execution in step B is defined as data file, execution in step C; The index file that described first index file uses for the user;
After there were bad track in B, the sector of determining first index file to be read and write, the sector of selecting to be used to replace in second index file was read and write; Described second index file is to be in the idle index file that is used to back up;
After there are bad track in C, the sector of determining data file to be read and write, read-write operation is carried out in next sector of the sector that has bad track.
Preferably, further comprise before the steps A:
In first index file, set up the first index file head, in data file, set up the data file head;
The described first index file head is in order to the status information of each sector of writing down first index file and taking and the replacement information of each sector; The status information of each sector that described data file head takies in order to recording data files; Whether the status information of described each sector exists the information of bad track for this sector of expression; The replacement information of described each sector is the sector auxiliary information of second index file that is used for replacing.
Preferably, step B is described further comprises after reading and writing the sector that is used for replacing in second index file: exist the sector auxiliary information that is used to replace in the sector auxiliary information of bad track and second index file to be recorded in the described first index file head first index file.
Preferably, described next sector to the sector that has bad track of step C carries out further comprising after the read-write operation: will exist the sector auxiliary information of bad track to be recorded in described data file head.
Preferably, the described data file head of setting up in data file further comprises afterwards: set up a general act head before first index file; Described general act head comprises the first index file head and data file head.
Preferably, further comprise between steps A and the step B: judge that whether the shared sector of the first index file head in first index file exists bad track, if exist, then obtains the first index file head from the general act head, otherwise, in first index file, obtain the first index file head.
Preferably, step B is described further to be comprised after reading and writing the sector that is used for replacing in second index file: described when the general act head obtains the first index file head, and will exist the sector auxiliary information that is used for replacing in the sector auxiliary information of bad track and second index file to be recorded in the first index file head of described general act head in first index file;
Described when in first index file, obtaining the first index file head, will exist the sector auxiliary information that is used for replacing in the sector auxiliary information of bad track and second index file to be recorded in the first index file head of described first index file in first index file.
Preferably, further comprise between steps A and the step C: whether the data file shared sector in the judgment data file exists bad track, if exist, then obtains the data file head from the general act head, otherwise, in data file, obtain the data file head.
Preferably, step C carries out further comprising after the read-write operation in described next sector to the sector that has bad track: described when from the general act head, obtaining data file, the sector auxiliary information that has bad track is recorded in data file head in the described general act head;
Described when in data file, obtaining data file, the sector auxiliary information that has bad track is recorded in data file head in the described data file.
In the said method, the sector that is used to replace in described selection second index file of step B is read and write and is comprised:
B1, according to the replacement information of each sector in the first index file head and there is the sector of bad track, judge whether to exist the sector auxiliary information of second index file that is used for replacing, if there is no, then, from second index file, select a sector that is used to replace according to the replacement information of each sector in the first index file head; If exist, then directly from the first index file head, obtain the sector auxiliary information that is used to replace in second index file;
B2, the sector that is used to replace in second index file is read and write.
A kind of hard disk management device, this device manages the hard disc data district, and this device comprises:
Trigger element according to treating reading and writing of files parameter and read write command, after determining that file to be read and write is index file, is exported file parameters to the first read-write cell to be read and write, and is triggered first read-write cell; Perhaps after determining that file to be read and write is data file, export file parameters to be read and write, and trigger the second reading r/w cell to the second reading r/w cell; File parameters described to be read and write is include file title, attribute and the memory location when pre-creating file at least;
First read-write cell according to triggering and file parameters to be read and write, is read and write the sector that first index file takies, and has bad track in the sector of determining first index file to be read and write, and the sector of selecting to be used to replace in second index file is read and write;
The second reading r/w cell according to triggering and file parameters to be read and write, is read and write the sector that the data file takies, and has bad track in the sector of determining data file to be read and write, the data file is existed the next sector of the sector of bad track read and write.
Preferably, this device further comprises: the file header read-write cell;
Described trigger element is after receiving read write command first or receiving the format instruction, and further the output file head is set up instruction to described file header read-write cell;
Described file header read-write cell is set up instruction according to the file header that receives, and sets up the first index file head in first index file, sets up the data file head in data file;
The described first index file head is in order to the status information of each sector auxiliary information of writing down first index file and taking, each sector, and the replacement information of each sector; Each sector auxiliary information that described data file head takies in order to recording data files and the status information of each sector; Whether the status information of described each sector exists the information of bad track for this sector of expression; The replacement information of described each sector is the sector auxiliary information of second index file that is used for replacing.
In the said apparatus, described first read-write cell is further according to triggering and file parameters to be read and write, trigger the file header read-write cell and read the first index file head, obtain the status information of sector to be read and write and the replacement information of sector to be read and write from the first index file head; To exist the sector auxiliary information that is used for replacing in the information of sector of bad track and second index file to be recorded in the first index file head in first index file, the first index file head after output is upgraded be to described file header read-write cell;
Described second reading r/w cell triggers file header read-write cell read data files head further according to triggering and file parameters to be read and write, and obtains the status information of sector to be read and write from the data file head; The information that has the sector of bad track in the data file is recorded in the data file head, and the data file head after output is upgraded is to described file header read-write cell;
Described file header reading unit reads the first index file head further according to the triggering of first read-write cell, exports the first index file head to described first read-write cell; Perhaps according to the triggering of second reading r/w cell, the read data files head, the output data file head is to described second reading r/w cell; Revise the first index file head according to the first index file head after the renewal that receives; Perhaps revise the data file head according to the data file head after the renewal that receives.
Preferably, this device further comprises: the file header backup units;
Described file header read-write cell further triggers described file header backup units after creating the first index file head and data file head;
Described file header backup units is set up a general act head according to triggering before first index file; Described general act head is in order to back up described first index file head and data file head.
As seen from the above technical solutions, the invention provides a kind of hard disk management method and management devices, when there is bad track in the sector of judgement first index file to be read and write, replace the sector that has bad track with the sector in second index file, finish read-write operation to hard disk; When there is bad track in the sector of judgement data file to be read and write, directly skip the sector that has bad track, read-write operation is carried out in next sector.Adopt method of the present invention and device, can have bad track and do not carry out under the formative situation hard disk being read and write normally, reduced the probability that hard disk reports an error at hard disk.
Description of drawings
Fig. 1 is the structural representation of the hard disk of existing employing file configuration list file system.
Fig. 2 is the process flow diagram of hard disk management method of the present invention.
Fig. 3 is the structural representation of hard disk management device of the present invention.
Embodiment
For make purpose of the present invention, technical scheme, and advantage clearer, below with reference to the accompanying drawing embodiment that develops simultaneously, the present invention is described in more detail.
Owing to there are two index files in the data field of the primary partition in the hard disk, index file uses for the user, another index file is used for backup, for sake of clarity, the index file that the user is used is called first index file, and the index file that will be used to back up is called second index file.
Method of the present invention and device are actually the method and apparatus that the data field to hard disk manages.
Fig. 2 is the process flow diagram of hard disk management method of the present invention.Now in conjunction with Fig. 2, the method for hard disk management of the present invention is described:
The management of the data field in a certain primary partition that hard disk management method of the present invention only comprises with hard disk is that example describes, and the management method of a plurality of data fields that hard disk is comprised is identical in this, does not repeat them here.Hard disk management method of the present invention comprises format stage and read-write stage.
Step 201: set up the first index file head and data file head;
The described first index file head is in order to the status information of each sector auxiliary information of writing down first index file and taking, each sector, and the replacement information of each sector.Wherein, whether the status information of described each sector exists the information of bad track for this sector of expression; Such as, represent that with 0 there is not bad track in this sector, represent that with 1 there is bad track in this sector; The replacement information of described each sector is the sector auxiliary information of second index file that is used for replacing; Such as, there is bad track in the 2nd sector that first index file takies, replaces with the 1st sector in second index file, then in the first index file head, has put down in writing the information of the 1st sector in second index file in the replacement information of the 2nd sector.
Each sector auxiliary information that described data file head takies in order to recording data files and the status information of each sector.
After format pre-creates file, perhaps when hard disk being carried out first read-write operation, in first index file of creating, create one first index file head again, in each data file of creating, create a data file head again.
Can adopt the existing method that pre-creates file that hard disk is formatd, no longer the concrete method that pre-creates file be given unnecessary details at this.
Step 202: judge whether file to be read and write is index file, if, execution in step 203, otherwise execution in step 209;
Judge that according to file parameters to be read and write file to be read and write is an index file, or data file; If index file, execution in step 203, if data file, execution in step 209.Also can adopt the existing out of Memory of file that utilizes to judge it is index file, or data file, do not repeat them here.
Step 203: judge whether the sector in first index file to be read and write exists bad track, if, execution in step 204, otherwise execution in step 208;
This step comprises: step 2031, judge according to the status information of each sector of having preserved in the first index file head whether the sector that first index file to be read and write takies exists bad track, if, execution in step 204, otherwise execution in step 2032; Step 2032 is treated the sector that first index file of read-write takies and is carried out read-write operation, if there is bad track, and execution in step 204, if there is not bad track, execution in step 208.
When judging whether the sector exists bad track, can determine that when read or write speed was lower than a predetermined threshold value, this sector existed the probability of bad track higher according to the read or write speed of this sector, determine that there is bad track in this sector.Described predetermined threshold value can rule of thumb be provided with.
Step 204: whether interpretation exists the sector of second index file that is used to replace this sector, if, execution in step 205, otherwise execution in step 206;
Judge the replacement information of whether having preserved in the first index file head for the sector that has bad track, if put down in writing the sector auxiliary information of second index file that is used for replacing in the replacement information, then execution in step 205, otherwise, execution in step 206.
Step 205: the sector in second index file is read and write, and execution in step 213 afterwards;
This step comprises: step 2051, judge whether to be read operation, if, execution in step 2052, otherwise execution in step 2053; Step 2052 is copied to the sector that is used to replace in second index file with the sectors of data that has bad track, reads the sector that is used to replace in second index file; Step 2053 writes data the sector that is used to replace in second index file.
In step 2052, when the read or write speed of judging a certain sector is lower than default speed, prove that this sector has the probability of bad track bigger, at this moment, still can carry out read-write operation to this sector, only be that read or write speed is very slow; In this case, can adopt slower reading speed to read this sectors of data, and with the sector that is used to replace in copying data to the second index file that reads.
Step 206: a sector of selecting from the sector that second index file takies is read and write;
This step comprises: step 2061, according to the sector auxiliary information that has been used in second index file of putting down in writing in the first index file head replace, from second index file, select a sector that is not used to replace, replace the sector that has bad track in first index file with the sector of selecting; Step 2062 judges whether to be read operation, if, execution in step 2063, otherwise execution in step 2064; Step 2063 is copied to the sector of selecting in second index file that is used to replace with the sectors of data that has bad track, reads the sector of selecting in second index file that is used to replace; Step 2064 writes data the sector of selecting in second index file that is used to replace.
Step 207: upgrade the first index file head, execution in step 213 afterwards;
With exist in first index file bad track sector auxiliary information, and the sector auxiliary information of second index file that is used for replacing selected be stored in the first index file head.
Step 208: treat the sector that first index file of read-write takies and read and write, execution in step 213 afterwards:
Adopt existing data read-write method, treat the sector that first index file of read-write takies and carry out read-write operation, do not repeat them here.
Step 209: judge whether the sector that data file to be read and write takies exists bad track, if, execution in step 210, otherwise execution in step 212;
This step comprises: step 2091, judge according to the status information of each sector of having preserved in the data file head whether the sector that data file to be read and write takies exists bad track, if, execution in step 210, otherwise execution in step 2092; Step 2092 is directly treated the data file of read-write and is carried out read-write operation, if there is bad track, and execution in step 210, otherwise execution in step 212.
When judging whether the sector exists bad track, can determine that when read or write speed was lower than a predetermined threshold value, this sector existed the probability of bad track higher according to the read or write speed of this sector, determine that there is bad track in this sector.Described predetermined threshold value can rule of thumb be provided with.
Step 210: next sector to the sector that has bad track is read and write;
Skip the sector that has bad track in the data file, read-write operation is carried out in next sector of the sector that has bad track.
Step 211: the updated data file head, execution in step 213 afterwards;
The sector auxiliary information that has bad track in the data file is stored in the data file head.
Step 212: treat the sector that the data file of read-write takies and read and write;
Adopt existing data read-write method, treat the sector that the data file of read-write takies and carry out read-write operation, do not repeat them here.
Step 213: finish.
For appearring in the first index file head that prevents to set up and data file head, mistake cause hard disk to report an error, between step 201 and step 202, also further comprise:, before first index file of data field, set up the general act head according to the first index file head and the data file head set up.Described general act head comprises the first index file head and the data file head of having set up.
Between step 202 and step 203, further comprise: judge whether the shared sector of having set up of the first index file head exists bad track, if then from the general act head, read the first index file head; Otherwise, in first index file, read the first index file head.If read the first index file head, then upgrade the first index file head in the general act head in the step 207 from the general act head; If from first index file, read the first index file head, then upgrade the first index file head in first index file in the step 207.
Between step 202 and step 209, further comprise: judge whether the data file shared sector set up exists bad track, if, read data files head from the general act head then; Otherwise, read data files head in the data file.If read data files head from the general act head then upgrades the data file head in the general act head in the step 211; If read data files head, then the data file head in the updated data file in the step 211 from data file.
If when hard disk is read and write or format when pre-creating file, set up the first index file head and data file head first, the user need carry out read-write operation to file at every turn, then reads and writes according to step 202 to the method for step 213.
If first when hard disk is read and write or format when pre-creating file, do not set up the first index file head and data file head that the present invention mentions, when then the user carries out read-write operation to file at every turn, after determining that file to be read and write is index file, there is bad track in the sector of judging first index file to be read and write, if there is bad track, directly from the sector of second index file, select a sector that is used to replace, the sector that is used to replace in second index file is read and write; After determining that file to be read and write is data file, judge whether the sector of data file to be read and write exists bad track, if there is bad track, then directly skip this sector, next sector of this sector is read and write.
Fig. 3 is the structural representation of hard disk management device of the present invention.Now in conjunction with Fig. 3, the structure of the management devices of hard disk of the present invention is described, specific as follows:
Device of the present invention only manages the data field of hard disk 30.
The inventive system comprises: judging unit 301, first read-write cell 302 and second reading r/w cell 303.
Trigger element 301 is according to the file parameters to be read and write and the read write command that receive, judge that file to be read and write belongs to index file or data file, after determining that file to be read and write is index file, export file parameters to the first read-write cell 302 to be read and write, and trigger first read-write cell 302; After determining that file to be read and write is data file, export file parameters to be read and write to second reading r/w cell 303, and trigger second reading r/w cell 303.File parameters to be read and write is include file title, attribute, the memory location when pre-creating file at least.
First read-write cell 302 is according to triggering and file parameters to be read and write, the sector that first index file takies is read and write, judge whether the sector that first index file takies exists bad track, there is bad track in the sector of determining first index file to be read and write, select a sector of second index file to replace the sector that has bad track in first index file, the sector that is used to replace in second index file is read and write.
Second reading r/w cell 303 is according to triggering and file parameters to be read and write, the sector that the data file takies is read and write, whether the sector that the judgment data file takies exists bad track, there is bad track in the sector of determining data file to be read and write, directly the next sector of the sector that has bad track in the data file read and write.
Device of the present invention also further comprises: file header read-write cell 304.
Trigger element 301 is after receiving read write command first or receiving the format instruction, and further the output file head is set up and instructed to file header read-write cell 304.
File header read-write cell 304 is set up instruction according to the file header that receives, and sets up the first index file head in first index file, sets up the data file head in data file.The described first index file head is in order to the status information of each sector auxiliary information of writing down first index file and taking, each sector, and the replacement information of each sector.Wherein, whether the status information of described each sector exists the information of bad track for this sector of expression; The replacement information of described each sector is the sector auxiliary information of second index file that is used for replacing.Each sector auxiliary information that described data file head takies in order to recording data files and the status information of each sector.
File header read-write cell 304 obtains the first index file head according to the triggering of first read-write cell 302 from index file, export first index file head to the first read-write cell 302; According to the first index file head after the renewal of first read-write cell, 302 outputs, the first index file head in first index file is made amendment.File header read-write cell 304 obtains the data file head according to the triggering of second reading r/w cell 303 from data file, the output data file head is to second reading r/w cell 303; According to the data file head after the renewal of second reading r/w cell 302 outputs, the data file head in the data file is made amendment.
First read-write cell 302 triggers file header read-write cell 304 and reads the first index file head further according to the triggering of trigger element 301, obtains the status information of sector to be read and write in first index file and the replacement information of sector from the first index file head; Determine according to the status information of sector whether sector to be read and write exists bad track, obtain the sector auxiliary information that is used to replace in second index file according to the replacement information of sector; First read-write cell 302 upgrades the sector auxiliary information that is used to replace in its sector auxiliary information that has bad track determined and second index file to the first index file head, export the first index file head after upgrading to file header read-write cell 304.If write down the status information and the replacement information of sector to be read and write in the first index file head, then first read-write cell 302 is read and write the sector that is used to replace in second index file according to above-mentioned information; If write down the status information of sector to be read and write in the first index file head, the replacement information of sector do not waited to read and write in record, then first read-write cell 302 is according to the replacement information of each sector in the first index file head and the sector auxiliary information of second index file, select the sector in second index file to replace the sector that has bad track in first index file, and in the first index file head, write down the replacement information of this sector.If do not write down the status information and the replacement information of sector to be read and write in the first index file head, then first read-write cell 304 determines whether sector to be read and write exists bad track, and when determining to have bad track, selects the sector that is used to replace in second index file.
Second reading r/w cell 303 triggers file header read-write cell 304 read data files heads further according to the triggering of trigger element 301, determines according to the data file head whether the sector of data file to be read and write exists bad track; During the sector auxiliary information of determining that has bad track upgraded the data file header, the data file head after output is upgraded.
Cause hard disk to report an error for mistake appears in the first index file head that prevents to set up and data file head, this device further comprises: file header backup units 305.File header read-write cell 304 further triggers file header backup units 305 after setting up the first index file head and data file head; File header backup units 305 was set up a general act head according to triggering before first index file; Described general act head is used to write down described first index file head and data file head.File header read-write 304 judges further whether the shared sector of the first index file head in first index file exists bad track when reading the first index file head, if exist, then obtain the first index file head of backup from the general act head; Perhaps when read data files, further whether the data file shared sector in the judgment data file exists bad track, if exist, then obtains the backed up data file header from the general act head.
In the above-mentioned preferred embodiment of the present invention, exist in the sector that first index file takies under the situation of bad track, the sector that has bad track is replaced, and the first index file head is upgraded with the sector in second index file; Exist in the sector that data file takies under the situation of bad track, directly skip the sector that has bad track, corresponding read-write operation is carried out in next sector to the sector that has bad track, reduced the probability that hard disk reports an error, and do not carrying out under the formative situation, can read and write normally the hard disk that has bad track.
The above only is preferred embodiment of the present invention, and is in order to restriction the present invention, within the spirit and principles in the present invention not all, any modification of being made, is equal to replacement, improvement etc., all should be included within the scope of protection of the invention.

Claims (14)

1. a hard disk management method is characterized in that, this method is the management method in hard disc data district, and this method comprises:
A, basis file attribute to be read and write are judged the type for the treatment of reading and writing of files, are defined as first index file, and execution in step B is defined as data file, execution in step C; The index file that described first index file uses for the user;
After there were bad track in B, the sector of determining first index file to be read and write, the sector of selecting to be used to replace in second index file was read and write; Described second index file is to be in the idle index file that is used to back up;
After there are bad track in C, the sector of determining data file to be read and write, read-write operation is carried out in next sector of the sector that has bad track.
2. method according to claim 1 is characterized in that, further comprises before the steps A:
In first index file, set up the first index file head, in data file, set up the data file head;
The described first index file head is in order to the status information of each sector of writing down first index file and taking and the replacement information of each sector; The status information of each sector that described data file head takies in order to recording data files; Whether the status information of described each sector exists the information of bad track for this sector of expression; The replacement information of described each sector is the sector auxiliary information of second index file that is used for replacing.
3. method according to claim 2, it is characterized in that step B is described further to be comprised after reading and writing the sector that is used for replacing in second index file: exist the sector auxiliary information that is used to replace in the sector auxiliary information of bad track and second index file to be recorded in the described first index file head first index file.
4. according to claim 2 or 3 described methods, it is characterized in that step C carries out further comprising after the read-write operation in described next sector to the sector that has bad track: will exist the sector auxiliary information of bad track to be recorded in described data file head.
5. method according to claim 2 is characterized in that, the described data file head of setting up in data file further comprises afterwards: set up a general act head before first index file; Described general act head comprises the first index file head and data file head.
6. method according to claim 5, it is characterized in that, further comprise between steps A and the step B: judge whether the shared sector of the first index file head in first index file exists bad track, if exist, then from the general act head, obtain the first index file head, otherwise, in first index file, obtain the first index file head.
7. method according to claim 6, it is characterized in that, step B is described further to be comprised after reading and writing the sector that is used for replacing in second index file: described when the general act head obtains the first index file head, and will exist the sector auxiliary information that is used for replacing in the sector auxiliary information of bad track and second index file to be recorded in the first index file head of described general act head in first index file;
Described when in first index file, obtaining the first index file head, will exist the sector auxiliary information that is used for replacing in the sector auxiliary information of bad track and second index file to be recorded in the first index file head of described first index file in first index file.
8. method according to claim 5, it is characterized in that, further comprise between steps A and the step C: whether the data file shared sector in the judgment data file exists bad track, if exist, then from the general act head, obtain the data file head, otherwise, in data file, obtain the data file head.
9. method according to claim 8, it is characterized in that, step C carries out further comprising after the read-write operation in described next sector to the sector that has bad track: described when from the general act head, obtaining data file, the sector auxiliary information that has bad track is recorded in data file head in the described general act head;
Described when in data file, obtaining data file, the sector auxiliary information that has bad track is recorded in data file head in the described data file.
10. according to any described method in the claim 2 to 9, it is characterized in that the sector that is used to replace in described selection second index file of step B is read and write and comprised:
B1, according to the replacement information of each sector in the first index file head and there is the sector of bad track, judge whether to exist the sector auxiliary information of second index file that is used for replacing, if there is no, then, from second index file, select a sector that is used to replace according to the replacement information of each sector in the first index file head; If exist, then directly from the first index file head, obtain the sector auxiliary information that is used to replace in second index file;
B2, the sector that is used to replace in second index file is read and write.
11. a hard disk management device is characterized in that this device manages the hard disc data district, this device comprises:
Trigger element according to treating reading and writing of files parameter and read write command, after determining that file to be read and write is index file, is exported file parameters to the first read-write cell to be read and write, and is triggered first read-write cell; Perhaps after determining that file to be read and write is data file, export file parameters to be read and write, and trigger the second reading r/w cell to the second reading r/w cell; File parameters described to be read and write is include file title, attribute and the memory location when pre-creating file at least;
First read-write cell according to triggering and file parameters to be read and write, is read and write the sector that first index file takies, and has bad track in the sector of determining first index file to be read and write, and the sector of selecting to be used to replace in second index file is read and write;
The second reading r/w cell according to triggering and file parameters to be read and write, is read and write the sector that the data file takies, and has bad track in the sector of determining data file to be read and write, the data file is existed the next sector of the sector of bad track read and write.
12. device according to claim 11 is characterized in that, this device further comprises: the file header read-write cell;
Described trigger element is after receiving read write command first or receiving the format instruction, and further the output file head is set up instruction to described file header read-write cell;
Described file header read-write cell is set up instruction according to the file header that receives, and sets up the first index file head in first index file, sets up the data file head in data file;
The described first index file head is in order to the status information of each sector auxiliary information of writing down first index file and taking, each sector, and the replacement information of each sector; Each sector auxiliary information that described data file head takies in order to recording data files and the status information of each sector; Whether the status information of described each sector exists the information of bad track for this sector of expression; The replacement information of described each sector is the sector auxiliary information of second index file that is used for replacing.
13. device according to claim 12 is characterized in that,
Described first read-write cell triggers the file header read-write cell and reads the first index file head further according to triggering and file parameters to be read and write, and obtains the status information of sector to be read and write and the replacement information of sector to be read and write from the first index file head; To exist the sector auxiliary information that is used for replacing in the information of sector of bad track and second index file to be recorded in the first index file head in first index file, the first index file head after output is upgraded be to described file header read-write cell;
Described second reading r/w cell triggers file header read-write cell read data files head further according to triggering and file parameters to be read and write, and obtains the status information of sector to be read and write from the data file head; The information that has the sector of bad track in the data file is recorded in the data file head, and the data file head after output is upgraded is to described file header read-write cell;
Described file header reading unit reads the first index file head further according to the triggering of first read-write cell, exports the first index file head to described first read-write cell; Perhaps according to the triggering of second reading r/w cell, the read data files head, the output data file head is to described second reading r/w cell; Revise the first index file head according to the first index file head after the renewal that receives; Perhaps revise the data file head according to the data file head after the renewal that receives.
14. device according to claim 13 is characterized in that, this device further comprises: the file header backup units;
Described file header read-write cell further triggers described file header backup units after creating the first index file head and data file head;
Described file header backup units is set up a general act head according to triggering before first index file; Described general act head is in order to back up described first index file head and data file head.
CN 201010612650 2010-12-22 2010-12-22 Hard disk management method and device Active CN102063273B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 201010612650 CN102063273B (en) 2010-12-22 2010-12-22 Hard disk management method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 201010612650 CN102063273B (en) 2010-12-22 2010-12-22 Hard disk management method and device

Publications (2)

Publication Number Publication Date
CN102063273A true CN102063273A (en) 2011-05-18
CN102063273B CN102063273B (en) 2013-05-15

Family

ID=43998567

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 201010612650 Active CN102063273B (en) 2010-12-22 2010-12-22 Hard disk management method and device

Country Status (1)

Country Link
CN (1) CN102063273B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110413223A (en) * 2019-06-25 2019-11-05 汉纳森(厦门)数据股份有限公司 Data read-write method, medium, equipment and the device of flash storage
WO2019223432A1 (en) * 2018-05-22 2019-11-28 杭州海康威视数字技术股份有限公司 Data obtaining method and apparatus

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1232263A (en) * 1998-02-10 1999-10-20 索尼公司 Information recording method and apparatus
CN1330793A (en) * 1998-10-22 2002-01-09 松下电器产业株式会社 Information recording medium, method and apparatus for managing defect thereof
KR100532500B1 (en) * 2004-01-30 2005-11-30 삼성전자주식회사 Method for detecting a system area of hard disk drive
CN1776817A (en) * 2004-11-19 2006-05-24 三星电子株式会社 Method for accessing data sectors and processing an access failure in a hard disk drive
US7529776B2 (en) * 2005-01-07 2009-05-05 International Business Machines Corporation Multiple copy track stage recovery in a data storage system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1232263A (en) * 1998-02-10 1999-10-20 索尼公司 Information recording method and apparatus
CN1330793A (en) * 1998-10-22 2002-01-09 松下电器产业株式会社 Information recording medium, method and apparatus for managing defect thereof
KR100532500B1 (en) * 2004-01-30 2005-11-30 삼성전자주식회사 Method for detecting a system area of hard disk drive
CN1776817A (en) * 2004-11-19 2006-05-24 三星电子株式会社 Method for accessing data sectors and processing an access failure in a hard disk drive
US7529776B2 (en) * 2005-01-07 2009-05-05 International Business Machines Corporation Multiple copy track stage recovery in a data storage system

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2019223432A1 (en) * 2018-05-22 2019-11-28 杭州海康威视数字技术股份有限公司 Data obtaining method and apparatus
CN110515761A (en) * 2018-05-22 2019-11-29 杭州海康威视数字技术股份有限公司 A kind of data capture method and device
US11269713B2 (en) 2018-05-22 2022-03-08 Hangzhou Hikvision Digital Technology Co., Ltd. Data obtaining method and apparatus
CN110413223A (en) * 2019-06-25 2019-11-05 汉纳森(厦门)数据股份有限公司 Data read-write method, medium, equipment and the device of flash storage

Also Published As

Publication number Publication date
CN102063273B (en) 2013-05-15

Similar Documents

Publication Publication Date Title
KR101115486B1 (en) Apparatus and method for controlling booting of computer system
JP4749255B2 (en) Storage system control device having multiple types of storage devices
US8024507B2 (en) Transaction-safe FAT file system improvements
US8312554B2 (en) Method of hiding file at data protecting mode for non-volatile memory module, memory controller and portable memory storage apparatus
US7174420B2 (en) Transaction-safe FAT file system
JP3607153B2 (en) File management method and apparatus
CN101661473A (en) Solid state memory (ssm), computer system, and method of operating an ssm
KR100703807B1 (en) Method and apparatus for managing block by update type of data in block type memory
EP1805589A2 (en) Tape emulating disk based storage and method with automatically resized emulated tape capacity
CN102227729A (en) Storage device presenting to hosts only files compatible with defined host capability
KR20110005817A (en) Memory drive that can be operated like optical disk drive and method for virtualizing memory drive as optical disk drive
US20160011792A1 (en) Media control device and control method
CN102200946B (en) Data access method, memory controller and storage system
CN100543748C (en) A kind of method and system of utilizing file allocation table to carry out the file tracking
JP4130808B2 (en) Formatting method
KR101258589B1 (en) Information storage medium recording data according to journaling file system, method and apparatus of writing/recovering data using journaling file system
CN102063273B (en) Hard disk management method and device
KR20090042570A (en) Apparatus and method for managing files and memory unit
CN101464837A (en) Information recording device and information recording method
US20070061530A1 (en) Method for storage of digital data in a mainframe data center and associated device
CN101673242A (en) Method and device for formatting hard disk
CN101794254B (en) NAND-FLASH data processing method
US20140059305A1 (en) Management apparatus, storage device, and initialization method
KR20030061948A (en) : Apparatus storing information and method for controlling the File using its
CN103617250A (en) File management method based on optical storage array and file format system

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant