CN109496292B - Disk management method, disk management device and electronic equipment - Google Patents

Disk management method, disk management device and electronic equipment Download PDF

Info

Publication number
CN109496292B
CN109496292B CN201880001664.6A CN201880001664A CN109496292B CN 109496292 B CN109496292 B CN 109496292B CN 201880001664 A CN201880001664 A CN 201880001664A CN 109496292 B CN109496292 B CN 109496292B
Authority
CN
China
Prior art keywords
data block
disk
video file
reading
data
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
CN201880001664.6A
Other languages
Chinese (zh)
Other versions
CN109496292A (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.)
Streamax Technology Co Ltd
Original Assignee
Streamax 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 Streamax Technology Co Ltd filed Critical Streamax Technology Co Ltd
Publication of CN109496292A publication Critical patent/CN109496292A/en
Application granted granted Critical
Publication of CN109496292B publication Critical patent/CN109496292B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input 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/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0614Improving the reliability of storage systems
    • G06F3/0619Improving the reliability of storage systems in relation to data integrity, e.g. data losses, bit errors
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1446Point-in-time backing up or restoration of persistent data
    • G06F11/1448Management of the data involved in backup or backup restore
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1446Point-in-time backing up or restoration of persistent data
    • G06F11/1458Management of the backup or restore process
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input 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/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/0644Management of space entities, e.g. partitions, extents, pools

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Quality & Reliability (AREA)
  • Computer Security & Cryptography (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Signal Processing For Digital Recording And Reproducing (AREA)

Abstract

The application discloses a disk management method, a disk management device, an electronic device and a computer readable storage medium, wherein the disk management method comprises the following steps: equally dividing a disk into more than one data block, wherein the capacity of the data block is calculated by a preset formula; scanning the use information of each data block of the disk; storing the use information of each data block obtained by scanning in a preset first data block; and when the disk system is started, reading the disk through the first data block. By the scheme, the read-write performance of the disk can be improved to a certain extent.

Description

Disk management method, disk management device and electronic equipment
Technical Field
The present application belongs to the technical field of vehicle-mounted devices, and in particular, relates to a disk management method, a disk management apparatus, an electronic device, and a computer-readable storage medium.
Background
Vehicle-mounted equipment usually operates under the severe conditions of unstable voltage, abnormal power failure, high temperature, vibration and the like, and partial data damage often occurs to the conventional magnetic disk under the severe conditions. A standard storage management system used in a common disk, such as FAT32, NTFS, EXT2, etc., usually sets a minimum storage unit to be relatively small, and a large amount of disk fragments appear after data are repeatedly deleted and written, thereby reducing the read-write performance of the disk.
Disclosure of Invention
In view of this, the present application provides a disk management method, a disk management apparatus, an electronic device, and a computer-readable storage medium, which can improve the read-write performance of a disk to a certain extent.
A first aspect of the present application provides a disk management method, including:
equally dividing a disk into more than one data block, wherein the capacity of the data blocks is calculated by a preset formula;
scanning the use information of each data block of the magnetic disk;
storing the use information of each data block obtained by scanning in a preset first data block;
and when the disk system is started, reading the disk through the first data block.
A second aspect of the present application provides a disk management apparatus, including:
the dividing unit is used for equally dividing the disk into more than one data block, wherein the capacity of the data block is calculated by a preset formula;
a scanning unit for scanning the use information of each data block of the disk;
the storage unit is used for storing the use information of each data block obtained by scanning into a preset first data block;
and the reading unit is used for reading the magnetic disk through the first data block when the magnetic disk system is started.
A third aspect of the present application provides an electronic device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, the processor implementing the steps of the method according to the first aspect when executing the computer program.
A fourth aspect of the present application provides a computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of the method of the first aspect as described above.
A fifth aspect of the application provides a computer program product comprising a computer program which, when executed by one or more processors, performs the steps of the method as described in the first aspect above.
As can be seen from the above, according to the scheme of the present application, a disk is equally divided into more than one data block, wherein the capacity of the data block is calculated by a preset formula, then the usage information of each data block of the disk is scanned, the usage information of each data block obtained by scanning is stored in a preset first data block, and when a disk system is started, the disk is read by the first data block. In the scheme of the application, the use information of each data block in the disk is stored in a specific data block, so that when the disk needs to be read and written, the specific data block can be used for realizing quick positioning, and the read-write performance of the disk is improved to a certain extent.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the embodiments or the prior art descriptions will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without inventive exercise.
Fig. 1 is a flowchart of an implementation of a disk management method according to an embodiment of the present application;
FIG. 2 is a flowchart of another implementation of a disk management method according to an embodiment of the present application;
fig. 3 is a block diagram of a disk management apparatus according to an embodiment of the present application;
fig. 4 is a block diagram of an electronic device according to an embodiment of the present disclosure.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular system structures, techniques, etc. in order to provide a thorough understanding of the embodiments of the present application. It will be apparent, however, to one skilled in the art that the present application may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.
In order to explain the technical solution of the present application, the following description will be given by way of specific examples.
Example one
Referring to fig. 1, a disk management method provided in an embodiment of the present application is described below, where the disk management method in the embodiment of the present application includes:
in step 101, equally dividing a disk into more than one data block;
in the embodiment of the application, the capacity of the data block cannot be too small, if the capacity of the data block is too small, the data block is distributed more frequently when video recording is caused, and meanwhile, the discreteness of data is large, so that the read-write efficiency of a disk is influenced; the capacity of the data block cannot be too large, and since the minimum allocation unit is the size of the data block, space waste is easily caused if the capacity of the data block is too large; meanwhile, in order to prevent the usage information of the disk from being recorded in a plurality of data blocks in a scattered manner and avoid increasing the complexity of program logic, the total number of data blocks of the disk cannot exceed the size of one data block capable of being recorded. Based on this, the size of the data block is set to be not less than 4 megabytes, and the size of the data block is increased by 4 megabytes, that is, the size of the data block is an integral multiple of 4 megabytes. Specifically, the capacity of the data block is calculated by a preset formula, where it is set that 32 bytes are required to be occupied for recording the usage information of one data block, and the preset formula is:
(4b×1024×1024)÷32×(4b×1024×1024)≥(a×1024×1024)
the total capacity of the disk is a million, the capacity of the data block is b times of 4 million, namely the capacity of the data block is 4b million, and according to the preset formula, the minimum b value meeting the formula is obtained, so that the specific value of the capacity of the data block, namely 4b million, can be obtained. Note that b is a positive integer.
In step 102, scanning the use information of each data block of the disk;
in the embodiment of the present application, the usage information includes, but is not limited to: the method comprises the following steps of data block attribution stamp, data block position, starting time of a video file in a data block, ending time of the video file in the data block, data block type and data block check bit, wherein the data block attribution stamp indicates a complete video file to which the data block belongs. For example, the video time span of a certain video File1 is 18:00-18:05, and the video File1 needs to be stored by two data blocks, namely, data block 1 and data block 2 because of too large data, so that the data block attribution stamps of the data block 1 and the data block 2 indicate that the two data blocks belong to the video File 1; if the data block 1 stores video contents with a time span of 18:00-18:03 in the video File1, and the data block 2 stores video contents with a time span of 18:03-18:05 in the video File1, the start time of the video File in the data block is 18:00 and the end time of the video File in the data block is 18:03 for the data block 1; for the data block 2, the start time of the video file in the data block is 18:03, and the end time of the video file in the data block is 18: 05; the video block type indicates the state of the data block, including a free data block, a recording (backup) data block, and a video data block; the data block position is specifically expressed by an internal number of a video file, that is, the data block position of the video file can be determined by the internal number of the video file; the data block check bit is used for judging whether the data stored in the data block is legal or not according to the value. The usage information constitutes a usage information structure of one data block, and occupies 32 bytes, and for the idle data block and the video data block, the first 32 bytes of the data block store the usage information of the data block.
In step 103, storing the usage information of each scanned data block in a preset first data block;
in this embodiment of the present application, in this embodiment, a data block in a specific location of a disk is used as the first data block, and the first data block is dedicated to store use information of each data block, that is, a data block type of the first data block is a recording data block, where the specified location may be the first data block in the disk or another location specified by a user, and the specific location is not limited herein. After the disk is scanned in a full disk manner, the use information of each data block obtained by scanning is stored in the first data block.
In step 104, when the disk system is started, the disk is read through the first data block.
In the embodiment of the application, under a normal condition, when a disk system is in use, the disk is globally scanned to obtain the use condition of the disk, and a foundation is laid for subsequent read-write operation; however, since re-scanning is required at each start-up, a certain time is wasted; in order to realize the fast start of the disk and know the use condition of the disk in time, the use information of each data block of the disk is already stored in the first data block in step 103, so that when the disk is read, the use condition of the disk can be fast known only by reading the first data block.
Specifically, the usage information of each data block recorded in the first data block and the address of the data block are in one-to-one correspondence, for example, the usage information of a first data block in the first data block corresponds to the usage information of a first data block in a disk, and the usage information of a second data block in the first data block corresponds to the usage information of a second data block in the disk, so that the usage information of each data block stored in the first data block can be mapped to an actual storage unit (i.e., data block) without additionally establishing an index relationship.
Therefore, in the embodiment of the application, the use information of each data block in the disk is stored in one specific data block, so that when the disk needs to be read and written, the specific data block can be used for realizing quick positioning, and the read-write performance of the disk is improved to a certain extent.
It should be understood that, the sequence numbers of the steps in the foregoing embodiments do not imply an execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments of the present application.
Example two
On the basis of the first embodiment, the second embodiment of the present application provides another disk management method. Referring to fig. 2, another disk management method provided in the second embodiment of the present application is described below, where the disk management method in the second embodiment of the present application includes:
in step 201, equally dividing a disk into more than one data block;
in step 202, scanning the usage information of each data block of the disk;
in step 203, storing the usage information of each scanned data block in a preset first data block;
in this embodiment, the steps 201, 202, and 203 are respectively the same as or similar to the steps 101, 102, and 103, and reference may be made to the related description of the steps 101, 102, and 103, which is not repeated herein.
In step 204, backing up the first data block to a preset second data block, so that the first data block and the second data block are backed up with each other;
in the embodiment of the application, because the vehicle-mounted environment is severe, a sudden power failure or a shock often occurs to cause data writing abnormality of the magnetic head, so that a corresponding position of the magnetic disk fails, and even an adjacent position may be affected. The second data block is at least separated from the first data block by a preset distance, so that the first data block and the second data block are prevented from being damaged simultaneously. In order to simply and quickly find the first data block and the second data block, so as to quickly obtain the usage status of the entire disk, the first data block and the second data block may be allocated to fixed positions of the disk, for example, the 1 st data block of the disk is set as the first data block, the 401 th data block of the disk is set as the second data block, the first data block and the second data block are separated by 400 data blocks, the distance is an empirical value, and is physically separated by several tracks, which can effectively avoid that the first data block and the second data block are damaged at the same time, of course, data blocks at other positions specified by a user may also be set as the first data block and the second data block, which is not limited herein; it should be noted that, in a disk, only one first data block and one second data block need to be set. Specifically, the data block type of the second data block is a backup data block.
In step 205, when the disk system is started, detecting whether the first data block is damaged, if so, executing step 207, and if not, executing step 106;
in step 206, reading the disk via the first data block;
in step 207, the disk is read via the second data block.
In the embodiment of the present application, since the first data block and the second data block both record the use information of the data block of the entire disk, when the disk is started, as long as the two data blocks are not damaged, the use status of the disk can be accurately obtained no matter which data block is read.
Optionally, in the first and second embodiments, the disk management method further includes:
when a retrieval instruction is received, a video file list is obtained based on the first data block mapping;
acquiring a data block corresponding to each complete video file in the video file list;
determining the starting time and the ending time of each complete video file based on the starting time of the video file in the data block of each data block and the ending time of the video file in the data block;
and taking the complete video file meeting the time condition as a retrieval result.
When retrieval is needed, a retrieval instruction is input, wherein the retrieval instruction comprises a time condition, namely the start time and the end time of a video file which needs to be retrieved. Since the first data block stores the usage information of each data block, and the usage information may indicate the complete video File to which each data block belongs, according to the data block attribution stamp of each data block, a list of video files stored in a disk may be obtained by mapping, and at the same time, a data block corresponding to each complete video File is obtained, for example, the video File1 corresponds to data block 1 and data block 2; then, according to the start time of the video file in the data block of each data block and the end time of the video file in the data block, determining the start time and the end time of each complete video file, for example, the start time of the video file in the data block of the data block 1 is 18:00, and the end time of the video file in the data block is 18: 03; the start time of the video File in the data block of the data block 2 is 18:03, the end time of the video File in the data block is 18:05, and the data block 1 and the data block 2 form a complete video File, so that after the data block 1 and the data block 2 are spliced, the start time and the end time of the complete video File1 are respectively 18:00 and 18: 05. After splicing all the complete video files, taking the complete video files meeting the time condition as a retrieval result, and outputting the retrieval result to a screen; if a plurality of retrieval results exist, sequencing the retrieval results in time sequence and the like, displaying the sequencing results in a list, and playing the video file selected by the selection instruction for the user to view after the user inputs the selection instruction. Through the retrieval process, for the currently and mainly used 1T to 4T disks, the capacity of a data block can be calculated to be 8 Mm according to the formula in the first embodiment, and the current disk sequential reading speed is generally over 120MB/s, that is, the data of 8 Mm can be read in less than 0.067 seconds; that is, the first data block can be read in 0.067 seconds, the use status of the entire disk can be acquired, and the video file can be retrieved. It should be noted that, if the first data block is damaged, the above-mentioned search process may be applied to a second data block, and the search is performed through the second data block.
Optionally, in the first and second embodiments, the disk management method further includes:
when receiving data to be written, reading the first data block;
determining a free data block in the disk as a data block to be written in based on the first data block;
writing the data to be written into the data block to be written;
and updating the first data block after the data to be written is written into the data block to be written.
The free data blocks in the disk can be searched for by the data block types in the use information of each data block recorded by the first data block, and if more than two free data blocks exist in the disk, the free data block with the forefront position in the more than two free data blocks can be used as the data block to be written in; alternatively, any data block may be randomly designated as the data block to be written, and the determination method of the data block to be written is not limited herein. After the data to be written is written into the data block to be written, the data block to be written is already written with data, that is, the use information of the data block is changed, at this time, the first data block needs to be updated, and at the same time, after the first data block is updated, the updated data is backed up to the second data block, that is, the first data block and the second data block are kept as backup of each other at any time. It should be noted that, if the first data block is damaged, the writing process may be applied to the second data block, and writing is performed through the second data block.
Optionally, in the first and second embodiments, the disk management method further includes:
reading the first data block, and judging whether the corresponding use information is damaged or not through the check bit of the data block;
and if the damaged use information exists, recovering the use information through the second data block.
The first data block and the second data block are backup each other, and are far away from each other, so that the first data block and the second data block are generally not damaged at the same time. Optionally, even if the usage information of the same data block stored in the first data block and the second data block is damaged, the usage information of the data block is obtained again only by reading the first 32 bytes of the corresponding data block, and the re-read usage information is restored to the corresponding positions of the first data block and the second data block. Through the recovery flow, even if the entire first data block and the entire second data block are damaged, only the first 32 bytes of each data block need to be read, for example, for a 4T-byte disk, each data block is 8 megabytes, so that there are 524288 data blocks in total, and only the first 32 bytes of the 524288 data blocks need to be read, that is, only the 524288 × 32 bytes — 16 megabytes of data need to be read, so that the data of the entire 4T disk can be recovered. Of course, when the second data block needs data recovery, the recovery flow may be referred to recover the damaged usage information from the first data block, and this is not limited here.
Optionally, in the first and second embodiments, the disk management method further includes:
reading the first data block;
determining the earliest data block of a stored video file in the disk as a data block to be covered based on the first data block;
and clearing the data stored in the data block to be covered into a blank data block.
For a video file used for monitoring, in order to ensure continuous video recording in a limited disk space, a mode of covering a data block with an earlier time is required to ensure timeliness and fluency of the video file. It should be noted that, if the first data block is damaged, the overwriting procedure may be applied to the second data block, and overwriting is performed through the second data block.
Therefore, in the embodiment of the application, the use information of each data block in the disk is stored in one specific data block, so that when the disk needs to be read and written, the specific data block can be used for realizing quick positioning, and the read-write performance of the disk is improved to a certain extent. When the disk is required to be used, the data can be quickly retrieved, written, restored or overwritten.
It should be understood that, the sequence numbers of the steps in the foregoing embodiments do not imply an execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments of the present application.
EXAMPLE III
A third embodiment of the present application provides a disk management apparatus, where the disk management apparatus may be integrated in an electronic device, as shown in fig. 3, a disk management apparatus 300 in the third embodiment of the present application includes:
a dividing unit 301, configured to equally divide a disk into more than one data block, where the capacity of the data block is calculated by a preset formula;
a scanning unit 302, configured to scan usage information of each data block of the disk;
a storage unit 303, configured to store usage information of each scanned data block in a preset first data block;
a reading unit 304, configured to read the disk through the first data block when the disk system is started.
Optionally, the disk management apparatus 300 further includes:
a backup unit, configured to backup the first data block into a preset second data block, so that the first data block and the second data block are backed up with each other, where the positions of the second data block and the first data block are at least separated by a preset distance;
the reading unit 304 includes:
a first data block detection subunit, configured to detect whether the first data block is damaged;
a first data block reading subunit, configured to read the disk through the first data block if the first data block is not damaged;
and a second data block reading subunit, configured to read the disk through the second data block if the first data block is damaged.
Optionally, the usage information includes: the method comprises the following steps of data block attribution stamp, data block position, starting time of a video file in a data block, ending time of the video file in the data block, data block type and data block check bit, wherein the data block attribution stamp indicates a complete video file to which the data block belongs.
Optionally, the disk management apparatus 300 further includes:
a file list obtaining unit, configured to, when a retrieval instruction is received, obtain a video file list based on the first data block mapping, where the retrieval instruction includes a time condition;
a data block acquiring unit, configured to acquire a data block corresponding to each complete video file in the video file list;
the time determining unit is used for determining the starting time and the ending time of each complete video file based on the starting time of the video file in the data block of each data block and the ending time of the video file in the data block;
and the retrieval result determining unit is used for taking the complete video file meeting the time condition as a retrieval result.
Optionally, the reading unit 304 is further configured to read the first data block when receiving data to be written;
the disk management apparatus 300 further includes:
a to-be-written data block determination unit, configured to determine, based on the first data block, a free data block in the disk as a to-be-written data block;
a writing unit, configured to write the data to be written into the data block to be written;
and the updating unit is used for updating the first data block after the data to be written is written into the data block to be written.
Optionally, the reading unit 304 is further configured to read the first data block, and determine whether the corresponding usage information is damaged according to the check bits of the data block;
the disk management apparatus 300 further includes:
and a recovery unit, configured to recover the usage information via the second data block if there is damaged usage information.
Therefore, in the embodiment of the application, the disk management device stores the use information of each data block in the disk in a specific data block, so that when the disk needs to be read and written, the specific data block can be used for realizing quick positioning, and the read-write performance of the disk is improved to a certain extent. When the disk is required to be used, the data can be quickly retrieved, written, restored or overwritten.
Example four
An electronic device is provided in the fourth embodiment of the present application, please refer to fig. 4, where the electronic device in the fourth embodiment of the present application includes: a memory 401, one or more processors 402 (only one shown in fig. 4), and computer programs stored on the memory 401 and executable on the processors. Wherein: the memory 401 is used for storing software programs and modules, and the processor 402 executes various functional applications and data processing by operating the software programs and units stored in the memory 401, so as to acquire resources corresponding to the preset events. Specifically, the processor 402, by running the above-mentioned computer program stored in the memory 401, implements the steps of:
equally dividing a disk into more than one data block, wherein the capacity of the data blocks is calculated by a preset formula;
scanning the use information of each data block of the magnetic disk;
storing the use information of each data block obtained by scanning in a preset first data block;
and when the disk system is started, reading the disk through the first data block.
Assuming that the above is the first possible implementation manner, in a second possible implementation manner provided as a basis for the first possible implementation manner, after the usage information of each scanned data block is stored in a preset first data block, the processor 402 further implements the following steps when running the computer program stored in the memory 401:
backing up the first data block into a preset second data block so that the first data block and the second data block are backed up with each other, wherein the positions of the second data block and the first data block are at least separated by a preset distance;
the reading the disk through the first data block when the disk system is started includes:
detecting whether the first data block is damaged;
if the first data block is not damaged, reading the disk through the first data block;
and if the first data block is damaged, reading the disk through the second data block.
In a third possible embodiment provided on the basis of the second possible embodiment, the usage information includes: the method comprises the following steps of data block attribution stamp, data block position, starting time of a video file in a data block, ending time of the video file in the data block, data block type and data block check bit, wherein the data block attribution stamp indicates a complete video file to which the data block belongs.
In a fourth possible implementation provided on the basis of the third possible implementation, the processor 402 further implements the following steps when executing the computer program stored in the memory 401:
when a retrieval instruction is received, a video file list is obtained based on the mapping of the first data block, wherein the retrieval instruction comprises a time condition;
acquiring a data block corresponding to each complete video file in the video file list;
determining the starting time and the ending time of each complete video file based on the starting time of the video file in the data block of each data block and the ending time of the video file in the data block;
and taking the complete video file meeting the time condition as a retrieval result.
In a fifth possible implementation manner provided as a basis for the third possible implementation manner, the processor 402 further implements the following steps when executing the above computer program stored in the memory 401:
when receiving data to be written, reading the first data block;
determining a free data block in the disk as a data block to be written based on the first data block;
writing the data to be written into the data block to be written;
and updating the first data block after the data to be written is written into the data block to be written.
In a sixth possible implementation provided on the basis of the third possible implementation, the processor 402 further implements the following steps when executing the computer program stored in the memory 401:
reading the first data block, and judging whether the corresponding use information is damaged or not through the check bit of the data block;
and if the damaged use information exists, recovering the use information through the second data block.
Further, as shown in fig. 4, the electronic device may further include: one or more input devices 403 (only one shown in fig. 4) and one or more output devices 404 (only one shown in fig. 4). The memory 401, processor 402, input device 403, and output device 404 are connected by a bus 405.
It should be understood that in the embodiments of the present Application, the Processor 402 may be a Central Processing Unit (CPU), and the Processor may be other general-purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The input device 403 may include a keyboard, a touch pad, a fingerprint sensor (for collecting fingerprint information of a user and direction information of the fingerprint), a microphone, etc., and the output device 404 may include a display, a speaker, etc.
Memory 401 may include both read-only memory and random-access memory, and provides instructions and data to processor 402. Some or all of memory 401 may also include non-volatile random access memory. For example, the memory 401 may also store device type information.
Therefore, in the embodiment of the application, the electronic device stores the use information of each data block in the disk in a specific data block, so that when the disk needs to be read and written, the specific data block can be used for realizing quick positioning, and the read-write performance of the disk is improved to a certain extent. When the disk is required to be used, the data can be quickly retrieved, written, restored or overwritten.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-mentioned division of the functional units and modules is illustrated, and in practical applications, the above-mentioned functions may be distributed as different functional units and modules according to needs, that is, the internal structure of the apparatus may be divided into different functional units or modules to implement all or part of the above-mentioned functions. Each functional unit and module in the embodiments may be integrated in one processing unit, or each unit may exist alone physically, or two or more units are integrated in one unit, and the integrated unit may be implemented in a form of hardware, or in a form of software functional unit. In addition, specific names of the functional units and modules are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working processes of the units and modules in the system may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to the related descriptions of other embodiments for parts that are not described or illustrated in a certain embodiment.
Those of ordinary skill in the art would appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of external device software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described system embodiments are merely illustrative, and for example, the division of the above-described modules or units is only one logical functional division, and in actual implementation, there may be another division, for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
The integrated unit may be stored in a computer-readable storage medium if it is implemented in the form of a software functional unit and sold or used as a separate product. Based on such understanding, all or part of the flow in the method of the embodiments described above may be implemented by a computer program, which may be stored in a computer readable storage medium and used by a processor to implement the steps of the embodiments of the methods described above. The computer program includes computer program code, and the computer program code may be in a source code form, an object code form, an executable file or some intermediate form. The computer-readable storage medium may include: any entity or device capable of carrying the above-described computer program code, recording medium, usb disk, removable magnetic disk, optical disk, computer readable Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signal, telecommunications signal, software distribution medium, and the like. It should be noted that the computer readable storage medium may contain other contents which can be appropriately increased or decreased according to the requirements of the legislation and the patent practice in the jurisdiction, for example, in some jurisdictions, the computer readable storage medium does not include an electrical carrier signal and a telecommunication signal according to the legislation and the patent practice.
The above embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present application and are intended to be included within the scope of the present application.

Claims (8)

1. A disk management method, comprising:
equally dividing a disk into more than one data block, wherein the capacity of the data block is calculated by a preset formula;
scanning the use information of each data block of the disk;
storing the use information of each data block obtained by scanning in a preset first data block;
when a disk system is started, reading the disk through the first data block;
after storing the usage information of each scanned data block in a preset first data block, the disk management method further includes:
backing up the first data block into a preset second data block so that the first data block and the second data block are backed up with each other, wherein the positions of the second data block and the first data block are at least separated by a preset distance;
when the disk system is started, reading the disk through the first data block, including:
detecting whether the first data block is damaged;
if the first data block is not damaged, reading the disk through the first data block;
and if the first data block is damaged, reading the disk through the second data block.
2. The disk management method according to claim 1, wherein the use information includes: the method comprises the following steps of data block attribution stamp, data block position, starting time of a video file in a data block, ending time of the video file in the data block, data block type and data block check bit, wherein the data block attribution stamp indicates a complete video file to which the data block belongs.
3. The disk management method according to claim 2, wherein the disk management method further comprises:
when a retrieval instruction is received, obtaining a video file list based on the first data block mapping, wherein the retrieval instruction comprises a time condition;
acquiring a data block corresponding to each complete video file in the video file list;
determining the starting time and the ending time of each complete video file based on the starting time of the video file in the data block of each data block and the ending time of the video file in the data block;
and taking the complete video file meeting the time condition as a retrieval result.
4. The disk management method according to claim 2, wherein the disk management method further comprises:
when receiving data to be written, reading the first data block;
determining a free data block in the disk as a data block to be written in based on the first data block;
writing the data to be written into the data block to be written;
and updating the first data block after the data to be written is written into the data block to be written.
5. The disk management method according to claim 2, wherein the disk management method further comprises:
reading the first data block, and judging whether the corresponding use information is damaged or not through the check bit of the data block;
and if the damaged use information exists, recovering the use information through the second data block.
6. A disk management apparatus, comprising:
the device comprises a dividing unit, a storage unit and a processing unit, wherein the dividing unit is used for equally dividing a disk into more than one data block, and the capacity of the data block is calculated by a preset formula;
a scanning unit, configured to scan usage information of each data block of the disk;
the storage unit is used for storing the use information of each data block obtained by scanning into a preset first data block;
the reading unit is used for reading the disk through the first data block when the disk system is started;
the disk management apparatus further includes:
the backup unit is used for backing up the first data block into a preset second data block so that the first data block and the second data block are backed up with each other, wherein the positions of the second data block and the first data block are at least separated by a preset distance;
the reading unit includes:
a first data block detection subunit, configured to detect whether the first data block is damaged;
a first data block reading subunit, configured to read the disk through the first data block if the first data block is not damaged;
and the second data block reading subunit is used for reading the disk through the second data block if the first data block is damaged.
7. An electronic device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the steps of the method according to any of claims 1 to 5 are implemented when the computer program is executed by the processor.
8. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 5.
CN201880001664.6A 2018-10-16 2018-10-16 Disk management method, disk management device and electronic equipment Active CN109496292B (en)

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2018/110489 WO2020077534A1 (en) 2018-10-16 2018-10-16 Disk management method, disk management apparatus, and electronic device

Publications (2)

Publication Number Publication Date
CN109496292A CN109496292A (en) 2019-03-19
CN109496292B true CN109496292B (en) 2022-02-22

Family

ID=65713834

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201880001664.6A Active CN109496292B (en) 2018-10-16 2018-10-16 Disk management method, disk management device and electronic equipment

Country Status (2)

Country Link
CN (1) CN109496292B (en)
WO (1) WO2020077534A1 (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112416454A (en) * 2020-11-17 2021-02-26 浙江大华技术股份有限公司 Method and device for controlling starting of disk
CN112732494B (en) * 2020-12-29 2024-02-13 北京浪潮数据技术有限公司 Bad disk replacement method, device, equipment and medium of storage system
CN113608683B (en) * 2021-06-30 2024-05-07 山东海量信息技术研究院 Dual-live-disk cleaning method, system and related device
CN113687777B (en) * 2021-07-23 2023-08-08 苏州浪潮智能科技有限公司 Method, device, equipment and medium for predicting usable time length of magnetic disk
CN113741807B (en) * 2021-07-29 2023-08-11 苏州浪潮智能科技有限公司 Method, system, equipment and storage medium for improving system storage performance
CN114489479B (en) * 2021-12-23 2023-06-09 北京云宽志业网络技术有限公司 Method and device for powering up and powering down data storage disk

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6189118B1 (en) * 1998-10-22 2001-02-13 Matsushita Electric Industrial Co., Ltd. Information recording medium, and method and apparatus for managing defect thereof
CN101446976A (en) * 2008-12-26 2009-06-03 中兴通讯股份有限公司 File storage method in distributed file system
CN103049400A (en) * 2012-12-27 2013-04-17 华为技术有限公司 Disk reconfiguration method and disk reconfiguration device
CN104268040A (en) * 2014-09-16 2015-01-07 深圳市腾讯计算机***有限公司 Method and device for detecting disk performance
CN105893188A (en) * 2014-09-30 2016-08-24 伊姆西公司 Method and device for speeding up data reconstruction of disk array

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7263629B2 (en) * 2003-11-24 2007-08-28 Network Appliance, Inc. Uniform and symmetric double failure correcting technique for protecting against two disk failures in a disk array
CN100578470C (en) * 2007-01-31 2010-01-06 浙江大学 Audio/video data access method and device based on raw device
CN104065906B (en) * 2014-07-09 2017-02-15 珠海全志科技股份有限公司 Video recording method and device of digital video recording equipment

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6189118B1 (en) * 1998-10-22 2001-02-13 Matsushita Electric Industrial Co., Ltd. Information recording medium, and method and apparatus for managing defect thereof
CN101446976A (en) * 2008-12-26 2009-06-03 中兴通讯股份有限公司 File storage method in distributed file system
CN103049400A (en) * 2012-12-27 2013-04-17 华为技术有限公司 Disk reconfiguration method and disk reconfiguration device
CN104268040A (en) * 2014-09-16 2015-01-07 深圳市腾讯计算机***有限公司 Method and device for detecting disk performance
CN105893188A (en) * 2014-09-30 2016-08-24 伊姆西公司 Method and device for speeding up data reconstruction of disk array

Also Published As

Publication number Publication date
CN109496292A (en) 2019-03-19
WO2020077534A1 (en) 2020-04-23

Similar Documents

Publication Publication Date Title
CN109496292B (en) Disk management method, disk management device and electronic equipment
US7444460B2 (en) Data storage device, method for updating management information in data storage device, and computer program
CN111399762B (en) Data storage method, device and storage system
US8838875B2 (en) Systems, methods and computer program products for operating a data processing system in which a file delete command is sent to an external storage device for invalidating data thereon
US9336095B2 (en) Computing system and related data management method thereof
WO2014139184A1 (en) Data erasing method and device for flash memory
JP2017079053A (en) Methods and systems for improving storage journaling
CN101706822B (en) Method and device for improving speed of mounting journal file system
KR20090026296A (en) Predictive data-loader
CN108628542B (en) File merging method and controller
CN106201774B (en) NAND FLASH storage chip data storage structure analysis method
WO2016101145A1 (en) Controller, method for identifying data block stability and storage system
CN112631516B (en) FLASH file management system with service life management function
CN103559139A (en) Data storage method and device
CN113076220A (en) Data processing method and device, electronic equipment and computer readable medium
CN114155906A (en) Data block repairing method, device, equipment and storage medium
WO2021027271A1 (en) Bad block information protection method and apparatus, computer device and storage medium
US9424262B2 (en) Computing system and data management method thereof
CN105404475A (en) Storage management system and method for small-capacity flash in MCU chip
KR101111400B1 (en) Apparatus and method for recovering the data of embeded system
CN114327292A (en) File management method, system, electronic device and storage medium
CN101187849A (en) Storage device and storage system
CN112783711A (en) Method and storage medium for analyzing program memory on NodeJS
CN113467698A (en) Writing method and device based on file system, computer equipment and storage medium
JP2009157441A (en) Information processor, file rearrangement method, and program

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
GR01 Patent grant
GR01 Patent grant