CN102063273B - Hard disk management method and device - Google Patents

Hard disk management method and device Download PDF

Info

Publication number
CN102063273B
CN102063273B CN 201010612650 CN201010612650A CN102063273B CN 102063273 B CN102063273 B CN 102063273B CN 201010612650 CN201010612650 CN 201010612650 CN 201010612650 A CN201010612650 A CN 201010612650A CN 102063273 B CN102063273 B CN 102063273B
Authority
CN
China
Prior art keywords
file
sector
read
index file
head
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.)
Active
Application number
CN 201010612650
Other languages
Chinese (zh)
Other versions
CN102063273A (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 take Fig. 1 as example, the structure of the hard disk of file configuration table (File Allocation Table, FAT) file system is adopted in simple declaration once, and is specific as follows:
Adopt the hard disk of FAT file system format to comprise: Master boot sector, the first reserve sector, primary partition 1, the 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 dos boot record (DBR), the second reserve sector, file allocation table 1 (FAT1), file allocation table 2 (FAT2) and root directory.
DBR is comprised of jump instruction, manufacturer sign and operating system version number, Basic Input or Output System (BIOS) parameter region (BIOS Parameter Block, BPB), several parts such as expansion BPB, booting operating system program and end mark.BPB has specified the logic sector size of file system, has also indicated the number of sectors that forms cluster.
FAT1 is stored in the storage space after reserve sector, and FAT2 is stored in the storage space after 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 FAT2, is used for saving 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, process 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 completed, directly the data with file including 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 create; On the data field of this primary partition, create index file and N the fixedly data file of M byte-sized; Record above-mentioned information in FAT1 and root directory.
After formatting hard disk was completed, the content of the boot sector that Master boot sector, reserve sector and each primary partition comprise forbade that the user modifies; After processed data field in the primary partition that the mode that employing pre-creates file comprises hard disk, the data field in primary partition comprised 2 index files and N data file; Wherein, the content of 2 index files is the same, and an index file is for the user, and another index file is used for backup; N data file is the data in the save data file.The user when preserving file to hard disk, is in fact to write the data of file including to be preserved in an index file that comprises to primary partition and data file.
Adopt the mode that pre-creates file due to fixed disk 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 to 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 normal operation owing to there being bad track.In order to carry out read-write operation to the hard disk that can't continue to work, need again above-mentioned hard disk to be carried out file system format.
In sum, in the situation that there is bad track in the data field of hard disk, in the situation that hard disk is not formatd, 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, the method can in the situation that there is bad track in hard disk and does not format, be read and write hard disk normally.
The object of the present invention is to provide a kind of hard disk management device, this device can in the situation that there is bad track in hard disk and does not format, be read and write hard disk normally.
For achieving the above object, technical scheme of the present invention specifically is achieved in that
A kind of hard disk management method, the method is the management method in hard disc data district, the method comprises:
The type of reading and writing of files is treated in A, basis file attribute judgement to be read and write, and is defined as the first index file, and execution in step B is defined as data file, execution in step C; The index file that described the first index file uses for the user;
B, determine after there is bad track in the sector of the first index file of reading and writing, the sector of selecting to be used in the second index file replacing is read and write; Described the second index file is to be in the idle index file that is used for backup;
C, determine after there is bad track in the sector of the data file of reading and writing, read-write operation is carried out in next sector of the sector that has bad track.
Preferably, further comprise before steps A:
Set up the first index file head in the first index file, set up the data file head in data file;
Described the first index file head is in order to the status information of each sector of recording the 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; The status information of described each sector is for representing whether this sector exists the information of bad track; The replacement information of described each sector is the sector auxiliary information for the second index file of replacing.
Preferably, step B is described further comprises after the sector of be used for replacing in the second index file is read and write: exist the sector auxiliary information that is used for replacing in the sector auxiliary information of bad track and the second index file to be recorded in described the first index file head the first index file.
Preferably, described next sector to the sector that has bad track of step C carries out further comprising after 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 the first index file; Described general act head comprises the first index file head and data file head.
Preferably, further comprise between steps A and step B: judge that whether the first index file head shared sector in the first index file exists bad track, if exist, obtains the first index file head from the general act head, otherwise, obtain the first index file head in the first index file.
Preferably, step B is described further to be comprised after the sector of be used for replacing in the second index file is read and write: described when obtaining the first index file head from the general act head, and will exist the sector auxiliary information that is used for replacing in the sector auxiliary information of bad track and the second index file to be recorded in the first index file head of described general act head in the first index file;
Described when obtaining the first index file head in the first index file, will exist the sector auxiliary information that is used for replacing in the sector auxiliary information of bad track and the second index file to be recorded in the first index file head of described the first index file in the first index file.
Preferably, further comprise between steps A and step C: judge whether the data file shared sector in data file exists bad track, if exist, obtains the data file head from the general act head, otherwise, obtain the data file head in data file.
Preferably, step C carries out further comprising after read-write operation in described next sector to the sector that has bad track: described when obtaining data file from the general act head, the sector auxiliary information that has bad track is recorded in data file head in described general act head;
Described when obtaining data file in the data file, the sector auxiliary information that has bad track is recorded in data file head in described data file.
In said method, the sector that is used for replacing in described selection the 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 for the second index file of replacing, if there is no, according to the replacement information of each sector in the first index file head, select one for the sector of replacing from the second index file; If exist, directly obtain the sector auxiliary information that is used for replacement in the second index file from the first index file head;
B2, the sector of be used for replacing in the 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, is being determined after the file of reading and writing is index file, exports file parameters to the first read-write cell to be read and write, and triggers the first read-write cell; Perhaps determining after the file of reading and writing is data file, exporting file parameters to the second read-write cell to be read and write, and triggering the second read-write cell; Described file parameters wait reading and writing is include file title, attribute and the memory location when pre-creating file at least;
The first read-write cell according to triggering and file parameters to be read and write, is read and write the sector that the first index file takies, and has bad track in the sector of determining the first index file to be read and write, and the sector of selecting to be used in the second index file replacing is read and write;
The second read-write 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 first read write command 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 the first index file, sets up the data file head in data file;
Described the first index file head is in order to the status information of each sector auxiliary information of recording the 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; The status information of described each sector is for representing whether this sector exists the information of bad track; The replacement information of described each sector is the sector auxiliary information for the second index file of replacing.
In said apparatus, described the 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 the second index file to be recorded in the first index file head in the first index file, the first index file head after output is upgraded be to described file header read-write cell;
Described the second read-write 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; In the data file head, the data file head after output is upgraded is to described file header read-write cell with the information recording/of sector that has bad track in data file;
Described file header reading unit reads the first index file head further according to the triggering of the first read-write cell, and output the first index file head is to described the first read-write cell; Perhaps according to the triggering of the second read-write cell, the read data files head, the output data file head is to described the second read-write cell; Revise the first index file head according to the first index file head after the renewal that receives; Perhaps according to the data file Update Table file header 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 the first index file; Described general act head is in order to back up described the 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, judging when there is bad track in the sector of the first index file of reading and writing, replacing the sector that has bad track with the sector in the second index file, completing the read-write operation to hard disk; Directly skip the sector that has bad track judging when there is bad track in the sector of the data file of reading and writing, read-write operation is carried out in next sector.Adopt method of the present invention and device, can hard disk be read and write normally in the situation that there is bad track in hard disk and does not format, reduced the probability that hard disk reports an error.
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, referring to the accompanying drawing embodiment that develops simultaneously, the present invention is described in more detail.
Owing to there being two index files in the data field of the primary partition in 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 the first index file, will be called the second index file for the index file of backup.
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 take hard disk describes as example, 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;
Described the first index file head is in order to the status information of each sector auxiliary information of recording the first index file and taking, each sector, and the replacement information of each sector.Wherein, the status information of described each sector is for representing whether this sector exists the information of bad track; 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 for the second index file of replacing; Such as, there is bad track in the 2nd sector that the first index file takies, replaces with the 1st sector in the second index file, in the first index file head, has put down in writing the information of the 1st sector in the 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, create again one first index file head in the first index file that creates, create again a data file head in each data file that creates.
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 so, 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 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 the first index file to be read and write exists bad track, if so, 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 the first index file to be read and write takies exists bad track, if so, execution in step 204, otherwise execution in step 2032; Step 2032 is treated the sector that the 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 no bad track, execution in step 208.
When judging whether the sector exists bad track, can determine according to the read or write speed of this sector, during lower than a predetermined threshold value, this sector exists the probability of bad track higher, determines that there is bad track in this sector when read or write speed.Described predetermined threshold value can rule of thumb arrange.
Step 204: whether interpretation exists the sector for the second index file of replacing this sector, if so, and 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 that is used for the second index file of replacement in replacement information, execution in step 205, otherwise, execution in step 206.
Step 205: the sector in the second index file is read and write, and execution in step 213 afterwards;
This step comprises: step 2051, determine whether read operation, if so, execution in step 2052, otherwise execution in step 2053; Step 2052 is used for the sector of replacing with existing in data copy to the second index file of sector of bad track, read to be used for the sector of replacing in the second index file; Step 2053 writes data the sector that is used for replacement in the second index file.
In step 2052, during lower than default speed, prove that this sector has the probability of bad track larger in the read or write speed of judging a certain sector, at this moment, still can carry out read-write operation to this sector, be only that read or write speed is very slow; In this case, can adopt slower reading speed to read the data of this sector, and with the sector that is used in data copy to the second index file that reads replacing.
Step 206: a sector of selecting from the sector that the second index file takies is read and write;
This step comprises: step 2061, according to the sector auxiliary information that has been used in the second index file of putting down in writing in the first index file head replacing, select one to be used for the sector of replacement from the second index file, replace the sector that has bad track in the first index file with the sector of selecting; Step 2062 determines whether read operation, if so, and execution in step 2063, otherwise execution in step 2064; Step 2063 with the sector that exists being used for of selecting in data copy to the second index file of sector of bad track to replace, reads the sector that being used for of selecting in the second index file replace; Step 2064 writes data the sector that is used for replacement of selecting in the second index file.
Step 207: upgrade the first index file head, execution in step 213 afterwards;
With exist in the first index file bad track sector auxiliary information, and being used for of selecting the second index file of replacing sector auxiliary information be stored in the first index file head.
Step 208: treat the sector that the 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 the 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 so, 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 so, 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 according to the read or write speed of this sector, during lower than a predetermined threshold value, this sector exists the probability of bad track higher, determines that there is bad track in this sector when read or write speed.Described predetermined threshold value can rule of thumb arrange.
Step 210: next sector to the sector that has bad track is read and write;
Skip the sector that has bad track in 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 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 of preventing from setting up and data file head, mistake cause hard disk to report an error, also further comprise between step 201 and step 202: according to the first index file head and the data file head set up, set up the general act head before the first index file of data field.Described general act head comprises the first index file head and the data file head of having set up.
Further comprise between step 202 and step 203: whether the first index file head shared sector that judgement has been set up exists bad track, if so, reads the first index file head from the general act head; Otherwise, read the first index file head in the first index file.If read the first index file head from the general act head, upgrade the first index file head in the general act head in step 207; If read the first index file head from the first index file, upgrade the first index file head in the first index file in step 207.
Further comprise between step 202 and step 209: whether the data file shared sector that judgement has been set up exists bad track, if so, and read data files head from the general act head; Otherwise, read data files head in the data file.If read data files head from the general act head upgrades the data file head in the general act head in step 211; If read data files head from data file, the data file head in updated data file in step 211.
If when first hard disk being read and write or format when pre-creating file, set up the first index file head and data file head, the user need to carry out read-write operation to file at every turn, reads and writes according to step 202 to the method for step 213.
If when first hard disk being 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 the user carries out read-write operation to file at every turn, determining after the file of reading and writing is index file, there is bad track in the sector that judges the first index file to be read and write, if there is bad track, directly select a sector that is used for replacement from the sector of the second index file, the sector that is used in the second index file replacing is read and write; Determining after the file of reading and writing is data file judge whether the sector of data file to be read and write exists bad track, if there is bad track, directly skipping this sector, next sector of this sector is being 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, the first read-write cell 302 and the second read-write 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, determining after the file of reading and writing is index file, export file parameters to the first read-write cell 302 to be read and write, and trigger the first read-write cell 302; Determining after the file of reading and writing is data file, exporting file parameters to the second read-write cell 303 to be read and write, and triggering the second read-write cell 303.Wait the file parameters of reading and writing include file title, attribute, memory location when pre-creating file at least.
The first read-write cell 302 is according to triggering and file parameters to be read and write, the sector that the first index file takies is read and write, judge whether the sector that the first index file takies exists bad track, there is bad track in the sector of determining the first index file to be read and write, select a sector of the second index file to replace the sector that has bad track in the first index file, the sector that is used in the second index file replacing is read and write.
The second read-write 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, judge whether the sector that 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 first read write command or receiving the format instruction, and further the output file head is set up instruction 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 the first index file, sets up the data file head in data file.Described the first index file head is in order to the status information of each sector auxiliary information of recording the first index file and taking, each sector, and the replacement information of each sector.Wherein, the status information of described each sector is for representing whether this sector exists the information of bad track; The replacement information of described each sector is the sector auxiliary information for the second index file of 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 the first read-write cell 302 from index file, output the first index file head to the first read-write cell 302; According to the first index file head after the renewal of the first read-write cell 302 outputs, the first index file head in the first index file is modified.File header read-write cell 304 obtains the data file head according to the triggering of the second read-write cell 303 from data file, output data file head to the second read-write cell 303; According to the data file head after the renewal of the second read-write cell 302 outputs, the data file head in the data file is modified.
The 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 the 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 for replacement in the second index file according to the replacement information of sector; The first read-write cell 302 upgrades the sector auxiliary information that is used for replacing in its sector auxiliary information that has bad track of determining and the 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 recorded status information and the replacement information of sector to be read and write in the first index file head, the first read-write cell 302 is read and write the sector that is used in the second index file replacing according to above-mentioned information; If recorded the status information of sector to be read and write in the first index file head, do not record the replacement information of sector to be read and write, the 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 the second index file, select the sector in the second index file to replace the sector that has bad track in the first index file, and record the replacement information of this sector in the first index file head.If do not record status information and the replacement information of sector to be read and write in the first index file head, the first read-write cell 304 determines whether sector to be read and write exists bad track, and when determining to have bad track, selects to be used in the second index file the sector of replacement.
The second read-write 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 that has bad track of determining is 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 of preventing from setting 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 the first index file; Described general act head is used for recording described the first index file head and data file head.File header read-write 304 judges further whether the first index file head shared sector in the first index file exists bad track when reading the first index file head, if exist, obtain the first index file head of backup from the general act head; Perhaps when read data files, judge further whether the data file shared sector in data file exists bad track, if exist, obtain the data file head of backup from the general act head.
In above-mentioned preferred embodiment of the present invention, in the situation that there is bad track in the sector that the first index file takies, with the sector in the second index file, the sector that has bad track is replaced, and the first index file head is upgraded; In the situation that there is bad track in the sector that data file takies, 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 in the situation that do not format, can read and write normally the hard disk that has bad track.
The above is only preferred embodiment of the present invention, and is in order to limit the present invention, within the spirit and principles in the present invention not all, any modification of making, is equal to replacement, improvement etc., within all should being included in the scope of protection of the invention.

Claims (14)

1. a hard disk management method, is characterized in that, the method is the management method in hard disc data district, and the method comprises:
The type of reading and writing of files is treated in A, basis file attribute judgement to be read and write, and is defined as the first index file, and execution in step B is defined as data file, execution in step C; The index file that described the first index file uses for the user;
B, determine after there is bad track in the sector of the first index file of reading and writing, the sector of selecting to be used in the second index file replacing is read and write; Described the second index file is to be in the idle index file that is used for backup;
C, determine after there is bad track in the sector of the data file of reading and writing, 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 steps A:
Set up the first index file head in the first index file, set up the data file head in data file;
Described the first index file head is in order to the status information of each sector of recording the 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; The status information of described each sector is for representing whether this sector exists the information of bad track; The replacement information of described each sector is the sector auxiliary information for the second index file of replacing.
3. method according to claim 2, it is characterized in that, step B is described further to be comprised after the sector of be used for replacing in the second index file is read and write: exist the sector auxiliary information that is used for replacing in the sector auxiliary information of bad track and the second index file to be recorded in described the first index file head the first index file.
4. method according to claim 2, is characterized in that, step C carries out further comprising after 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 the 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 step B: judge whether the first index file head shared sector in the first index file exists bad track, if exist, obtain the first index file head from the general act head, otherwise, obtain the first index file head in the first index file.
7. method according to claim 6, it is characterized in that, step B is described further to be comprised after the sector of be used for replacing in the second index file is read and write: described when obtaining the first index file head from the general act head, and will exist the sector auxiliary information that is used for replacing in the sector auxiliary information of bad track and the second index file to be recorded in the first index file head of described general act head in the first index file;
Described when obtaining the first index file head in the first index file, will exist the sector auxiliary information that is used for replacing in the sector auxiliary information of bad track and the second index file to be recorded in the first index file head of described the first index file in the first index file.
8. method according to claim 5, it is characterized in that, further comprise between steps A and step C: judge whether the data file shared sector in data file exists bad track, if exist, obtain the data file head from the general act head, otherwise, obtain the data file head in data file.
9. method according to claim 8, it is characterized in that, step C carries out further comprising after read-write operation in described next sector to the sector that has bad track: described when obtaining data file from the general act head, the sector auxiliary information that has bad track is recorded in data file head in described general act head;
Described when obtaining data file in the data file, the sector auxiliary information that has bad track is recorded in data file head in described data file.
10. the described method of any one according to claim 2 to 9, is characterized in that, the sector that is used for replacing in described selection the 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 for the second index file of replacing, if there is no, according to the replacement information of each sector in the first index file head, select one for the sector of replacing from the second index file; If exist, directly obtain the sector auxiliary information that is used for replacement in the second index file from the first index file head;
B2, the sector of be used for replacing in the 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, and this device comprises:
Trigger element according to treating reading and writing of files parameter and read write command, is being determined after the file of reading and writing is index file, exports file parameters to the first read-write cell to be read and write, and triggers the first read-write cell; Perhaps determining after the file of reading and writing is data file, exporting file parameters to the second read-write cell to be read and write, and triggering the second read-write cell; Described file parameters wait reading and writing is include file title, attribute and the memory location when pre-creating file at least;
The first read-write cell according to triggering and file parameters to be read and write, is read and write the sector that the first index file takies, and has bad track in the sector of determining the first index file to be read and write, and the sector of selecting to be used in the second index file replacing is read and write;
The second read-write 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 first read write command 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 the first index file, sets up the data file head in data file;
Described the first index file head is in order to the status information of each sector auxiliary information of recording the 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; The status information of described each sector is for representing whether this sector exists the information of bad track; The replacement information of described each sector is the sector auxiliary information for the second index file of replacing.
13. device according to claim 12 is characterized in that,
Described the 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 the second index file to be recorded in the first index file head in the first index file, the first index file head after output is upgraded be to described file header read-write cell;
Described the second read-write 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; In the data file head, the data file head after output is upgraded is to described file header read-write cell with the information recording/of sector that has bad track in data file;
Described file header reading unit reads the first index file head further according to the triggering of the first read-write cell, and output the first index file head is to described the first read-write cell; Perhaps according to the triggering of the second read-write cell, the read data files head, the output data file head is to described the second read-write cell; Revise the first index file head according to the first index file head after the renewal that receives; Perhaps according to the data file Update Table file header 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 the first index file; Described general act head is in order to back up described the 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 CN102063273A (en) 2011-05-18
CN102063273B true 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)

