CN110471623B - Hard disk file writing method, device, computer equipment and storage medium - Google Patents
Hard disk file writing method, device, computer equipment and storage medium Download PDFInfo
- Publication number
- CN110471623B CN110471623B CN201910698552.7A CN201910698552A CN110471623B CN 110471623 B CN110471623 B CN 110471623B CN 201910698552 A CN201910698552 A CN 201910698552A CN 110471623 B CN110471623 B CN 110471623B
- Authority
- CN
- China
- Prior art keywords
- file
- data
- read
- write operation
- key area
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 44
- 238000004590 computer program Methods 0.000 claims description 18
- 238000001514 detection method Methods 0.000 claims description 7
- 238000005192 partition Methods 0.000 description 13
- 230000004048 modification Effects 0.000 description 4
- 238000012986 modification Methods 0.000 description 4
- 238000010586 diagram Methods 0.000 description 3
- 230000006870 function Effects 0.000 description 3
- 238000005516 engineering process Methods 0.000 description 2
- 230000001360 synchronised effect Effects 0.000 description 2
- 101000824318 Homo sapiens Protocadherin Fat 1 Proteins 0.000 description 1
- 101000824299 Homo sapiens Protocadherin Fat 2 Proteins 0.000 description 1
- 102100022095 Protocadherin Fat 1 Human genes 0.000 description 1
- 102100022093 Protocadherin Fat 2 Human genes 0.000 description 1
- 238000012544 monitoring process Methods 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/07—Responding to the occurrence of a fault, e.g. fault tolerance
- G06F11/14—Error detection or correction of the data by redundancy in operation
- G06F11/1402—Saving, restoring, recovering or retrying
- G06F11/1446—Point-in-time backing up or restoration of persistent data
- G06F11/1448—Management of the data involved in backup or backup restore
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0602—Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
- G06F3/0614—Improving the reliability of storage systems
- G06F3/0619—Improving the reliability of storage systems in relation to data integrity, e.g. data losses, bit errors
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0628—Interfaces specially adapted for storage systems making use of a particular technique
- G06F3/0638—Organizing or formatting or addressing of data
- G06F3/0643—Management of files
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0668—Interfaces specially adapted for storage systems adopting a particular infrastructure
- G06F3/0671—In-line storage system
- G06F3/0673—Single storage device
- G06F3/0679—Non-volatile semiconductor memory device, e.g. flash memory, one time programmable memory [OTP]
Abstract
The invention relates to a hard disk file writing method, a device, computer equipment and a storage medium, wherein the hard disk file writing method comprises the steps of detecting whether a file corresponding to read-write operation is a preset file or not; when the file corresponding to the read-write operation is a preset file, writing the data corresponding to the read-write operation into a data area according to the read-write operation, and not updating the data of a key area, wherein the data area is used for storing the data file, and the key area is used for storing the guide file. And comparing the operation allocation file corresponding to each read-write operation with a preset file, wherein when the operation allocation file and the preset file are matched, namely the current read-write operation contains data of the specified file, the hard disk file allocation table is not updated, and the damage to the data of the key area when the hard disk is in fault, the system is suddenly powered off or is manually damaged is avoided, so that the data loss of the data area is avoided.
Description
Technical Field
The present invention relates to the field of information technologies, and in particular, to a method and apparatus for writing a hard disk file, a computer device, and a storage medium.
Background
With the improvement of digital audio monitoring technology, in the conventional FAT32 file system, for the DVR (Digital Video Recorder) system for continuously reading and writing data and file indexes in ten to twenty four hours per day, the hard disk magnetic head needs to frequently read and write data and file indexes, and the magnetic head frequently jumps, so that hard disk faults occur, and meanwhile, the situation that the system is suddenly powered off or is manually damaged exists, which occurs in the process of storing a specified file by the DVR system, for example, when the specified file is read, the data of a key area and the data area are updated, but the updating of the data of the key area is easily interrupted at this time, so that the data of the key area is damaged, and the data of the data area is lost.
Disclosure of Invention
Based on this, it is necessary to provide a hard disk file writing method, apparatus, computer device and storage medium that are simple in steps and avoid data corruption of critical areas.
A hard disk file writing method, comprising: acquiring read-write operation; detecting whether the file corresponding to the read-write operation is a preset file or not; when the file corresponding to the read-write operation is a preset file, writing the data corresponding to the read-write operation into a data area according to the read-write operation, and not updating the data of a key area, wherein the data area is used for storing the data file, and the key area is used for storing the guide file.
In one embodiment, the step of detecting whether the file corresponding to the read-write operation is a preset file further includes: and when the file corresponding to the read-write operation is not a preset file, writing the data corresponding to the read-write operation into the data area according to the read-write operation, and updating the data of the key area.
In one embodiment, the key areas include a first key area for storing the guideline file and a second key area for storing the divisor data file.
In one embodiment, when the file corresponding to the read-write operation is not a preset file, writing the data corresponding to the read-write operation into the data area according to the read-write operation, and updating the data of the key area includes: when the file corresponding to the read-write operation is not a preset file, writing the data corresponding to the read-write operation into the data area according to the read-write operation,and is also provided withUpdating the data of the second key area and simultaneously updating the data of the first key area.
In one embodiment, the step of detecting whether the file corresponding to the read-write operation is a preset file includes: and detecting whether the file name of the file corresponding to the read-write operation is a preset file name.
In one embodiment, the step of detecting whether the file corresponding to the read-write operation is a preset file includes: and detecting whether the file type of the file corresponding to the read-write operation is a preset file type.
In one embodiment, the step of detecting whether the file corresponding to the read-write operation is a preset file further includes: and when the file corresponding to the read-write operation is a preset file and the read-write operation does not have the data written in the data area, the data of the key area is not updated.
A hard disk file writing apparatus comprising: the acquisition module is used for acquiring read-write operation; the detection module is used for detecting whether the file corresponding to the read-write operation is a preset file or not; and the analysis processing module is used for writing the data corresponding to the read-write operation into the data area according to the read-write operation when the file corresponding to the read-write operation is a preset file, and not updating the data of the key area, wherein the data area is used for storing the data file, and the key area is used for storing the index file.
A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the steps of: acquiring read-write operation; detecting whether the file corresponding to the read-write operation is a preset file or not; when the file corresponding to the read-write operation is a preset file, writing the data corresponding to the read-write operation into a data area according to the read-write operation, and not updating the data of a key area, wherein the data area is used for storing the data file, and the key area is used for storing the guide file.
A computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of: acquiring read-write operation; detecting whether the file corresponding to the read-write operation is a preset file or not; when the file corresponding to the read-write operation is a preset file, writing the data corresponding to the read-write operation into a data area according to the read-write operation, and not updating the data of a key area, wherein the data area is used for storing the data file, and the key area is used for storing the guide file.
According to the method, the device, the computer equipment and the storage medium for writing the hard disk file, the operation distribution file corresponding to each read-write operation is compared with the preset file, and when the operation distribution file and the preset file are matched, namely the current read-write operation comprises data of the designated file, the hard disk file distribution table is not updated, so that the damage to the data of the key area when the hard disk fails, the system is suddenly powered off or is manually damaged is avoided, and the data loss of the data area is avoided.
Drawings
FIG. 1 is a flow chart of a method for writing a hard disk file according to an embodiment;
FIG. 2 is a schematic diagram of a hard disk file writing system according to an embodiment;
Fig. 3 is an internal structural diagram of a computer device of an embodiment.
Detailed Description
In order that the invention may be readily understood, a more complete description of the invention will be rendered by reference to the appended drawings. The drawings illustrate preferred embodiments of the invention. This invention may, however, be embodied in many different forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete.
It will be understood that when an element is referred to as being "disposed on" another element, it can be directly on the other element or intervening elements may also be present. When an element is referred to as being "connected" to another element, it can be directly connected to the other element or intervening elements may also be present. The terms "vertical," "horizontal," "left," "right," and the like are used herein for illustrative purposes only and are not meant to be the only embodiment.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs. The terminology used herein in the description of the invention is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. The term "and/or" as used herein includes any and all combinations of one or more of the associated listed items.
The invention relates to a hard disk file writing method. For example, the hard disk file writing method includes: acquiring read-write operation; detecting whether the file corresponding to the read-write operation is a preset file or not; when the file corresponding to the read-write operation is a preset file, writing the data corresponding to the read-write operation into a data area according to the read-write operation, and not updating the data of a key area, wherein the data area is used for storing the data file, and the key area is used for storing the guide file. And comparing the operation allocation file corresponding to each read-write operation with a preset file, wherein when the operation allocation file and the preset file are matched, namely the current read-write operation contains data of the specified file, the hard disk file allocation table is not updated, and the damage to the data of the key area when the hard disk is in fault, the system is suddenly powered off or is manually damaged is avoided, so that the data loss of the data area is avoided.
Fig. 1 is a flowchart of a method for writing a hard disk file according to an embodiment of the invention.
A hard disk file writing method comprises the following steps of:
s100: and obtaining read-write operation.
In this embodiment, the hard disk needs to perform reading and writing of the file to update data in the hard disk, and each reading and writing operation includes two operations of reading and writing the file of the hard disk, where the two operations are both to update the data in the hard disk, and the updated data includes the data in the key area and the data in the data area, so that the reading and writing operation needs to be acquired and analyzed, so that the file corresponding to the reading and writing operation is convenient to acquire, further, the comparison between the file and the preset file is convenient, and the subsequent judgment of whether the reading and writing operation is the modification of the data in the key area of the hard disk is also convenient.
S200: and detecting whether the file corresponding to the read-write operation is a preset file or not.
In this embodiment, each read-write operation has a corresponding read-write file, and each read-write operation has a corresponding file including corresponding update data. The file corresponding to each read-write operation is converted through the application program FAT32 file system, namely, the data in each read-write operation is converted into the corresponding read-write file, the type and the file name of the read-write file are determined according to the data content of the read-write operation, and according to the comparison result of the file corresponding to the read-write operation and the preset file, whether the data corresponding to the current read-write operation is used for updating the key area or not is conveniently judged, so that the subsequent protection of the data of the key area is facilitated. In this embodiment, the preset file is a file of a preset type, or a file of a preset name, or a file of a name with a preset rule.
S300: when the file corresponding to the read-write operation is a preset file, writing the data corresponding to the read-write operation into a data area according to the read-write operation, and not updating the data of a key area, wherein the data area is used for storing the data file, and the key area is used for storing the guide file.
In this embodiment, according to the comparison result of the file corresponding to the read-write operation and the preset file, it is determined whether the data corresponding to the read-write operation includes data for the key area, for example, when the file corresponding to the read-write operation is the preset file, the file corresponding to the read-write operation at this time is matched with the preset file, that is, the file corresponding to the read-write operation is the same as or similar to the preset file, that is, the file corresponding to the read-write operation is one of the preset files, so that the data corresponding to the read-write operation includes data for updating the key area and data for the data area, and the data for the key area is used for indicating the position and specific data content of the data area, that is, the data for the key area is a file with an index function, that is, the guide file stored in the key area points to the corresponding data area, that is worth mentioning, the key area may also be referred to as the key information area, or referred to as the index area, and the key area is used for storing the index information, that is, the file. In order to avoid the situation that the critical area is damaged when the data of the critical area is updated during hard disk faults, the data of the critical area is not updated at the moment, the data integrity of the critical area is ensured, the situation that the data of the critical area is interrupted in the updating process is avoided, the fact that the critical area still points to the corresponding data area is ensured, and further the data loss of the data area is avoided.
In an embodiment, the step of detecting whether the file corresponding to the read-write operation is a preset file further includes: and when the file corresponding to the read-write operation is not a preset file, writing the data corresponding to the read-write operation into the data area according to the read-write operation, and updating the data of the key area. And the file corresponding to the read-write operation is not matched with the preset file, namely the file corresponding to the read-write operation does not belong to the preset file. The preset file includes a plurality of files, for example, the preset file includes at least one of a video file, an audio file, an image file, an index file, a disk information file, a video query record file, and a log file. The file corresponding to the read-write operation is not the preset file, that is, the file corresponding to the read-write operation does not belong to any one of a video file, an audio file, an image file, an index file, a disk information file, a video query record file and a log file, but the video file, the audio file, the image file, the index file, the disk information file, the video query record file and the log file are important files of the hard disk, wherein the important files comprise data updated to the key area. Therefore, the data corresponding to the read-write operation does not include the data corresponding to the preset file, so that the update of the key area and the data area by the data corresponding to the read-write operation is not influenced, namely, the data corresponding to the read-write operation does not influence the key area corresponding to the preset file when the data corresponding to the read-write operation is updated. In addition, it should be noted that, because the capacity and the number of the critical areas are fixed in the process of initializing the partition of the hard disk, when the data corresponding to the read-write operation needs to be written into the critical areas, the data of the original critical areas can only be replaced, that is, the data corresponding to the read-write operation is replaced by the current data of the critical areas, that is, the original data of the critical areas is covered by the data corresponding to the read-write operation.
In this embodiment, the key areas include a first key area for storing the directed file and a second key area for storing the data file. In this embodiment, when the file corresponding to the read-write operation is a preset file, writing the data corresponding to the read-write operation into the data area according to the read-write operation, and not updating the data of the first key area, that is, not updating the guide file of the first key area; and when the file corresponding to the read-write operation is not a preset file, writing the data corresponding to the read-write operation into the data area according to the read-write operation, and updating the data of the second key area, namely updating the data of the second key area.
When the file corresponding to the reading operation is matched with the preset file, the data of the first key area will not be updated, so that the data of the first key area is prevented from being interrupted in the updating process, namely, the data of the first key area is prevented from being damaged, and the situation that the data of the data area corresponding to the first key area is lost is avoided. The data of the first key area is irrelevant to the data of the preset file, namely, the data of the first key area is irrelevant to the data of the preset file, and when the file corresponding to the read-write operation is not the preset file, the data of the second key area is relevant to the data of the file corresponding to the read-write operation at the moment, the data of the second key area is updated at the moment and does not influence the first key area, namely, the data of the first key area is not modified by modifying the data of the second key area at the moment. And when the file corresponding to the read-write operation is not the preset file, the file corresponding to the read-write operation is not an important file of the hard disk, and at the moment, the update of the file corresponding to the read-write operation on the hard disk does not affect the data of the first key area, so that when the file corresponding to the read-write operation is not the preset file, the data corresponding to the read-write operation only updates the data of the second key area, and the data of the first key area and the data area corresponding to the first key area are not updated, thereby keeping the data of the first key area intact and avoiding the loss of important file information of the hard disk.
In an embodiment, the first critical section includes first critical data and second critical data, the second critical data is a backup of the first critical data, that is, when the first critical data is damaged, the second critical data is used as data of the first critical section, that is, when the first critical data is damaged, the second critical data replaces the first critical data, for example, the first critical data includes data of a FAT1 table, and the second critical data includes data of a FAT2 table.
In an embodiment, when the file corresponding to the read-write operation is not a preset file, writing the data corresponding to the read-write operation into the data area according to the read-write operation, and updating the data of the key area includes: and when the file corresponding to the read-write operation is not a preset file, writing the data corresponding to the read-write operation into the data area according to the read-write operation, updating the data of the second key area, and not updating the data of the first key area. Because the file corresponding to the read-write operation is not matched with the preset file, that is, the file corresponding to the read-write operation is not an important file required by the hard disk, that is, the file corresponding to the read-write operation does not belong to any one of a video file, an image file, an index file, a disk information file, a video query record file and a log file, that is, the operations of reading and writing the file corresponding to the read-write operation do not affect the content of the important file in the hard disk, and the data of the file corresponding to the read-write operation at the moment does not update the data of the first key area. The file corresponding to the read-write operation at the moment can be written into the hard disk, so that the file corresponding to the read-write operation at the moment is updated by updating the data of the second key area and the corresponding data area, and the data of the first key area is not updated, namely, the data of the second key area is updated by the file corresponding to the read-write operation at the moment and the data of the first key area are not updated through the control of a system program, so that even if the hard disk is in fault or the system is suddenly powered off or is damaged by people, the data of the first key area is not updated due to the fact that the data of the second key area is only updated, so that the first key area is not affected, namely, the data of the first key area is not updated, and the guide file of the first key area is not damaged, and the data loss of the data area corresponding to the first key area is avoided.
In this embodiment, the first key area is used to store a first file, the second key area is used to store a second file, the first file is used to guide the first data file in the data area, the second file is used to store the second data file in the data area, and the data update of the data area includes updating the attribute of the file in the data area and updating specific data in the file.
In an embodiment, the step of detecting whether the file corresponding to the read-write operation is a preset file includes: and detecting whether the file name of the file corresponding to the read-write operation is a preset file name. The file names of the preset files have different formats, and only when the format of the file name of the file corresponding to the read-write operation is the same as that of the file name of the preset file, the system program judges that the file corresponding to the current read-write operation belongs to the preset file, for example, the preset file comprises a video file and an image file, and the corresponding file name belongs to the range between 00000000 and 0 FFFFF; for another example, the preset file includes an index file, and a corresponding file name is RECINDEX; for another example, the preset file includes a disk information file, and the corresponding file name is DISKINFO; for another example, the preset file includes a video query record file, and the corresponding file name is DVRREC01; for another example, the preset file includes a log file, and the corresponding file name is dvr_lobb. In the process of each read-write operation, the file corresponding to the read-write operation generates a corresponding file name through the application FAT32 file system, and the file name of the file corresponding to the read-write operation is converted according to the data contained in the file, for example, if the file corresponding to the read-write operation contains video data, the file name of the file corresponding to the read-write operation is converted into the file name corresponding to the video file through the application FAT32 file system; for another example, if the file corresponding to the read-write operation includes photo data, the file name of the file corresponding to the read-write operation is converted into the file name corresponding to the image file through the application program FAT32 file system; for another example, if the file corresponding to the read-write operation includes index data, the file name of the file corresponding to the read-write operation is converted into the file name corresponding to the index file through the application FAT32 file system; for another example, if the file corresponding to the read-write operation includes disk information data, the file name of the file corresponding to the read-write operation is converted into the file name corresponding to the disk information file through the application program FAT32 file system; for another example, if the file corresponding to the read-write operation includes the record query record data, the file name of the file corresponding to the read-write operation is converted into the file name corresponding to the record query record file through the application program FAT32 file system; for another example, if the file corresponding to the read/write operation includes log data, the file name of the file corresponding to the read/write operation is converted into the file name corresponding to the log file through the application FAT32 file system.
Moreover, according to the comparison result of the file name of the file corresponding to the read-write operation and the file name of the preset file, the system program executes corresponding steps, for example, when the file name of the file corresponding to the read-write operation is the file name of the preset file, the data corresponding to the read-write operation is written into the data area according to the read-write operation, and the data of the key area is not updated; for another example, when the file name of the file corresponding to the read-write operation is not the file name of the preset file, writing the data corresponding to the read-write operation into the data area according to the read-write operation, and updating the data of the key area. Therefore, when the hard disk executes the read-write operation, the comparison of the files can be realized according to the file names, so that the comparison between the files corresponding to the read-write operation and the preset files is more convenient, and the file reading and writing efficiency is improved.
In an embodiment, the step of detecting whether the file corresponding to the read-write operation is a preset file includes: and detecting whether the file type of the file corresponding to the read-write operation is a preset file type. The file types of the preset files have different formats, and in this embodiment, the file types are file suffix names. Only when the format of the file type corresponding to the read-write operation is the same as the format of the file type of the preset file, the system program judges that the file corresponding to the current read-write operation belongs to the preset file, for example, the preset file comprises a video file, and the corresponding file type is bsv; for another example, the preset file includes an image file, and the corresponding file type is bsp; for another example, the preset file includes one of an index file, a disk information file, a video query record file and a log file, and the corresponding file type is dat. In the process of each read-write operation, the file corresponding to the read-write operation generates a corresponding file type through the application FAT32 file system, and the file type of the file corresponding to the read-write operation is converted according to the data contained in the file, for example, if the file corresponding to the read-write operation contains video data, the file type of the file corresponding to the read-write operation is converted into the file type corresponding to the video file through the application FAT32 file system; for another example, if the file corresponding to the read-write operation includes photo data, the file type of the file corresponding to the read-write operation is converted into the file type corresponding to the image file through the application program FAT32 file system; for another example, if the file corresponding to the read-write operation includes index data, the file type of the file corresponding to the read-write operation is converted into the file type corresponding to the index file through the application program FAT32 file system; for another example, if the file corresponding to the read-write operation includes disk information data, the file type of the file corresponding to the read-write operation is converted into the file type corresponding to the disk information file through the application program FAT32 file system; for another example, if the file corresponding to the read-write operation includes the video query record data, the file type of the file corresponding to the read-write operation is converted into the file type corresponding to the video query record file through the application program FAT32 file system; for another example, if the file corresponding to the read-write operation includes log data, the file type of the file corresponding to the read-write operation is converted into the file type corresponding to the log file through the application FAT32 file system.
Moreover, according to the comparison result of the file type of the file corresponding to the read-write operation and the file type of the preset file, the system program executes corresponding steps, for example, when the file type of the file corresponding to the read-write operation is the file type of the preset file, the data corresponding to the read-write operation is written into the data area according to the read-write operation, and the data of the key area is not updated; for another example, when the file type of the file corresponding to the read-write operation is not the file type of the preset file, writing the data corresponding to the read-write operation into the data area according to the read-write operation, and updating the data of the key area. Therefore, when the hard disk executes the read-write operation, the comparison of the files can be realized according to the file types, so that the comparison between the files corresponding to the read-write operation and the preset files is more convenient, and the file reading and writing efficiency is improved.
In an embodiment, the step of detecting whether the file corresponding to the read-write operation is a preset file includes: and detecting whether the file name and the file type of the file corresponding to the read-write operation are the file name and the file type of a preset file. And comparing the file name of the file with two parameters of the file type, so as to judge whether the file corresponding to the read-write operation is a preset file or not. That is, the comparison of the file corresponding to the read-write operation and the preset file is to perform the comparison of the file name and the file type respectively, and only if the two parameters are matched, the system program can judge that the file corresponding to the read-write operation is the preset file, so that the matching similarity between the file corresponding to the read-write operation and the preset file is higher through the comparison of the file name and the file type, the comparison accuracy of the file corresponding to the read-write operation is improved, and the reliability of the file stored in the hard disk is higher.
In an embodiment, the step of detecting whether the file corresponding to the read-write operation is a preset file further includes: and when the file corresponding to the read-write operation is a preset file and the read-write operation does not have the data written in the data area, the data of the key area is not updated. In this embodiment, the file corresponding to the read-write operation at this time only includes the data of the critical area, and the file corresponding to the read-write operation at this time is a preset file, so that the data included in the file corresponding to the read-write operation at this time is the data of the first critical area, that is, the file corresponding to the read-write operation at this time is the guide file of the first critical area. In this way, the system program correspondingly executes the data of the first key area, namely the data of the first key area is not updated, namely the guide file of the first key area is not updated, so that the data of the first key area is not destroyed, and the data loss of the data area corresponding to the first key area is avoided.
In an embodiment, the method further includes the following steps before the read-write operation is acquired: creating a hard disk partition; distributing the sizes and the numbers of various information files according to the capacity sizes of the partitions; a plurality of different purpose preset files are created. The hard disk partition is to divide the capacity of the hard disk, for example, divide the hard disk into equal volumes, and the capacity in each partition is equal, so that the number of files stored in each partition is equal. Furthermore, functional area division is required to be performed on each partition after the hard disk partition, so that each partition has a corresponding key area and a data area; the data in each partition is distributed, namely, different data in each partition are distributed into the corresponding files, so that the management of the data is facilitated; and then, distributing the files corresponding to the data with the same function to the pre-distributed files according to different functions of the data in the files, wherein the pre-distributed files with higher importance are used as the follow-up preset files, wherein the importance of the pre-distributed files is determined according to the file names and the file types, and the files with specific file names and the file types, which are designated by a system program, can be also used, for example, the preset files are files containing the data of the key areas.
The following is one specific example:
in this embodiment, the preset files include video files, audio files, and image files, for example, the names of the video files are from 01000000.Bsv to 0100000. Bsv, when the file name detected by the corresponding file of the read-write operation is 01010000.Bsv, the corresponding file name is within the range of the video file name, that is, the corresponding file of the current read-write operation belongs to the preset file, that is, the corresponding data of the video file in the hard disk is updated by the current read-write operation, wherein the updating of the corresponding video data in the data area includes the modification of the information of the file size, the file access, the modification time and the like of the key area, and in order to avoid the interruption of the data in the key area caused by the hard disk fault during the updating, the system program controls the hard disk to not update the data in the key area at this time, so that the data in the key area is not destroyed, the data in the data area can still be updated, the guide file damage of the key area is avoided, and the old data in the key area can still be used for the updating the data area, and the loss of the data in the corresponding data area can be avoided. As for the audio file, the image file and other files belonging to the preset file, the method steps are the same as the above steps, and will not be repeated here.
In one embodiment, referring to fig. 2, a hard disk file writing device 10 is provided, which includes: an obtaining module 110, configured to obtain a read-write operation; the detection module 120 is configured to detect whether the file corresponding to the read-write operation is a preset file; and the analysis processing module 130 is configured to write data corresponding to the read-write operation into a data area according to the read-write operation when the file corresponding to the read-write operation is a preset file, and not update data of a key area, where the data area is used for storing data files, and the key area is used for storing index files.
In an embodiment, when the detection module detects that the file corresponding to the read-write operation is not a preset file, the analysis processing module writes the data corresponding to the read-write operation into the data area according to the read-write operation, and updates the data of the key area. The detection module transmits the information that the file corresponding to the read-write operation is not the preset file to the analysis processing module, and the analysis processing module correspondingly executes the processing instruction after acquiring the information, for example, the analysis processing module controls the writing of the data corresponding to the read-write operation into the data area and controls the data updating of the key area. The preset file includes a plurality of files, for example, the preset file includes at least one of a video file, an image file, an index file, a disk information file, a video query record file, and a log file. The file corresponding to the read-write operation is not the preset file, that is, the file corresponding to the read-write operation does not belong to any one of a video file, an image file, an index file, a disk information file, a video query record file and a log file, and the video file, the image file, the index file, the disk information file, the video query record file and the log file are important files of the hard disk, wherein the important files comprise data updated to the key area. Therefore, the data corresponding to the read-write operation does not include the data corresponding to the preset file, so that the update of the key area and the data area by the data corresponding to the read-write operation is not influenced, namely, the data corresponding to the read-write operation does not influence the key area corresponding to the preset file when the data corresponding to the read-write operation is updated. In addition, it should be noted that, because the capacity and the number of the critical areas are fixed in the process of initializing the partition of the hard disk, when the data corresponding to the read-write operation needs to be written into the critical areas, the data of the original critical areas can only be replaced, that is, the data corresponding to the read-write operation is replaced by the current data of the critical areas, that is, the original data of the critical areas is covered by the data corresponding to the read-write operation.
In an embodiment, the analysis processing module is configured to write the data corresponding to the read-write operation into the data area according to the read-write operation when the file corresponding to the read-write operation is not a preset file, and update the data of the second critical area, and not update the data of the first critical area. The key areas comprise a first key area and a second key area, the first key area is used for storing guide files corresponding to the preset files, and the second key area is used for storing data files except the preset files. When the file corresponding to the reading operation is matched with the preset file, the data of the first key area will not be updated, so that the data of the first key area is prevented from being interrupted in the updating process, namely, the data of the first key area is prevented from being damaged, and the situation that the data of the data area corresponding to the first key area is lost is avoided. The data of the first key area is irrelevant to the data of the preset file, namely, the data of the first key area is irrelevant to the data of the preset file, and when the file corresponding to the read-write operation is not the preset file, the data of the second key area is relevant to the data of the file corresponding to the read-write operation at the moment, the data of the second key area is updated at the moment and does not influence the first key area, namely, the data of the first key area is not modified by modifying the data of the second key area at the moment. And when the file corresponding to the read-write operation is not the preset file, the file corresponding to the read-write operation is not an important file of the hard disk, and at the moment, the update of the file corresponding to the read-write operation on the hard disk does not affect the data of the first key area, so that when the file corresponding to the read-write operation is not the preset file, the data corresponding to the read-write operation only update the data of the second key area and the corresponding data area, and the data of the first key area and the corresponding data area are not updated, thereby keeping the data of the first key area intact and avoiding the loss of important file information of the hard disk. Because the file corresponding to the read-write operation is not matched with the preset file, that is, the file corresponding to the read-write operation is not an important file required by the hard disk, that is, the file corresponding to the read-write operation does not belong to any one of a video file, an image file, an index file, a disk information file, a video query record file and a log file, that is, the operations of reading and writing the file corresponding to the read-write operation do not affect the content of the important file in the hard disk, and the data of the file corresponding to the read-write operation at the moment does not update the data of the first key area. The file corresponding to the read-write operation at the moment can be written into the hard disk, so that the file corresponding to the read-write operation at the moment is updated by updating the data of the second key area, and the data of the first key area is not updated, namely, the data of the second key area is not updated by the file corresponding to the read-write operation at the moment under the control of a system program, and the data of the first key area is not updated, so that even if the hard disk is in fault or the system is suddenly powered off or is damaged artificially, the data of the first key area is not updated due to the fact that the data of the second key area is only updated, namely, the data of the first key area is not updated, the guide file of the first key area is not damaged, and the data loss of the data area corresponding to the first key area is avoided.
In an embodiment, the detection module is configured to detect whether a file name of a file corresponding to the read-write operation is a preset file name. The file names of the preset files have different formats, and only when the format of the file name of the file corresponding to the read-write operation is the same as that of the file name of the preset file, the system program judges that the file corresponding to the current read-write operation belongs to the preset file, for example, the preset file comprises a video file and an image file, and the corresponding file name belongs to the range between 00000000 and 0 FFFFF; for another example, the preset file includes an index file, and a corresponding file name is RECINDEX; for another example, the preset file includes a disk information file, and the corresponding file name is DISKINFO; for another example, the preset file includes a video query record file, and the corresponding file name is DVRREC01; for another example, the preset file includes a log file, and the corresponding file name is dvr_lobb. In the process of each read-write operation, the file corresponding to the read-write operation generates a corresponding file name through the application FAT32 file system, and the file name of the file corresponding to the read-write operation is converted according to the data contained in the file, for example, if the file corresponding to the read-write operation contains video data, the file name of the file corresponding to the read-write operation is converted into the file name corresponding to the video file through the application FAT32 file system; for another example, if the file corresponding to the read-write operation includes photo data, the file name of the file corresponding to the read-write operation is converted into the file name corresponding to the image file through the application program FAT32 file system; for another example, if the file corresponding to the read-write operation includes index data, the file name of the file corresponding to the read-write operation is converted into the file name corresponding to the index file through the application FAT32 file system; for another example, if the file corresponding to the read-write operation includes disk information data, the file name of the file corresponding to the read-write operation is converted into the file name corresponding to the disk information file through the application program FAT32 file system; for another example, if the file corresponding to the read-write operation includes the record query record data, the file name of the file corresponding to the read-write operation is converted into the file name corresponding to the record query record file through the application program FAT32 file system; for another example, if the file corresponding to the read/write operation includes log data, the file name of the file corresponding to the read/write operation is converted into the file name corresponding to the log file through the application FAT32 file system.
In an embodiment, the detection module is configured to detect whether a file type of the file corresponding to the read-write operation is a preset file type. The file types of the preset files have different formats, and in this embodiment, the file types are file suffix names. Only when the format of the file type corresponding to the read-write operation is the same as the format of the file type of the preset file, the system program judges that the file corresponding to the current read-write operation belongs to the preset file, for example, the preset file comprises a video file, and the corresponding file type is bsv; for another example, the preset file includes an image file, and the corresponding file type is bsp; for another example, the preset file includes one of an index file, a disk information file, a video query record file and a log file, and the corresponding file type is dat. In the process of each read-write operation, the file corresponding to the read-write operation generates a corresponding file type through the application FAT32 file system, and the file type of the file corresponding to the read-write operation is converted according to the data contained in the file, for example, if the file corresponding to the read-write operation contains video data, the file type of the file corresponding to the read-write operation is converted into the file type corresponding to the video file through the application FAT32 file system; for another example, if the file corresponding to the read-write operation includes photo data, the file type of the file corresponding to the read-write operation is converted into the file type corresponding to the image file through the application program FAT32 file system; for another example, if the file corresponding to the read-write operation includes index data, the file type of the file corresponding to the read-write operation is converted into the file type corresponding to the index file through the application program FAT32 file system; for another example, if the file corresponding to the read-write operation includes disk information data, the file type of the file corresponding to the read-write operation is converted into the file type corresponding to the disk information file through the application program FAT32 file system; for another example, if the file corresponding to the read-write operation includes the video query record data, the file type of the file corresponding to the read-write operation is converted into the file type corresponding to the video query record file through the application program FAT32 file system; for another example, if the file corresponding to the read-write operation includes log data, the file type of the file corresponding to the read-write operation is converted into the file type corresponding to the log file through the application FAT32 file system.
In an embodiment, the analysis processing module is configured to not update the data of the key area when the file corresponding to the read-write operation is a preset file and the read-write operation does not have the data written into the data area. The file corresponding to the read-write operation only contains the data of the key area, and the file corresponding to the read-write operation is a preset file, so that the data contained in the file corresponding to the read-write operation at the moment is the data of the first key area, namely the file corresponding to the read-write operation at the moment is the guide file of the first key area. In this way, the system program correspondingly executes the data of the first key area, namely the data of the first key area is not updated, namely the guide file of the first key area is not updated, so that the data of the first key area is not destroyed, and the data loss of the data area corresponding to the first key area is avoided.
The specific limitation of the hard disk file writing device may be referred to the limitation of the hard disk file writing method hereinabove, and will not be described herein. The above-mentioned modules in the hard disk file writing device may be implemented in whole or in part by software, hardware, and a combination thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one embodiment, a computer device is provided, which may be a server, the internal structure of which may be as shown in fig. 3. The computer device includes a processor, a memory, and a network interface connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The network interface of the computer device is used for communicating with an external computer device through a network connection. The computer program is executed by a processor to implement a hard disk file writing method.
It will be appreciated by those skilled in the art that the structure shown in fig. 3 is merely a block diagram of some of the structures associated with the present application and is not limiting of the computer device to which the present application may be applied, and that a particular computer device may include more or fewer components than shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is provided comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, the processor implementing the steps of when executing the computer program:
acquiring read-write operation;
detecting whether the file corresponding to the read-write operation is a preset file or not;
when the file corresponding to the read-write operation is a preset file, writing the data corresponding to the read-write operation into a data area according to the read-write operation, and not updating the data of a key area, wherein the data area is used for storing the data file, and the key area is used for storing the guide file.
In one embodiment, the processor when executing the computer program further performs the steps of: after the step of detecting whether the file corresponding to the read-write operation is the preset file, the method further comprises the following steps: and when the file corresponding to the read-write operation is not a preset file, writing the data corresponding to the read-write operation into the data area according to the read-write operation, and updating the data of the key area. And the file corresponding to the read-write operation is not matched with the preset file, namely the file corresponding to the read-write operation does not belong to the preset file. The preset file includes a plurality of files, for example, the preset file includes at least one of a video file, an image file, an index file, a disk information file, a video query record file, and a log file. The file corresponding to the read-write operation is not the preset file, that is, the file corresponding to the read-write operation does not belong to any one of a video file, an image file, an index file, a disk information file, a video query record file and a log file, and the video file, the image file, the index file, the disk information file, the video query record file and the log file are important files of the hard disk, wherein the important files comprise data updated to the key area. Therefore, the data corresponding to the read-write operation does not include the data corresponding to the preset file, so that the update of the key area and the data area by the data corresponding to the read-write operation is not influenced, namely, the data corresponding to the read-write operation does not influence the key area corresponding to the preset file when the data corresponding to the read-write operation is updated. In addition, it should be noted that, because the capacity and the number of the critical areas are fixed in the process of initializing the partition of the hard disk, when the data corresponding to the read-write operation needs to be written into the critical areas, the data of the original critical areas can only be replaced, that is, the data corresponding to the read-write operation is replaced by the current data of the critical areas, that is, the original data of the critical areas is covered by the data corresponding to the read-write operation.
In one embodiment, the processor when executing the computer program further performs the steps of: when the file corresponding to the read-write operation is not a preset file, writing the data corresponding to the read-write operation into the data area according to the read-write operation, and updating the data of the key area comprises: and when the file corresponding to the read-write operation is not a preset file, writing the data corresponding to the read-write operation into the data area according to the read-write operation, updating the data of the second key area, and not updating the data of the first key area. Because the file corresponding to the read-write operation is not matched with the preset file, that is, the file corresponding to the read-write operation is not an important file required by the hard disk, that is, the file corresponding to the read-write operation does not belong to any one of a video file, an image file, an index file, a disk information file, a video query record file and a log file, that is, the operations of reading and writing the file corresponding to the read-write operation do not affect the content of the important file in the hard disk, and the data of the file corresponding to the read-write operation at the moment does not update the data of the first key area. The file corresponding to the read-write operation at the moment can be written into the hard disk, so that the file corresponding to the read-write operation at the moment is updated by updating the data of the second key area, and the data of the first key area is not updated, namely, the data of the second key area is not updated by the file corresponding to the read-write operation at the moment under the control of a system program, and the data of the first key area is not updated, so that even if the hard disk is in fault or the system is suddenly powered off or is damaged artificially, the data of the first key area is not updated due to the fact that the data of the second key area is only updated, namely, the data of the first key area is not updated, the guide file of the first key area is not damaged, and the data loss of the data area corresponding to the first key area is avoided. When the file corresponding to the read-write operation is not a preset file, writing the data corresponding to the read-write operation into the data area according to the read-write operation, and updating the data of the key area comprises: and when the file corresponding to the read-write operation is not a preset file, writing the data corresponding to the read-write operation into the data area according to the read-write operation, updating the data of the second key area, and not updating the data of the first key area. Because the file corresponding to the read-write operation is not matched with the preset file, that is, the file corresponding to the read-write operation is not an important file required by the hard disk, that is, the file corresponding to the read-write operation does not belong to any one of a video file, an image file, an index file, a disk information file, a video query record file and a log file, that is, the operations of reading and writing the file corresponding to the read-write operation do not affect the content of the important file in the hard disk, and the data of the file corresponding to the read-write operation at the moment does not update the data of the first key area. The file corresponding to the read-write operation at the moment can be written into the hard disk, so that the file corresponding to the read-write operation at the moment is updated by updating the data of the second key area, and the data of the first key area is not updated, namely, the data of the second key area is not updated by the file corresponding to the read-write operation at the moment under the control of a system program, and the data of the first key area is not updated, so that even if the hard disk is in fault or the system is suddenly powered off or is damaged artificially, the data of the first key area is not updated due to the fact that the data of the second key area is only updated, namely, the data of the first key area is not updated, the guide file of the first key area is not damaged, and the data loss of the data area corresponding to the first key area is avoided.
In one embodiment, the processor when executing the computer program further performs the steps of: the step of detecting whether the file corresponding to the read-write operation is a preset file comprises the following steps: and detecting whether the file name of the file corresponding to the read-write operation is a preset file name. The file names of the preset files have different formats, and only when the format of the file name of the file corresponding to the read-write operation is the same as that of the file name of the preset file, the system program judges that the file corresponding to the current read-write operation belongs to the preset file, for example, the preset file comprises a video file and an image file, and the corresponding file name belongs to the range between 00000000 and 0 FFFFF; for another example, the preset file includes an index file, and a corresponding file name is RECINDEX; for another example, the preset file includes a disk information file, and the corresponding file name is DISKINFO; for another example, the preset file includes a video query record file, and the corresponding file name is DVRREC01; for another example, the preset file includes a log file, and the corresponding file name is dvr_lobb. In the process of each read-write operation, the file corresponding to the read-write operation generates a corresponding file name through the application FAT32 file system, and the file name of the file corresponding to the read-write operation is converted according to the data contained in the file, for example, if the file corresponding to the read-write operation contains video data, the file name of the file corresponding to the read-write operation is converted into the file name corresponding to the video file through the application FAT32 file system; for another example, if the file corresponding to the read-write operation includes photo data, the file name of the file corresponding to the read-write operation is converted into the file name corresponding to the image file through the application program FAT32 file system; for another example, if the file corresponding to the read-write operation includes index data, the file name of the file corresponding to the read-write operation is converted into the file name corresponding to the index file through the application FAT32 file system; for another example, if the file corresponding to the read-write operation includes disk information data, the file name of the file corresponding to the read-write operation is converted into the file name corresponding to the disk information file through the application program FAT32 file system; for another example, if the file corresponding to the read-write operation includes the record query record data, the file name of the file corresponding to the read-write operation is converted into the file name corresponding to the record query record file through the application program FAT32 file system; for another example, if the file corresponding to the read/write operation includes log data, the file name of the file corresponding to the read/write operation is converted into the file name corresponding to the log file through the application FAT32 file system. According to the comparison result of the file name of the file corresponding to the read-write operation and the file name of the preset file, enabling the system program to execute corresponding steps, for example, when the file name of the file corresponding to the read-write operation is the file name of the preset file, writing the data corresponding to the read-write operation into a data area according to the read-write operation, and not updating the data of a key area; for another example, when the file name of the file corresponding to the read-write operation is not the file name of the preset file, writing the data corresponding to the read-write operation into the data area according to the read-write operation, and updating the data of the key area. Therefore, when the hard disk executes the read-write operation, the comparison of the files can be realized according to the file names, so that the comparison between the files corresponding to the read-write operation and the preset files is more convenient, and the file reading and writing efficiency is improved.
In one embodiment, the processor when executing the computer program further performs the steps of: the step of detecting whether the file corresponding to the read-write operation is a preset file comprises the following steps: and detecting whether the file type of the file corresponding to the read-write operation is a preset file type. The file types of the preset files have different formats, and in this embodiment, the file types are file suffix names. Only when the format of the file type corresponding to the read-write operation is the same as the format of the file type of the preset file, the system program judges that the file corresponding to the current read-write operation belongs to the preset file, for example, the preset file comprises a video file, and the corresponding file type is bsv; for another example, the preset file includes an image file, and the corresponding file type is bsp; for another example, the preset file includes one of an index file, a disk information file, a video query record file and a log file, and the corresponding file type is dat. In the process of each read-write operation, the file corresponding to the read-write operation generates a corresponding file type through the application FAT32 file system, and the file type of the file corresponding to the read-write operation is converted according to the data contained in the file, for example, if the file corresponding to the read-write operation contains video data, the file type of the file corresponding to the read-write operation is converted into the file type corresponding to the video file through the application FAT32 file system; for another example, if the file corresponding to the read-write operation includes photo data, the file type of the file corresponding to the read-write operation is converted into the file type corresponding to the image file through the application program FAT32 file system; for another example, if the file corresponding to the read-write operation includes index data, the file type of the file corresponding to the read-write operation is converted into the file type corresponding to the index file through the application program FAT32 file system; for another example, if the file corresponding to the read-write operation includes disk information data, the file type of the file corresponding to the read-write operation is converted into the file type corresponding to the disk information file through the application program FAT32 file system; for another example, if the file corresponding to the read-write operation includes the video query record data, the file type of the file corresponding to the read-write operation is converted into the file type corresponding to the video query record file through the application program FAT32 file system; for another example, if the file corresponding to the read-write operation includes log data, the file type of the file corresponding to the read-write operation is converted into the file type corresponding to the log file through the application FAT32 file system. According to the comparison result of the file type of the file corresponding to the read-write operation and the file type of the preset file, enabling the system program to execute corresponding steps, for example, when the file type of the file corresponding to the read-write operation is the file type of the preset file, writing the data corresponding to the read-write operation into a data area according to the read-write operation, and not updating the data of a key area; for another example, when the file type of the file corresponding to the read-write operation is not the file type of the preset file, writing the data corresponding to the read-write operation into the data area according to the read-write operation, and updating the data of the key area. Therefore, when the hard disk executes the read-write operation, the comparison of the files can be realized according to the file types, so that the comparison between the files corresponding to the read-write operation and the preset files is more convenient, and the file reading and writing efficiency is improved.
In one embodiment, the processor when executing the computer program further performs the steps of: after the step of detecting whether the file corresponding to the read-write operation is the preset file, the method further comprises the following steps: and when the file corresponding to the read-write operation is a preset file and the read-write operation does not have the data written in the data area, the data of the key area is not updated. In this embodiment, the file corresponding to the read-write operation at this time only includes the data of the critical area, and the file corresponding to the read-write operation at this time is a preset file, so that the data included in the file corresponding to the read-write operation at this time is the data of the first critical area, that is, the file corresponding to the read-write operation at this time is the guide file of the first critical area. In this way, the system program correspondingly executes the data of the first key area, namely the data of the first key area is not updated, namely the guide file of the first key area is not updated, so that the data of the first key area is not destroyed, and the data loss of the data area corresponding to the first key area is avoided.
In one embodiment, a computer readable storage medium is provided having a computer program stored thereon, which when executed by a processor, performs the steps of:
Acquiring read-write operation;
detecting whether the file corresponding to the read-write operation is a preset file or not;
when the file corresponding to the read-write operation is a preset file, writing the data corresponding to the read-write operation into a data area according to the read-write operation, and not updating the data of a key area, wherein the data area is used for storing the data file, and the key area is used for storing the guide file.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in the various embodiments provided herein may include non-volatile and/or volatile memory. The nonvolatile memory can include Read Only Memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double Data Rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous Link DRAM (SLDRAM), memory bus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), among others.
The technical features of the above-described embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above-described embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The above examples illustrate only a few embodiments of the invention, which are described in detail and are not to be construed as limiting the scope of the invention. It should be noted that it will be apparent to those skilled in the art that several variations and modifications can be made without departing from the spirit of the invention, which are all within the scope of the invention. Accordingly, the scope of protection of the present invention is to be determined by the appended claims.
Claims (10)
1. A hard disk file writing method, comprising:
acquiring read-write operation;
detecting whether the file corresponding to the read-write operation is a preset file or not;
when the file corresponding to the read-write operation is a preset file, writing the data corresponding to the read-write operation into a data area according to the read-write operation, and not updating the data of a first key area in a key area and the data of a second key area in the key area; when the file corresponding to the read-write operation is not a preset file, writing the data corresponding to the read-write operation into the data area according to the read-write operation, updating the data of the second key area, and updating the data of the first key area at the same time; the data area and the second key area are used for storing data files, the first key area is used for storing guide files, and the guide files in the first key area are used for guiding the positions of the data areas and specific data contents.
2. The hard disk file writing method according to claim 1, wherein the first key area is used for storing a first file, the second key area is used for storing a second file, the first file is used for guiding a first data file in the data area, and the second file is used for storing a second data file in the data area.
3. The method for writing a hard disk file according to claim 1, wherein after detecting whether the file corresponding to the read-write operation is a preset file, further comprises:
and when the file corresponding to the read-write operation is a preset file and the read-write operation does not have the data written in the data area, the data of the key area is not updated.
4. The method of claim 1, wherein the first critical section comprises first critical data and second critical data, the second critical data being a backup of the first critical data; when the first critical data is damaged, the second critical data replaces the first critical data.
5. The method for writing a hard disk file according to claim 1, wherein the step of detecting whether the file corresponding to the read-write operation is a preset file comprises:
And detecting whether the file name of the file corresponding to the read-write operation is a preset file name.
6. The method for writing a hard disk file according to claim 1, wherein the step of detecting whether the file corresponding to the read-write operation is a preset file comprises:
and detecting whether the file type of the file corresponding to the read-write operation is a preset file type.
7. The method for writing a hard disk file according to claim 1, wherein after the step of detecting whether the file corresponding to the read-write operation is a preset file, the method further comprises:
and when the file corresponding to the read-write operation is a preset file and the read-write operation does not have the data written in the data area, the data of the key area is not updated.
8. A hard disk file writing apparatus, comprising:
the acquisition module is used for acquiring read-write operation;
the detection module is used for detecting whether the file corresponding to the read-write operation is a preset file or not;
the analysis processing module is used for writing the data corresponding to the read-write operation into the data area according to the read-write operation when the file corresponding to the read-write operation is a preset file, and not updating the data of the first key area in the key area and the data of the second key area in the key area; when the file corresponding to the read-write operation is not a preset file, writing the data corresponding to the read-write operation into the data area according to the read-write operation, updating the data of the second key area, and updating the data of the first key area at the same time; the data area and the second key area are used for storing data files, the first key area is used for storing guide files, and the guide files in the first key area are used for guiding the positions of the data areas and specific data contents.
9. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the steps of the hard disk file writing method as claimed in any one of claims 1 to 7 when the computer program is executed by the processor.
10. A computer readable storage medium having stored thereon a computer program, characterized in that the computer program when executed by a processor realizes the steps of the hard disk file writing method as claimed in any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910698552.7A CN110471623B (en) | 2019-07-31 | 2019-07-31 | Hard disk file writing method, device, computer equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910698552.7A CN110471623B (en) | 2019-07-31 | 2019-07-31 | Hard disk file writing method, device, computer equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110471623A CN110471623A (en) | 2019-11-19 |
CN110471623B true CN110471623B (en) | 2023-12-29 |
Family
ID=68509991
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910698552.7A Active CN110471623B (en) | 2019-07-31 | 2019-07-31 | Hard disk file writing method, device, computer equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110471623B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111444152A (en) * | 2020-03-30 | 2020-07-24 | 北京小米移动软件有限公司 | File system, file system access method, electronic device, and storage medium |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1822174A (en) * | 2005-12-08 | 2006-08-23 | 杭州海康威视数字技术有限公司 | Method for protecting hardware key information area in embedded device |
CN101373446A (en) * | 2007-08-24 | 2009-02-25 | 英业达股份有限公司 | Method for testing pressure of file system |
CN102063270A (en) * | 2010-12-28 | 2011-05-18 | 成都市华为赛门铁克科技有限公司 | Write operation method and device |
CN103474087A (en) * | 2013-09-06 | 2013-12-25 | 南京南自信息技术有限公司 | Video recording file management method and device for easily preventing disk fragments from being generated |
CN107450853A (en) * | 2017-08-01 | 2017-12-08 | 郑州云海信息技术有限公司 | A kind of data file read method and device |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP3026546A4 (en) * | 2013-08-09 | 2016-08-17 | Huawei Tech Co Ltd | File processing method, apparatus and storage device |
-
2019
- 2019-07-31 CN CN201910698552.7A patent/CN110471623B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1822174A (en) * | 2005-12-08 | 2006-08-23 | 杭州海康威视数字技术有限公司 | Method for protecting hardware key information area in embedded device |
CN101373446A (en) * | 2007-08-24 | 2009-02-25 | 英业达股份有限公司 | Method for testing pressure of file system |
CN102063270A (en) * | 2010-12-28 | 2011-05-18 | 成都市华为赛门铁克科技有限公司 | Write operation method and device |
CN103474087A (en) * | 2013-09-06 | 2013-12-25 | 南京南自信息技术有限公司 | Video recording file management method and device for easily preventing disk fragments from being generated |
CN107450853A (en) * | 2017-08-01 | 2017-12-08 | 郑州云海信息技术有限公司 | A kind of data file read method and device |
Also Published As
Publication number | Publication date |
---|---|
CN110471623A (en) | 2019-11-19 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110531940B (en) | Video file processing method and device | |
JP4363676B2 (en) | Computer system | |
US9286165B2 (en) | Apparatus and method for recovering partition using backup boot record information | |
US7681001B2 (en) | Storage system | |
US11455276B2 (en) | Method for processing snapshots and distributed block storage system | |
US8818950B2 (en) | Method and apparatus for localized protected imaging of a file system | |
US8655847B2 (en) | Mirroring data changes in a database system | |
US7469261B2 (en) | Apparatus and method for protecting system data on computer hard-disk | |
US20230132278A1 (en) | File data access method, apparatus, and computer-readable storage medium | |
CN107315661B (en) | Deleted file recovery method and device for cluster file system | |
WO2017087015A1 (en) | Count of metadata operations | |
CN110471623B (en) | Hard disk file writing method, device, computer equipment and storage medium | |
CA2825891A1 (en) | Storage system for storing data in a plurality of storage devices | |
CN111966531B (en) | Data snapshot method and device, computer equipment and storage medium | |
US20050262033A1 (en) | Data recording apparatus, data recording method, program for implementing the method, and program recording medium | |
CN106909514B (en) | Method and device for positioning snapshot disk address | |
US9009430B2 (en) | Restoration of data from a backup storage volume | |
CN113312309B (en) | Snapshot chain management method, device and storage medium | |
CN109241011B (en) | Virtual machine file processing method and device | |
CN110362424B (en) | Rapid recovery method and system based on continuous data protection | |
CN110874182B (en) | Processing method, device and equipment for strip index | |
CN105573862A (en) | Method and equipment for recovering file systems | |
CN113342751B (en) | Metadata processing method, device, equipment and readable storage medium | |
US8010506B2 (en) | Information processing system and network logging information processing method | |
CN114880277B (en) | Block device snapshot method, system and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
CB02 | Change of applicant information | ||
CB02 | Change of applicant information |
Address after: 518100 2701, 2702 and 2703, building 1, Huide building, Beizhan community, Minzhi street, Longhua District, Shenzhen, Guangdong Applicant after: Shenzhen BoShiJie Technology Co.,Ltd. Address before: 518100 room 507-508, building 7, Guorun Electric Appliance Factory, Xinniu community, Minzhi street, Longhua District, Shenzhen, Guangdong Province Applicant before: SHENZHEN BOSHIJIE TECHNOLOGY Co.,Ltd. |
|
GR01 | Patent grant | ||
GR01 | Patent grant |