CN110908828A - Data storage method and device, electronic equipment and storage medium - Google Patents

Data storage method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN110908828A
CN110908828A CN201811092892.7A CN201811092892A CN110908828A CN 110908828 A CN110908828 A CN 110908828A CN 201811092892 A CN201811092892 A CN 201811092892A CN 110908828 A CN110908828 A CN 110908828A
Authority
CN
China
Prior art keywords
hard disk
group
data
groups
target
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.)
Pending
Application number
CN201811092892.7A
Other languages
Chinese (zh)
Inventor
蒋赵贵
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Hikvision Digital Technology Co Ltd
Original Assignee
Hangzhou Hikvision Digital Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Hikvision Digital Technology Co Ltd filed Critical Hangzhou Hikvision Digital Technology Co Ltd
Priority to CN201811092892.7A priority Critical patent/CN110908828A/en
Publication of CN110908828A publication Critical patent/CN110908828A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • 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
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/16Error detection or correction of the data by redundancy in hardware
    • G06F11/20Error detection or correction of the data by redundancy in hardware using active fault-masking, e.g. by switching out faulty elements or by switching in spare elements
    • G06F11/202Error detection or correction of the data by redundancy in hardware using active fault-masking, e.g. by switching out faulty elements or by switching in spare elements where processing functionality is redundant
    • G06F11/2023Failover techniques
    • G06F11/2033Failover techniques switching over of hardware resources

Abstract

The embodiment of the invention provides a data storage method, a data storage device, electronic equipment and a storage medium, wherein the data storage method is used for acquiring configuration information of each hard disk; determining hard disk groups of each hard disk according to configuration information of each hard disk and a preset grouping condition, wherein each hard disk group comprises a main hard disk and a redundant hard disk; selecting a group of hard disk groups as target hard disk groups, writing data to be written in main memory hard disks of the target hard disk groups, and redundantly backing up the data to be written in redundant hard disks of the target hard disk groups. In the data storage method of the embodiment of the invention, all hard disks are grouped, and the data in the main memory hard disk and the data in the redundant hard disk in the same hard disk group are the same, so that the data management can be facilitated.

Description