Families Citing this family (2)

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

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

Also Published As

Publication number Publication date
CN102063273A (en) 2011-05-18

Similar Documents

Publication Publication Date Title
JP4749255B2 (en) Storage system control device having multiple types of storage devices
US7363540B2 (en) Transaction-safe FAT file system improvements
US7174420B2 (en) Transaction-safe FAT file system
US20090132621A1 (en) Selecting storage location for file storage based on storage longevity and speed
KR20050015972A (en) Apparatus and method for controlling booting of computer system
KR100703807B1 (en) Method and apparatus for managing block by update type of data in block type memory
CN102096561B (en) Hierarchical data storage processing method, device and storage equipment
US8140793B2 (en) Virtual tape device, data backup method, and recording medium
CN103092849A (en) File system cluster management method
CN102591797A (en) Auxiliary storage device and processing method thereof
US20160011792A1 (en) Media control device and control method
CN100543748C (en) A kind of method and system of utilizing file allocation table to carry out the file tracking
CN101303667B (en) Method and device for establishing magnetic disk null cluster table and seeking magnetic disk null cluster
CN102063273B (en) Hard disk management method and device
KR101258589B1 (en) Information storage medium recording data according to journaling file system, method and apparatus of writing/recovering data using journaling file system
JP2005284816A (en) Disk array system
CN101464837A (en) Information recording device and information recording method
CN101673242A (en) Method and device for formatting hard disk
US20070061530A1 (en) Method for storage of digital data in a mainframe data center and associated device
JPH08110868A (en) Information recording and reproducing device
CN109656881B (en) Method and system for realizing dynamic file management based on FAT16 technology
US20140059305A1 (en) Management apparatus, storage device, and initialization method
KR20030061948A (en) : Apparatus storing information and method for controlling the File using its
JP4572205B2 (en) Flash memory drive device, control method thereof, and program thereof
CN101176075A (en) Circuit and method for improving service lifetime of memory device

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