Data storage method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of data storage technologies, and in particular, to a data storage method and apparatus, an electronic device, and a storage medium.
Background
RAID (Redundant array of Disks) is a technology that combines a plurality of Independent physical hard Disks in different ways to form one logical disk, thereby providing higher storage performance than a single hard disk and providing data redundancy.
When the RAID is used for storing data, the data to be written is stored in the appointed hard disk, and meanwhile, in order to increase data security, one hard disk is randomly selected from other hard disks except the appointed hard disk to backup the data to be written, and the backup position of the data to be written is recorded, so that later reading is facilitated.
However, the above data storage method is inconvenient for data management after the hard disks are disassembled and sealed.
Disclosure of Invention
The embodiment of the invention aims to provide a data storage method, a data storage device, electronic equipment and a storage medium, so as to realize convenient data management. The specific technical scheme is as follows:
in a first aspect, an embodiment of the present invention provides a data storage method, which is applied to a storage device, where the storage device is provided with a plurality of hard disks through hard disk slots, and the method includes:
acquiring configuration information of each hard disk;
determining hard disk groups of the hard disks according to configuration information of the hard disks and a preset grouping rule, wherein each hard disk group comprises a main memory hard disk and a redundant hard disk;
selecting a group of hard disk groups as target hard disk groups, writing data to be written in main memory hard disks of the target hard disk groups, and redundantly backing up the data to be written in redundant hard disks of the target hard disk groups.
Optionally, after determining the hard disk groups of the hard disks according to the configuration information of each hard disk and a preset grouping rule, the method further includes:
and formatting the hard disks in each hard disk group according to a preset formatting rule.
Optionally, the formatting the hard disks in each hard disk group according to a preset formatting rule includes:
judging whether the hard disks in each hard disk group meet a preset formatting condition or not;
formatting the hard disk which meets the preset formatting condition;
generating formatting inquiry information aiming at the hard disk which does not accord with the preset formatting condition;
when receiving a formatting confirmation message returned aiming at the formatting inquiry information, formatting the hard disk which does not accord with the preset formatting condition;
and when receiving a format cancellation message returned by aiming at the format inquiry information, canceling the hard disk groups of the hard disks which do not accord with the preset format condition.
Optionally, after the group of hard disk packets is selected as a target hard disk packet, data to be written is written in a main memory hard disk of the target hard disk packet, and the data to be written is redundantly backed up in a redundant hard disk of the target hard disk packet, the method further includes:
when the main memory hard disk or the redundant hard disk of the target hard disk group is abnormal, selecting a group of hard disk groups from the unused hard disk groups;
writing data to be written in the main memory hard disk of the selected hard disk group, and redundantly backing up the data to be written in the redundant hard disk of the selected hard disk group.
Optionally, after the group of hard disk packets is selected as a target hard disk packet, data to be written is written in a main memory hard disk of the target hard disk packet, and the data to be written is redundantly backed up in a redundant hard disk of the target hard disk packet, the method further includes:
when the residual storage space of the main memory hard disk or the redundant hard disk in the target hard disk group is smaller than a preset space threshold value, selecting a group of hard disk groups from the unused hard disk groups;
writing data to be written in the main memory hard disk of the selected hard disk group, and redundantly backing up the data to be written in the redundant hard disk of the selected hard disk group.
Optionally, the data to be written includes video data acquired by a plurality of image acquisition devices; the storage device simultaneously receives video data of a plurality of image acquisition devices;
when the remaining storage space of the main memory hard disk or the redundant hard disk of the target hard disk group is smaller than a preset space threshold, selecting a group of hard disk groups from unused hard disk groups, including:
when any storage area of a main memory hard disk or a redundant hard disk of the target hard disk group is full, a group of hard disk groups are selected from unused hard disk groups, wherein each image acquisition device corresponds to different storage areas, and the acquisition time of each video data stored in the same hard disk in the target hard disk group is consistent.
Optionally, the data storage method according to the embodiment of the present invention further includes:
and setting the attribute of each hard disk in the target hard disk group as read-only.
Optionally, the data storage method according to the embodiment of the present invention further includes:
and sending a hard disk replacement prompt message to a subscriber, wherein the hard disk replacement prompt message comprises the identification of each hard disk in the target hard disk group.
In a second aspect, an embodiment of the present invention provides a data storage apparatus, located in a storage device, where the storage device is provided with a plurality of hard disks through a hard disk slot, and the apparatus includes:
the information acquisition module is used for acquiring the configuration information of each hard disk;
the hard disk grouping module is used for determining hard disk groups of the hard disks according to configuration information of the hard disks and a preset grouping rule, wherein each hard disk group comprises a main memory hard disk and a redundant hard disk;
the first data writing module is used for selecting a group of hard disk groups as target hard disk groups, writing data to be written in main memory hard disks of the target hard disk groups, and redundantly backing up the data to be written in redundant hard disks of the target hard disk groups.
Optionally, the data storage device according to the embodiment of the present invention further includes:
and the formatting module is used for formatting the hard disks in each hard disk group according to a preset formatting rule.
Optionally, the formatting module includes:
the condition judgment submodule is used for judging whether the hard disks in each hard disk group meet the preset formatting condition or not;
the first formatting submodule is used for formatting the hard disk which meets the preset formatting condition;
the inquiry message generating submodule is used for generating formatted inquiry information aiming at the hard disk which does not accord with the preset formatting condition;
the second formatting submodule is used for formatting the hard disk which does not accord with the preset formatting condition when receiving a formatting confirmation message returned aiming at the formatting inquiry information;
and the hard disk grouping canceling submodule is used for canceling the hard disk grouping of the hard disks which do not accord with the preset formatting condition when receiving a formatting canceling message returned by aiming at the formatting inquiry information.
Optionally, the data storage device according to the embodiment of the present invention further includes:
the first grouping selection module is used for selecting a group of hard disk groups from unused hard disk groups when the main memory hard disk or the redundant hard disk of the target hard disk group is abnormal;
and the second data writing module is used for writing data to be written in the main memory hard disk of the selected hard disk group and redundantly backing up the data to be written in the redundant hard disk of the selected hard disk group.
Optionally, the data storage device according to the embodiment of the present invention further includes:
the second grouping selection module is used for selecting a group of hard disk groups from the unused hard disk groups when the residual storage space of the main memory hard disk or the redundant hard disk in the target hard disk group is smaller than a preset space threshold value;
and the third data writing module is used for writing data to be written in the main memory hard disk of the selected hard disk group and redundantly backing up the data to be written in the redundant hard disk of the selected hard disk group.
Optionally, the data to be written includes video data acquired by a plurality of image acquisition devices; the storage device simultaneously receives video data of a plurality of image acquisition devices;
the second grouping selection module is specifically configured to:
when any storage area of a main memory hard disk or a redundant hard disk of the target hard disk group is full, a group of hard disk groups are selected from unused hard disk groups, wherein each image acquisition device corresponds to different storage areas, and the acquisition time of each video data stored in the same hard disk in the target hard disk group is consistent.
Optionally, the data storage device according to the embodiment of the present invention further includes:
and the attribute setting module is used for setting the attribute of each hard disk in the target hard disk group as read-only.
Optionally, the data storage device according to the embodiment of the present invention further includes:
and the prompt information sending module is used for sending hard disk replacement prompt information to the subscriber end, wherein the hard disk replacement prompt information comprises the identification of each hard disk in the target hard disk group.
In a third aspect, an embodiment of the present invention provides an electronic device, including a processor and a memory;
the memory is used for storing a computer program;
the processor is configured to implement the data storage method according to any one of the first aspect described above when executing the program stored in the memory.
In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the computer program implements the data storage method according to any one of the first aspect.
The data storage method, the data storage device, the electronic equipment and the storage medium provided by the embodiment of the invention are used for acquiring the configuration information of each hard disk; determining hard disk groups of each hard disk according to configuration information of each hard disk and a preset grouping condition, wherein each hard disk group comprises a main hard disk and a redundant hard disk; selecting a group of hard disk groups as target hard disk groups, writing data to be written in main memory hard disks of the target hard disk groups, and redundantly backing up the data to be written in redundant hard disks of the target hard disk groups. The hard disks are grouped, and the data in the main memory hard disk and the data in the redundant hard disk in the same hard disk group are the same, so that the data management can be facilitated. Of course, not all of the advantages described above need to be achieved at the same time in the practice of any one product or method of the invention.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
FIG. 1 is a first flowchart of a data storage method according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of a memory device according to an embodiment of the invention;
FIG. 3 is a second flowchart illustrating a data storage method according to an embodiment of the invention;
FIG. 4 is a third flowchart illustrating a data storage method according to an embodiment of the invention;
FIG. 5 is a diagram illustrating a fourth flowchart of a data storage method according to an embodiment of the present invention;
FIG. 6 is a diagram illustrating a fifth flowchart of a data storage method according to an embodiment of the invention;
FIG. 7 is a schematic diagram of a data storage device according to an embodiment of the present invention;
fig. 8 is a schematic diagram of an electronic device according to an embodiment of the invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
When the RAID is adopted to store data, the data to be written is stored in the appointed hard disk, and one hard disk is randomly selected from other hard disks except the appointed hard disk to backup the data to be written. However, the inventor finds that, in the data storage method, data on one hard disk can be backed up to a plurality of hard disks, which is inconvenient for data management.
For example, when a game Video is stored by a hard disk Recorder such as a DVR (Digital Video Recorder) or an NVR (network Video Recorder), all Video data of the game a, including segments 1 to 3 of the game a, are stored in the hard disk a, but segment 1 of the game a is backed up in the hard disk B, segment 2 of the game a is backed up in the hard disk C, segment 3 of the game a is backed up in the hard disk D, and data of other games are also backed up in the hard disk B, the hard disk C, and the hard disk D, respectively, which increases complexity of data management.
In view of this, an embodiment of the present invention provides a data storage method, which is applied to a storage device, where the storage device is provided with a plurality of hard disks through hard disk slots, and with reference to fig. 1, the method includes:
s101, obtaining configuration information of each hard disk.
The data storage method in the embodiment of the present invention may be implemented by a storage system, and the storage system is any system capable of implementing the data storage method in the embodiment of the present invention. For example:
the storage system may be an apparatus comprising: a processor, a memory, a communication interface, and a bus; the processor, the memory and the communication interface are connected through a bus and complete mutual communication; the memory stores executable program code; the processor executes a program corresponding to the executable program code by reading the executable program code stored in the memory, for executing the data storage method of the embodiment of the present invention.
Alternatively, the storage system may be a hard disk recorder, such as a DVR or NVR.
The storage system may also be an application program for executing the data storage method of the embodiment of the present invention at runtime.
The storage system may also be a storage medium for storing executable code for performing the data storage method of the embodiments of the present invention.
The storage system obtains configuration information of each hard disk, and the configuration information of the hard disks may include an identifier of a hard disk slot where the hard disk is installed, and may also include information such as an identifier, capacity, and type of the hard disk.
And S102, determining hard disk groups of the hard disks according to configuration information of the hard disks and a preset grouping rule, wherein each hard disk group comprises a main hard disk and a redundant hard disk.
The preset grouping rule is any grouping rule and can be set according to actual conditions. For example, hard disks are grouped according to hard disk slots installed in the hard disks; or the hard disks are grouped according to the capacity of each hard disk. Each hard disk group at least comprises a main memory hard disk and a redundant hard disk.
For example, as shown in fig. 2, the storage device includes hard disk slots 1 to 8, each hard disk slot is provided with one hard disk, the hard disks installed in the hard disk slot 1 and the hard disks installed in the hard disk slot 2 are grouped as a hard disk a, the hard disks installed in the hard disk slot 3 and the hard disks installed in the hard disk slot 4 are grouped as a hard disk B, the hard disks installed in the hard disk slot 5 and the hard disks installed in the hard disk slot 6 are grouped as a hard disk C, and the hard disks installed in the hard disk slot 7 and the hard disks installed in the hard disk slot 8 are grouped as a hard disk D, so that four hard disk groups are obtained.
S103, selecting a group of hard disk groups as target hard disk groups, writing data to be written into a main memory hard disk of the target hard disk groups, and redundantly backing up the data to be written into a redundant hard disk of the target hard disk groups.
The storage system selects a group of hard disk groups as target hard disk groups. For example, the storage system selects a group of unused hard disk groups as a target hard disk group, or selects a group of hard disk groups with storage space left as a target hard disk group, or selects a hard disk group with non-read-only attribute as a target hard disk group, and the like. The storage system writes data to be written in the redundant hard disks of the target hard disk group while writing the data to be written in the main memory hard disks of the target hard disk group, and backups the data to be written through the redundant hard disks.
In the embodiment of the invention, the hard disks are grouped, and the data in the main memory hard disk and the redundant hard disk in the same hard disk group are the same, so that the data management can be facilitated.
Optionally, after determining the hard disk groups of the hard disks according to the configuration information of the hard disks and a preset grouping rule, the method further includes:
and formatting the hard disks in each hard disk group according to a preset formatting rule.
The preset formatting rule may be set according to actual situations, for example, the hard disks in each hard disk group are all formatted, or the newly accessed hard disks in each hard disk group are formatted.
In the embodiment of the invention, the hard disks in each hard disk group are formatted, so that the automatic formatting of the hard disks is realized.
Optionally, the formatting the hard disks in each hard disk group according to a preset formatting rule includes:
step one, judging whether the hard disks in each hard disk group meet a preset formatting condition.
The preset formatting condition can be set according to the actual situation, for example, when the hard disk is a hard disk newly accessed to the storage device, the hard disk is judged to accord with the preset formatting condition; or the time length from the last modification time of the hard disk to the current time is longer than the preset time length, and the like.
Step two, formatting the hard disk meeting the preset formatting condition.
And step three, generating formatting inquiry information aiming at the hard disks which do not accord with the preset formatting condition.
The storage system generates formatted inquiry information for the hard disk which does not meet the preset formatting condition, for example, the formatted inquiry information is displayed on a display screen or sent to a subscriber terminal.
And step four, when receiving a formatting confirmation message returned by aiming at the formatting inquiry information, formatting the hard disk which does not accord with the preset formatting condition.
Upon user approval of formatting, the user enters a confirmation formatting message for the formatting query, for example, via a storage device or via a subscriber. And when the storage system receives the formatting confirmation message, formatting the corresponding hard disk which does not accord with the preset formatting condition.
And step five, when receiving a format cancellation message returned by aiming at the format inquiry information, canceling the hard disk groups of the hard disks which do not accord with the preset format condition.
When the user disagrees with the formatting, the user inputs a de-formatting message for the formatting inquiry information, for example, by inputting the de-formatting message through a storage device or inputting the de-formatting message through a subscriber terminal. And when the storage system receives the message of canceling the formatting, the storage system does not format the corresponding hard disks which do not accord with the preset formatting condition, and deletes the hard disk groups where the hard disks which do not accord with the preset formatting condition are positioned in the storage system.
In the embodiment of the invention, the query information is formatted to prevent the error formatting of the hard disk.
Optionally, after selecting a group of the hard disk groups as a target hard disk group, writing data to be written into a main memory hard disk of the target hard disk group, and redundantly backing up the data to be written into a redundant hard disk of the target hard disk group, the method further includes:
step one, when the main memory hard disk or the redundant hard disk of the target hard disk group is abnormal, a group of hard disk groups are selected from the unused hard disk groups.
For example, the storage system randomly selects one hard disk group from the unused hard disk groups, or selects one hard disk group from the unused hard disk groups according to a preset selection sequence.
Writing data to be written into the main memory hard disk of the selected hard disk group, and redundantly backing up the data to be written into the redundant hard disk of the selected hard disk group.
In the embodiment of the invention, in the process of writing and backing up the data to be written, if the main memory hard disk or the redundant hard disk of the target hard disk group is abnormal, other hard disk groups are selected to continuously finish the writing of the data to be written, so that the writing of the data to be written can be ensured, and the data in the main memory hard disk and the redundant hard disk in the same hard disk group are ensured to be consistent.
Optionally, after selecting a group of the hard disk groups as a target hard disk group, writing data to be written into a main memory hard disk of the target hard disk group, and redundantly backing up the data to be written into a redundant hard disk of the target hard disk group, the method further includes:
step one, when the residual storage space of a main memory hard disk or a redundant hard disk in the target hard disk group is smaller than a preset space threshold value, selecting a group of hard disk groups from the unused hard disk groups.
The preset space threshold may be set according to actual conditions, for example, the preset space threshold is set to 0 megabyte, 100 megabytes or 500 megabytes; or the preset space threshold is set to be 0%, 2% or 5% of the total capacity of the hard disk, and the like.
Writing data to be written into the main memory hard disk of the selected hard disk group, and redundantly backing up the data to be written into the redundant hard disk of the selected hard disk group.
In the embodiment of the invention, in the process of writing and backing up the data to be written, if the residual storage space of the main memory hard disk or the redundant hard disk of the target hard disk group is smaller than the preset space threshold, other hard disk groups are selected to continuously finish the writing of the data to be written, so that the writing of the data to be written can be ensured, and the data in the main memory hard disk and the redundant hard disk in the same hard disk group are ensured to be consistent.
Optionally, the data to be written includes video data acquired by a plurality of image acquisition devices; the storage device simultaneously receives video data of a plurality of image acquisition devices;
correspondingly, when the remaining storage space of the main memory hard disk or the redundant hard disk of the target hard disk group is smaller than the preset space threshold, selecting a group of hard disk groups from the unused hard disk groups includes:
when any storage area of a main memory hard disk or a redundant hard disk of the target hard disk group is full, a group of hard disk groups are selected from unused hard disk groups, wherein each image acquisition device corresponds to different storage areas, and the acquisition time of each video data stored in the same hard disk in the target hard disk group is consistent.
When the storage device receives video data of a plurality of image capturing devices at the same time, the storage system may divide storage areas for each video data in the main hard disk of the target hard disk group, for example, divide the video data into the same number of storage areas according to the number of paths of the video data, and the size of each storage area may be the same, or may also be determined according to the resolution of each video data. And simultaneously, carrying out similar division on redundant hard disks.
When any storage area in the main memory hard disk or the redundant hard disk of the target hard disk group is full, the storage system selects a new hard disk group to continue to write data to be written, so that the acquisition time of all video data stored in the same hard disk in the target hard disk group is consistent, and the video data can be conveniently managed.
Optionally, the data storage method according to the embodiment of the present invention further includes:
and setting the attribute of each hard disk in the target hard disk group as read-only.
When the residual storage space of the main memory hard disk or the redundant hard disk in the target hard disk group is smaller than a preset space threshold value or the main memory hard disk or the redundant hard disk in the target hard disk group is abnormal, setting the attribute of each hard disk in the target hard disk group as read-only, and simultaneously selecting a new hard disk group to continuously store data to be written.
In the embodiment of the invention, the attribute of each hard disk in the target hard disk group is set to be read-only, so that the data in each hard disk in the target hard disk is not modified, and the data is prevented from being deleted by mistake.
Optionally, the data storage method according to the embodiment of the present invention further includes:
and sending a hard disk replacement prompt message to a subscriber, wherein the hard disk replacement prompt message comprises the identification of each hard disk in the target hard disk group.
The storage system sends the hard disk replacement prompt information to the subscriber, for example, sends a hypertext transfer protocol message or an email to the subscriber. And the subscriber end replaces each hard disk in the target hard disk group after receiving the hard disk replacement prompt message.
In the embodiment of the invention, the hard disk replacement prompt message is sent to the subscriber end to remind the user of replacing each hard disk in the target hard disk group, so that the continuous operation of the storage equipment is ensured.
In view of some characteristic application scenarios, it is required that video data needs to be forcibly stored for more than 4 years to ensure that spot-checking can be performed at any time within 4 years, and there are two such scenarios: firstly, data backup is safe and reliable; and secondly, the 4-year video is stored in a hard disk management mode, when the disk is full of video, the management personnel is informed by the mail to take the full disk and replace the disk with a new disk, so that the operation is required to be convenient and fast, and meanwhile, the hard disk can be subjected to labeling management, so that the hard disk where the specified video data is located can be quickly positioned according to factors such as location and time when the specified video data is conveniently spot checked.
The embodiment of the invention provides a video data storage method, which comprises the following steps:
hard disks are grouped, and are used and managed according to groups.
Each group comprises two or more hard disks, hard disk slots contained in the group are configured in advance, the hard disks in the fixed slots in the group are used for recording, and the hard disks in the fixed slots are used for redundancy.
And the slot position is inserted into the hard disk to trigger grouping analysis, and when a certain group detects that the slot position of the hard disk meets the automatic grouping requirement, the group is automatically grouped to become a new available group. And after the automatic grouping and building are finished, the automatic formatting is carried out, and the automatic grouping and building can be used for video recording and redundancy after the formatting is finished.
When the video files of one camera in each group are fully recorded and a new hard disk is required to be switched to record, all the video files of the cameras are switched to the new hard disk forcibly, all the video tasks on the old hard disk are finished, and the finishing time of all the video files of the cameras on one hard disk is kept consistent.
When the packet is full or abnormal (when the video disc or the redundant disc cannot be used), the read-only attribute is set, the coverage is not allowed, and the next packet is switched.
When a packet is abnormal, the next packet is immediately switched to.
When detecting that the inserted disc has data which is not a new disc, prompting is carried out, and the user confirms that the data can be formatted and then the data is used for automatic construction.
When the grouped disks are full or abnormal, the grouped disks are sent to a manager through mails or other modes to remind the manager to replace a new hard disk, the sent information content comprises the starting time and the ending time of all videos of the hard disk, and the manager pastes the information printing labels to the unplugged hard disks and then seals and manages the disks.
Taking 8 hard disk slots as an example, the RAID1 scheme is adopted to divide the hard disks into 4 groups. Grouping management as shown in fig. 2, the grouping as a whole, video recording and redundancy are maintained in one grouping, and when video recording is switched from hard disk grouping a to hard disk grouping B, redundancy is also switched from hard disk grouping a to hard disk grouping B. Hard disk grouping allocation is configured in advance, and video recording and redundancy schemes are not limited. In fig. 2, 8 hard disk slots are sequentially divided, the slot 1 and the slot 2 are divided into a hard disk group, and the slot 3 and the slot 4 are divided into a hard disk group and 4 hard disk groups in sequence. Each grouping constitutes a RAID 1. RAID1 is a RAID hard disk array composed of at least two hard disks, and data backed up with each other are generated on pairs of independent hard disks. When the original data is busy, the data may be read directly from the mirror copy, so RAID1 may improve read performance. RAID1 is the highest unit cost in a hard disk array, but provides high data security and availability. When one hard disk fails, the system can be automatically switched to the mirror hard disk for reading and writing without recombining failed data.
Referring to fig. 3, when the storage device is started, the grouping configuration is obtained, whether each hard disk grouping meets the grouping availability condition is detected, and the grouping is automatically grouped and formatted as an available grouping according to the condition. For example, the slot positions 1 and 2 are configured to be divided into a hard disk group, the slot positions 3 and 4 are divided into a hard disk group, the slot positions 5 and 6 are divided into a hard disk group, the slot positions 7 and 8 are divided into a hard disk group, the total number of the hard disk group is 4, and each group is configured with a RAID1 scheme. When the device is started, the packet is traversed, and when the packet is judged to have hard disks in two slots of a hard disk packet A and the hard disks have non-read-only attributes during detection, the packet is automatically constructed into a RAID1 and formatted.
Referring to fig. 4, when detecting that the hard disk is inserted into the slot position, the hot-plug automatic assembly unit first identifies whether the hard disk is a new disk, and if not, prompts whether the new disk is formatted for use, so as to prevent a user from mistakenly operating the inserted and pulled hard disk, and if not, does not perform any operation on the hard disk. If the corresponding grouping is formatted or is a new disk, whether the corresponding grouping meets the automatic grouping condition is judged according to the slot position of the inserted hard disk, and then the grouping is automatically grouped.
Referring to fig. 5, the hard disk state change processing unit detects a hard disk change, when any one of the storage areas allocated to each camera in the hard disk is full, all the cameras end recording in the hard disk group, the recording hard disk and the redundant hard disk in the hard disk group are both set to have read-only attributes, and information is sent to a manager. The information includes, in addition to indicating that the hard disk is full: the number of the slot full of the hard disk, the earliest acquisition time and the latest acquisition time of all video of the hard disk. When one hard disk in the hard disk group is abnormal, if the hard disk group is used for recording, the recording of all cameras in the hard disk group is finished, the rest normal disks in the hard disk group are set to be read only, the next available hard disk group is switched to record, and meanwhile, information is sent to a manager. The information includes, in addition to indicating a hard disk anomaly: the slot position number of the abnormal hard disk leaves the earliest collecting time and the latest collecting time of all the videos of the normal hard disk, so that the management personnel can conveniently replace the two hard disks of the group and label the normal hard disks for sealing.
Referring to fig. 6, the manager mainly processes according to the mail prompt, and only needs to plug and unplug the hard disk, so that the operation on the storage device can be reduced, and the operation is convenient and fast.
An embodiment of the present invention provides a data storage apparatus, located in a storage device, where the storage device is installed with a plurality of hard disks through a hard disk slot, and referring to fig. 7, the apparatus includes:
an information obtaining module 701, configured to obtain configuration information of each hard disk;
a hard disk grouping module 702, configured to determine, according to configuration information of each hard disk and according to a preset grouping rule, a hard disk group of each hard disk, where each hard disk group includes a main hard disk and a redundant hard disk;
the first data writing module 703 is configured to select a group of the hard disk groups as a target hard disk group, write data to be written in a main memory hard disk of the target hard disk group, and redundantly backup the data to be written in a redundant hard disk of the target hard disk group.
Optionally, the data storage device according to the embodiment of the present invention further includes:
and the formatting module is used for formatting the hard disks in each hard disk group according to a preset formatting rule.
Optionally, the formatting module includes:
the condition judgment submodule is used for judging whether the hard disks in each hard disk group meet the preset formatting condition or not;
the first formatting submodule is used for formatting the hard disk which meets the preset formatting condition;
the inquiry message generating submodule is used for generating formatted inquiry information aiming at the hard disk which does not accord with the preset formatting condition;
the second formatting submodule is used for formatting the hard disk which does not accord with the preset formatting condition when receiving a formatting confirmation message returned aiming at the formatting inquiry information;
and the hard disk grouping canceling submodule is used for canceling the hard disk grouping of the hard disks which do not accord with the preset formatting condition when receiving a formatting canceling message returned by aiming at the formatting inquiry information.
Optionally, the data storage device according to the embodiment of the present invention further includes:
the first grouping selection module is used for selecting a group of hard disk groups from unused hard disk groups when the main memory hard disk or the redundant hard disk of the target hard disk group is abnormal;
and the second data writing module is used for writing data to be written in the main memory hard disk of the selected hard disk group and redundantly backing up the data to be written in the redundant hard disk of the selected hard disk group.
Optionally, the data storage device according to the embodiment of the present invention further includes:
the second grouping selection module is used for selecting a group of hard disk groups from the unused hard disk groups when the residual storage space of the main memory hard disk or the redundant hard disk in the target hard disk group is smaller than a preset space threshold value;
and the third data writing module is used for writing data to be written in the main memory hard disk of the selected hard disk group and redundantly backing up the data to be written in the redundant hard disk of the selected hard disk group.
Optionally, the data to be written includes video data acquired by a plurality of image acquisition devices; the storage device simultaneously receives video data of a plurality of image acquisition devices;
the second grouping selection module is specifically configured to:
when any storage area of a main memory hard disk or a redundant hard disk of the target hard disk group is full, a group of hard disk groups are selected from unused hard disk groups, wherein each image acquisition device corresponds to different storage areas, and the acquisition time of each video data stored in the same hard disk in the target hard disk group is consistent.
Optionally, the data storage device according to the embodiment of the present invention further includes:
and the attribute setting module is used for setting the attribute of each hard disk in the target hard disk group as read-only.
Optionally, the data storage device according to the embodiment of the present invention further includes:
and the prompt information sending module is used for sending hard disk replacement prompt information to the subscriber end, wherein the hard disk replacement prompt information comprises the identification of each hard disk in the target hard disk group.
In the embodiment of the invention, the hard disks are grouped, and the data in the main memory hard disk and the redundant hard disk in the same hard disk group are the same, so that the data management can be facilitated.
An embodiment of the present invention provides an electronic device, see fig. 8, including a processor 801 and a memory 802;
the memory 802 is used for storing computer programs;
the processor 801 is configured to implement the following steps when executing the program stored in the memory 802:
acquiring configuration information of each hard disk;
determining hard disk groups of the hard disks according to configuration information of the hard disks and a preset grouping rule, wherein each hard disk group comprises a main memory hard disk and a redundant hard disk;
and selecting a group of hard disk groups as target hard disk groups, writing data to be written into a main memory hard disk of the target hard disk groups, and redundantly backing up the data to be written into a redundant hard disk of the target hard disk groups.
In the embodiment of the invention, the hard disks are grouped, and the data in the main memory hard disk and the redundant hard disk in the same hard disk group are the same, so that the data management can be facilitated.
Optionally, the processor 801 is configured to implement any one of the data storage methods when executing the program stored in the memory 802.
Optionally, the electronic device according to the embodiment of the present invention further includes a communication interface and a communication bus, where the processor 801, the communication interface, and the memory 802 complete mutual communication through the communication bus.
Optionally, the electronic device according to the embodiment of the present invention is specifically a hard disk video recorder, such as a DVR or an NVR.
The communication bus mentioned in the electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the electronic equipment and other equipment.
The Memory may include a Random Access Memory (RAM) or a Non-Volatile Memory (NVM), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component.
An embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the computer program implements the following steps:
acquiring configuration information of each hard disk;
determining hard disk groups of the hard disks according to configuration information of the hard disks and a preset grouping rule, wherein each hard disk group comprises a main memory hard disk and a redundant hard disk;
and selecting a group of hard disk groups as target hard disk groups, writing data to be written into a main memory hard disk of the target hard disk groups, and redundantly backing up the data to be written into a redundant hard disk of the target hard disk groups.
In the embodiment of the invention, the hard disks are grouped, and the data in the main memory hard disk and the redundant hard disk in the same hard disk group are the same, so that the data management can be facilitated.
Optionally, the computer program can also implement any of the data storage methods described above when executed by a processor.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the embodiments of the apparatus, the electronic device, and the storage medium, since they are substantially similar to the method embodiments, the description is relatively simple, and for the relevant points, reference may be made to the partial description of the method embodiments.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (11)

1. A data storage method is applied to a storage device, wherein a plurality of hard disks are installed in the storage device through hard disk slot positions, and the method comprises the following steps:
acquiring configuration information of each hard disk;
determining hard disk groups of the hard disks according to configuration information of the hard disks and a preset grouping rule, wherein each hard disk group comprises a main memory hard disk and a redundant hard disk;
selecting a group of hard disk groups as target hard disk groups, writing data to be written in main memory hard disks of the target hard disk groups, and redundantly backing up the data to be written in redundant hard disks of the target hard disk groups.
2. The method of claim 1, wherein after determining the hard disk groups of the hard disks according to a preset grouping rule according to the configuration information of the hard disks, the method further comprises:
and formatting the hard disks in each hard disk group according to a preset formatting rule.
3. The method of claim 2, wherein formatting the hard disks in each hard disk group according to a preset formatting rule comprises:
judging whether the hard disks in each hard disk group meet a preset formatting condition or not;
formatting the hard disk which meets the preset formatting condition;
generating formatting inquiry information aiming at the hard disk which does not accord with the preset formatting condition;
when receiving a formatting confirmation message returned aiming at the formatting inquiry information, formatting the hard disk which does not accord with the preset formatting condition;
and when receiving a format cancellation message returned by aiming at the format inquiry information, canceling the hard disk groups of the hard disks which do not accord with the preset format condition.
4. The method according to claim 1, wherein after the selecting a group of hard disk groups as a target hard disk group, writing data to be written into a main hard disk of the target hard disk group, and redundantly backing up the data to be written into a redundant hard disk of the target hard disk group, the method further comprises:
when the main memory hard disk or the redundant hard disk of the target hard disk group is abnormal, selecting a group of hard disk groups from the unused hard disk groups;
writing data to be written in the main memory hard disk of the selected hard disk group, and redundantly backing up the data to be written in the redundant hard disk of the selected hard disk group.
5. The method according to claim 1, wherein after the selecting a group of hard disk groups as a target hard disk group, writing data to be written into a main hard disk of the target hard disk group, and redundantly backing up the data to be written into a redundant hard disk of the target hard disk group, the method further comprises:
when the residual storage space of the main memory hard disk or the redundant hard disk in the target hard disk group is smaller than a preset space threshold value, selecting a group of hard disk groups from the unused hard disk groups;
writing data to be written in the main memory hard disk of the selected hard disk group, and redundantly backing up the data to be written in the redundant hard disk of the selected hard disk group.
6. The method according to claim 5, wherein the data to be written comprises video data captured by a plurality of image capturing devices; the storage device simultaneously receives video data of a plurality of image acquisition devices;
when the remaining storage space of the main memory hard disk or the redundant hard disk of the target hard disk group is smaller than a preset space threshold, selecting a group of hard disk groups from unused hard disk groups, including:
when any storage area of a main memory hard disk or a redundant hard disk of the target hard disk group is full, a group of hard disk groups are selected from unused hard disk groups, wherein each image acquisition device corresponds to different storage areas, and the acquisition time of each video data stored in the same hard disk in the target hard disk group is consistent.
7. The method according to claim 4 or 5, characterized in that the method further comprises:
and setting the attribute of each hard disk in the target hard disk group as read-only.
8. The method according to claim 4 or 5, characterized in that the method further comprises:
and sending a hard disk replacement prompt message to a subscriber, wherein the hard disk replacement prompt message comprises the identification of each hard disk in the target hard disk group.
9. A data storage apparatus, located in a storage device having a plurality of hard disks mounted therein via hard disk slots, the apparatus comprising:
the information acquisition module is used for acquiring the configuration information of each hard disk;
the hard disk grouping module is used for determining hard disk groups of the hard disks according to configuration information of the hard disks and a preset grouping rule, wherein each hard disk group comprises a main memory hard disk and a redundant hard disk;
the first data writing module is used for selecting a group of hard disk groups as target hard disk groups, writing data to be written in main memory hard disks of the target hard disk groups, and redundantly backing up the data to be written in redundant hard disks of the target hard disk groups.
10. An electronic device comprising a processor and a memory;
the memory is used for storing a computer program;
the processor, when executing the program stored in the memory, implementing the method steps of any of claims 1-8.
11. A computer-readable storage medium, characterized in that a computer program is stored in the computer-readable storage medium, which computer program, when being executed by a processor, carries out the method steps of any one of the claims 1-8.
CN201811092892.7A 2018-09-18 2018-09-18 Data storage method and device, electronic equipment and storage medium Pending CN110908828A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811092892.7A CN110908828A (en) 2018-09-18 2018-09-18 Data storage method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811092892.7A CN110908828A (en) 2018-09-18 2018-09-18 Data storage method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN110908828A true CN110908828A (en) 2020-03-24

Family

ID=69813714

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811092892.7A Pending CN110908828A (en) 2018-09-18 2018-09-18 Data storage method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN110908828A (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060149997A1 (en) * 2004-12-30 2006-07-06 Mu Chai Systems and methods for dynamic restorating data
CN101727298A (en) * 2009-11-04 2010-06-09 北京东方广视科技股份有限公司 Method and device for realizing independent redundant arrays of inexpensive disks
CN103838521A (en) * 2014-02-28 2014-06-04 华为技术有限公司 Data processing method and data processing device
CN104615381A (en) * 2015-01-18 2015-05-13 浙江宇视科技有限公司 Redundancy array of independent disks of video monitoring system
CN107329856A (en) * 2017-06-30 2017-11-07 郑州云海信息技术有限公司 A kind of SDS dispositions methods and system based on RAID
US20180210799A1 (en) * 2016-12-21 2018-07-26 EMC IP Holding Company LLC Method and device for rebuilding raid

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060149997A1 (en) * 2004-12-30 2006-07-06 Mu Chai Systems and methods for dynamic restorating data
CN101727298A (en) * 2009-11-04 2010-06-09 北京东方广视科技股份有限公司 Method and device for realizing independent redundant arrays of inexpensive disks
CN103838521A (en) * 2014-02-28 2014-06-04 华为技术有限公司 Data processing method and data processing device
CN104615381A (en) * 2015-01-18 2015-05-13 浙江宇视科技有限公司 Redundancy array of independent disks of video monitoring system
US20180210799A1 (en) * 2016-12-21 2018-07-26 EMC IP Holding Company LLC Method and device for rebuilding raid
CN107329856A (en) * 2017-06-30 2017-11-07 郑州云海信息技术有限公司 A kind of SDS dispositions methods and system based on RAID

Similar Documents

Publication Publication Date Title
US20060010286A1 (en) Tape drive apparatus
US20200154090A1 (en) Systems, methods, and software for improved video data recovery effectiveness
US10572335B2 (en) Metadata recovery method and apparatus
TW201447826A (en) Security monitoring device with network and record function and failure detecting and repairing method for storage device thereof
US20140365824A1 (en) Method for recovering hard disk data, server and distributed storage system
CN109726036B (en) Data reconstruction method and device in storage system
CN105354109B (en) The backup method and device of video monitoring index data
JP2006012004A (en) Hot standby system
CN113419684B (en) Data processing method, device and equipment and readable storage medium
CN104007936A (en) Data access method and device
CN108170375B (en) Overrun protection method and device in distributed storage system
CN109947842B (en) Data storage method, device and system in distributed storage system
JP4933722B2 (en) Disk control device, disk patrol method, and disk patrol program
CN110908828A (en) Data storage method and device, electronic equipment and storage medium
CN115878052A (en) RAID array inspection method, inspection device and electronic equipment
TW201417579A (en) A video recording system, device and the method of the data accessing
CN114237489B (en) Method and device for writing logic resources into SMR disk, electronic equipment and storage medium
JP3841595B2 (en) Storage device alternation processing time judgment test method
CN107229535B (en) Multi-copy storage method, storage device and data reading method for data block
CN113485872A (en) Fault processing method and device and distributed storage system
CN107122261B (en) Data reading and writing method and device of storage equipment
CN107885640B (en) Hard disk management method and device
CN112162699A (en) Data reading and writing method, device and equipment and computer readable storage medium
CN110019233B (en) Data storage method and system
CN113806119A (en) Memory card processing method, device, equipment 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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20200324