CN112346648B - Hard disk partitioning method and device and electronic equipment - Google Patents

Hard disk partitioning method and device and electronic equipment Download PDF

Info

Publication number
CN112346648B
CN112346648B CN201910721949.3A CN201910721949A CN112346648B CN 112346648 B CN112346648 B CN 112346648B CN 201910721949 A CN201910721949 A CN 201910721949A CN 112346648 B CN112346648 B CN 112346648B
Authority
CN
China
Prior art keywords
hard disk
partition
recording
hard
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.)
Active
Application number
CN201910721949.3A
Other languages
Chinese (zh)
Other versions
CN112346648A (en
Inventor
朱斌
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Hikvision Digital Technology Co Ltd
Original Assignee
Hangzhou Hikvision Digital Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Hikvision Digital Technology Co Ltd filed Critical Hangzhou Hikvision Digital Technology Co Ltd
Priority to CN201910721949.3A priority Critical patent/CN112346648B/en
Publication of CN112346648A publication Critical patent/CN112346648A/en
Application granted granted Critical
Publication of CN112346648B publication Critical patent/CN112346648B/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/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
    • 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/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/0671In-line storage system
    • G06F3/0673Single storage device
    • G06F3/0674Disk device
    • G06F3/0676Magnetic disk device

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Signal Processing For Digital Recording And Reproducing (AREA)

Abstract

The embodiment of the application provides a hard disk partitioning method, a hard disk partitioning device and electronic equipment, which are applied to the technical field of storage equipment management, wherein the method comprises the following steps: detecting whether each hard disk connected with the current equipment comprises a recording partition or not; when the number of the hard disks containing the recording partition is N, selecting N-1 hard disks from the hard disks containing the recording partition to obtain each hard disk to be released, wherein N is an integer greater than 1; and dividing the recording partition in each hard disk to be released into data partitions. By the hard disk partitioning method, the fact that only one hard disk comprises the recording partition is achieved, and waste of storage resources in the hard disk is reduced.

Description

Hard disk partitioning method and device and electronic equipment
Technical Field
The present disclosure relates to the field of storage device management technologies, and in particular, to a method and an apparatus for partitioning a hard disk, and an electronic device.
Background
When the hard disk is formatted, a part of hard disk space is reserved as a recording partition for storing a recording buffer file, an I-frame index file, a TAG (TAG) file and a recording file.
Since there may be multiple hard disks in the host available for video monitoring, and the user may pull out the hard disk that is already full of data during use for archiving, or evidence presentation, etc., and then replace it with a new unformatted hard disk. In the related art, when the hard disk is formatted, the recording partition is allocated, so that any hard disk in the host computer which can be used for video monitoring is taken away, and the normal operation of the recording function of the host computer which can be used for video monitoring is not affected as long as at least one hard disk is reserved in the host computer which can be used for video monitoring.
However, by adopting the partition method, each hard disk is allocated with a recording partition, which causes waste of storage resources in the hard disk.
Disclosure of Invention
An embodiment of the application aims to provide a hard disk partitioning method, a hard disk partitioning device and electronic equipment, so as to achieve the aim of reducing waste of storage resources in a hard disk. The specific technical scheme is as follows:
in a first aspect, an embodiment of the present application provides a hard disk partitioning method, where the method includes:
detecting whether each hard disk connected with the current equipment comprises a recording partition or not;
when the number of the hard disks containing the recording partition is N, selecting N-1 hard disks from the hard disks containing the recording partition to obtain each hard disk to be released, wherein N is an integer greater than 1;
and dividing the recording partition in each hard disk to be released into data partitions.
Optionally, the hard disk partitioning method in the embodiment of the present application further includes:
when each hard disk does not contain a recording partition, selecting a hard disk with a residual space not smaller than a preset recording space from each hard disk to obtain a target hard disk, wherein the preset recording space is a space required by the recording partition;
and dividing the recording partition in the target hard disk.
Optionally, the hard disk partitioning method in the embodiment of the present application further includes:
detecting whether other hard disks connected by the current equipment except the appointed hard disk contain a recording partition or not when a formatting instruction aiming at the appointed hard disk is acquired;
dividing the appointed hard disk into a data partition and a recording partition when the other hard disks do not comprise the recording partition;
and initializing the appointed hard disk as the hard disk of the data partition when the other hard disk comprises the recording partition.
Optionally, when the hard disks do not include the recording partition, selecting a hard disk with a remaining space not smaller than a preset recording space from the hard disks to obtain a target hard disk, including:
when the hard disks do not contain the recording partition, selecting a hard disk with the residual space not smaller than the preset recording space from the hard disks which are obtained through formatting and comprise the data partition but not the recording partition, and obtaining the target hard disk.
Optionally, the dividing the recording partition in the target hard disk includes:
updating the size of a data partition in the head information of the target hard disk partition according to the size of the recorded partition, updating the size of an index database in the head information of the target hard disk partition, updating the initial offset and the length of a related index, and updating the size of the data partition;
and dividing the recording partition in the target hard disk.
Optionally, the hard disk partitioning method in the embodiment of the present application further includes:
and updating the maximum video file number in the target hard disk partition head information according to the size of the recording partition.
In a second aspect, an embodiment of the present application provides a hard disk partition device, where the device includes:
the recording partition detection module is used for detecting whether each hard disk connected with the current equipment comprises a recording partition or not;
the hard disk to be released determining module is used for selecting N-1 hard disks from the hard disks containing the recording partition when the number of the hard disks containing the recording partition is N, so as to obtain each hard disk to be released, wherein N is an integer greater than 1;
and the recording partition release module is used for dividing the recording partition in each hard disk to be released into the data partition.
Optionally, the hard disk partition device of the embodiment of the present application further includes:
the target hard disk determining module is used for selecting a hard disk with a residual space not smaller than a preset recording space from each hard disk when each hard disk does not contain a recording partition, so as to obtain a target hard disk, wherein the preset recording space is a space required by the recording partition;
and the recording partition dividing module is used for dividing the recording partition in the target hard disk.
Optionally, the hard disk partition device of the embodiment of the present application further includes:
the hard disk partition detection module is used for detecting whether the other hard disks connected with the current equipment except the appointed hard disk contain a recording partition or not when a formatting instruction aiming at the appointed hard disk is acquired;
the first hard disk partition dividing module is used for dividing the appointed hard disk into a data partition and a recording partition when no recording partition is included in the other hard disks;
and the second hard disk partition dividing module is used for initializing the appointed hard disk into the hard disk with the data partition when the other hard disks comprise the recording partition.
Optionally, the target hard disk determining module is specifically configured to:
when the hard disks do not contain the recording partition, selecting a hard disk with the residual space not smaller than the preset recording space from the hard disks which are obtained through formatting and comprise the data partition but not the recording partition, and obtaining the target hard disk.
Optionally, the recording partition dividing module is specifically configured to:
updating the size of a data partition in the head information of the target hard disk partition according to the size of the recorded partition, updating the size of an index database in the head information of the target hard disk partition, updating the initial offset and the length of a related index, and updating the size of the data partition;
and dividing the recording partition in the target hard disk.
Optionally, the recording partition dividing module is further configured to: and updating the maximum video file number in the target hard disk partition head information according to the size of the recording partition.
In a third aspect, embodiments of the present application provide a host for video monitoring, including a processor and a memory;
the memory is used for storing a computer program;
the processor is configured to implement any one of the hard disk partition methods described in the first aspect when executing the program stored in the memory.
In a fourth aspect, embodiments of the present application provide a computer readable storage medium, where a computer program is stored, where the computer program when executed by a processor implements the hard disk partition method according to any one of the first aspects.
According to the hard disk partitioning method, the hard disk partitioning device and the electronic equipment, whether each hard disk connected with the current equipment comprises a recording partition or not is detected; when the number of the hard disks containing the recording partition is N, selecting N-1 hard disks from the hard disks containing the recording partition to obtain each hard disk to be released, wherein N is an integer greater than 1; and dividing the recording partition in each hard disk to be released into data partitions. Therefore, only one hard disk comprises the recording partition, and the waste of storage resources in the hard disk is reduced. Of course, not all of the above-described advantages need be achieved simultaneously in practicing any one of the products or methods of the present application.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a first schematic diagram of a hard disk partitioning method according to an embodiment of the present application;
FIG. 2 is a second schematic diagram of a hard disk partitioning method according to an embodiment of the present application;
FIG. 3 is a first schematic diagram of a hard disk partition according to an embodiment of the present application;
FIG. 4 is a second schematic diagram of a hard disk partition according to an embodiment of the present application;
FIG. 5 is a third schematic diagram of a hard disk partitioning method according to an embodiment of the present application;
FIG. 6 is a fourth schematic diagram of a hard disk partitioning method according to an embodiment of the present application;
FIG. 7 is a fifth schematic diagram of a hard disk partitioning method according to an embodiment of the present application;
FIG. 8 is a schematic diagram of a hard disk partition change according to an embodiment of the present application;
fig. 9 is a schematic diagram of a system that may be used for video surveillance according to an embodiment of the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are only some, but not all, of the embodiments of the present application. All other embodiments, which can be made by one of ordinary skill in the art without undue burden from the present disclosure, are within the scope of the present disclosure.
First, terms of art in the embodiments of the present application will be explained:
host computer that can be used for video monitoring: the High-Definition digital hard disk video recorder supports multichannel VGA (Video Graphics Array, video image array) and HDMI (High Definition Multimedia Interface, high-Definition multimedia interface) High-Definition video access, multichannel HD-SDI (High Definition-Serial Digital Interface, high-Definition digital component serial interface) camera access, multichannel High-Definition 1080P or 400W pixel network camera access, and realizes High-Definition video and audio real-time coding, video recording and recording with the highest resolution of 400W. The system can independently realize high-definition audio and video monitoring, and can also be networked to form a powerful security system so as to meet the requirements of video monitoring digitization, networking, high definition and intellectualization. The method can be widely applied to video monitoring in industries such as important meeting records and the like.
GUI (Graphical User Interface ): refers to a computer operated user interface that is displayed in a graphical manner.
In the related host computer for video monitoring, when the hard disk is formatted, a part of hard disk space is reserved as a recording partition for storing a recording buffer file, an I-frame index file, a TAG (TAG) file and a writing file, and specifically, the recording buffer file allocated for each optical drive is 17GB (Gigabyte). When no optical disc exists for a long time, if 1 recording buffer file is full, the 4GB (DVD) optical disc/17 GB (blue-ray optical disc) segment is marked as abnormal until a blank optical disc is detected, a backup recording mode is entered, and the abnormal segment is recorded in the optical disc in a backup way. At present, considering the subsequent expansion, several recording buffer files are allocated to each optical disc drive, for example, 4 optical disc drives are allocated to the number of the recording buffer files, so that each optical disc drive is required to be allocated to the maximum of 17 x 4 = 68GB space, two optical disc drives are 136GB, and the number of the hard disc spaces reserved for the I-frame index, the TAG and the recording file is required to be 136GB more, and considering the subsequent expansion, some optical disc drives can be reserved more, an integer is taken, and 150GB is reserved.
Since there may be multiple hard disks in the host available for video monitoring, and the user may pull out the hard disk that is already full of data during use for archiving, or evidence presentation, etc., and then replace it with a new unformatted hard disk. Because the recording function of the host computer used for video monitoring depends on the recording partition in the hard disk, the recording partition is allocated when the hard disk is formatted, so that any hard disk in the host computer used for video monitoring is taken away, and the normal operation of the recording function of the host computer used for video monitoring is not affected as long as at least one hard disk is reserved in the host computer used for video monitoring. However, this method has a disadvantage that the space of the data partition for storing data such as video is reduced, for example, four hard disks are available in the host for video monitoring, each hard disk has a capacity of 1TB, if the capacity of the recording partition is 150GB, the capacity of each hard disk for data partition is reduced by 150GB, and four hard disks are reduced by 600GB. .
In view of this, an embodiment of the present application provides a hard disk partitioning method, referring to fig. 1, the method includes:
s101, detecting whether each hard disk connected with the current equipment comprises a recording partition.
The hard disk partitioning method can be realized by an electronic device with an optical disk recording function, and specifically, the electronic device can be a host computer for video monitoring. In the following, a host computer usable for video monitoring is taken as an example to specifically describe the embodiment of the present application, it is to be understood that only the host computer usable for video monitoring is taken as an example to describe the embodiment of the present application, and any electronic device having an optical disc recording function may be used as a hardware main body for implementing the hard disc partitioning method of the embodiment of the present application.
When the preset detection conditions are met, a host machine capable of being used for video monitoring detects whether each hard disk connected with the host machine comprises a recording partition or not. The preset detection conditions can be set according to actual conditions, for example, the preset detection conditions are set to be that when a host machine which can be used for video monitoring is started each time, the host machine which can be used for video monitoring detects whether each hard disk connected with the host machine comprises a recording partition or not; or when each time the connected hard disk is detected to be pulled out, the host computer which can be used for video monitoring detects whether each hard disk connected with the host computer comprises a burning partition; or the host computer for video monitoring periodically triggers and detects whether each hard disk connected with the host computer comprises a recording partition or not according to a preset detection period.
S102, when the number of the hard disks comprising the recording partition is N, selecting N-1 hard disks from the hard disks comprising the recording partition to obtain each hard disk to be released, wherein N is an integer greater than 1;
for example, from the N hard disks including the recording partition, N-1 hard disks may be randomly selected as the hard disks to be released; or according to the interface number of the hard disk, selecting N-1 hard disks from N hard disks containing the recording partition according to the sequence of the interface number, and taking the N-1 hard disks as hard disks to be released and the like. Of course, other relevant selection methods may be adopted, and will not be described in detail herein.
S103, dividing the recording partitions in each hard disk to be released into data partitions.
In one possible implementation, the partition header information of the hard disk may be modified first, and the modification method of each item of content may be as shown in table 1.
TABLE 1
Figure GDA0002954522160000071
Then the index database is required to be rebuilt, and finally the recorded partition of the hard disk is deleted. In the whole process of dynamically recovering the recorded partition, the data such as the log, the video, the index, the event information and the like in the original data partition can not be destroyed, and the recorded partition can still be read and written normally after the dynamic recovery is finished. Specifically, a flow chart of dynamic recovery of the recording partition is shown in fig. 7.
In a possible implementation manner, the hard disk partitioning method of the embodiment of the present application further includes:
and A, when each hard disk does not contain a recording partition, selecting a hard disk with a residual space not smaller than a preset recording space from each hard disk to obtain a target hard disk, wherein the preset recording space is a space required by the recording partition.
The preset recording space is the space size required by the recording partition, and in one possible implementation, the preset recording space size is 150GB. When the host computer for video monitoring detects that the connected hard disks do not contain the recording partition, the residual storage space, namely the residual space, in the hard disks connected by the host computer for video monitoring is detected. And selecting a hard disk with the residual space not smaller than the preset recording space to obtain a target hard disk. For example, a hard disk with the largest remaining space can be selected as a target hard disk from the hard disks with the remaining space not smaller than the preset recording space; or randomly selecting one hard disk from the hard disks with the residual space not smaller than the preset recording space as a target hard disk; or sequentially detecting the size of the residual space of each hard disk according to the interface sequence, stopping continuous detection and taking the currently detected hard disk as a target hard disk when the currently detected residual space of the hard disk is not smaller than the preset recording space, and the like.
Typically, the hard disk connected to the host, which may be used for video monitoring, needs to be formatted for use, and in one possible embodiment, referring to fig. 2, the method further includes:
s201, when a formatting instruction for a specified hard disk is acquired, detecting whether the other hard disks connected with the current device except the specified hard disk contain a recording partition or not.
S202, dividing the appointed hard disk into a data partition and a recording partition when the other hard disks do not comprise the recording partition.
When the recording partition is not included in any other hard disk except the specified hard disk, which is connected to the host computer and can be used for video monitoring, the specified hard disk is divided into a data partition and a recording partition, for example, one possible hard disk partition may be as shown in fig. 3.
And S203, initializing the appointed hard disk as a hard disk of a data partition when the other hard disk comprises a recording partition.
When other hard disks include a recording partition, for example, as shown in fig. 4, the hard disk is designated to include a data partition after initialization, and not include a recording partition.
Specifically, the process of formatting the hard disk may include, as shown in fig. 5:
step one, a formatting instruction for a specified hard disk is acquired.
Step two, judging whether the current equipment is connected with only one hard disk, if the current equipment is connected with only one hard disk, executing step five, and if the current equipment is connected with at least two hard disks, executing step three.
And step three, judging whether other hard disks comprise the recording partition, if the other hard disks comprise the recording partition, executing the step four, and if the other hard disks do not comprise the recording partition, executing the step five.
Initializing the appointed hard disk as the hard disk of the data partition.
And fifthly, dividing the appointed hard disk into a data partition and a recording partition.
After the current device is started, when a certain hard disk is formatted, the hard disk may be a hard disk newly installed in the device, may be a hard disk used for a period of time, may be only the hard disk in the device, and may also be a plurality of hard disks. Firstly, judging whether the current equipment has only one hard disk, if so, directly formatting the hard disk into the hard disk with the recorded partition. If there are other hard disks in the current device, it is necessary to further determine whether at least one of the other hard disks already has a recording partition, if so, the hard disk to be formatted is formatted into a hard disk with only a data partition, and if not, the hard disk to be formatted into a hard disk with a recording partition.
For example, a user connects an unformatted hard disk 1 to a host that can be used for video monitoring, detects the hard disk 1 after the host that can be used for video monitoring is started, formats the hard disk 1, and when detecting that the hard disk 1 is the only hard disk in the device, generates a data partition and a recording partition when formatting the hard disk 1. The user connects an unformatted hard disk 2 to a host computer which can be used for video monitoring, detects the hard disk 2 after the host computer which can be used for video monitoring is started, formats the hard disk 2, and only generates a data partition and does not generate a recording partition when detecting that the host computer which can be used for video monitoring already has the hard disk 1 with the recording partition.
In view of the foregoing formatting manner, in one possible implementation manner, when the foregoing hard disks do not include a recording partition, selecting a hard disk with a remaining space not smaller than a preset recording space from the respective hard disks to obtain a target hard disk, where the method includes:
when the hard disks do not contain the recording partition, selecting a hard disk with the residual space not smaller than the preset recording space from the hard disks which are obtained by formatting and comprise the data partition but not the recording partition, and obtaining the target hard disk.
For example, the hard disk including the data partition but not including the recording partition obtained by formatting is called a pure data hard disk, and the pure data hard disk with the largest remaining space can be selected from the pure data hard disks with the remaining space not smaller than the preset recording space as the target hard disk; or randomly selecting a pure data hard disk from the pure data hard disks with the spare space not smaller than the preset recording space as a target hard disk; or sequentially detecting the residual space of each pure data hard disk according to the interface sequence, stopping continuous detection and taking the currently detected pure data hard disk as a target hard disk when the residual space of the currently detected pure data hard disk is not smaller than the preset recording space, and the like.
Specifically, the process of obtaining the target hard disk may be as shown in fig. 6, and includes:
step one, detecting that the current equipment is not connected with a hard disk containing a recording partition.
And step two, judging whether the current equipment is connected with a pure data hard disk which is obtained by formatting and comprises a data partition but does not comprise a recording partition, executing the step four if the current equipment is connected with the pure data hard disk, and executing the step three if the current equipment is not connected with the pure data hard disk.
And thirdly, prompting that the current equipment does not have a hard disk suitable for distributing the recording partition.
And step four, judging whether the pure data hard disk has a hard disk with the residual space not smaller than the preset recording space, if the pure data hard disk comprises the hard disk with the residual space not smaller than the preset recording space, executing step six, and if the pure data hard disk does not comprise the hard disk with the residual space not smaller than the preset recording space, executing step five.
And fifthly, prompting that the capacity of the hard disk in the current equipment is insufficient to allocate the recording partition, and requesting to replace or format the hard disk.
And step six, selecting a pure data hard disk with the residual space not smaller than the preset recording space to obtain a target hard disk.
If there are two or more hard disks in the present apparatus, according to the method for formatting hard disks, only one hard disk of these hard disks is a hard disk with a recording partition, and the other hard disks are hard disks without formatting or after formatting, do not include a recording partition. At this time, if the hard disk with the recording partition in the current device is pulled out, the hard disk with the recording partition does not exist, and the recording function cannot operate normally. The state of each hard disk needs to be monitored in the background, and when the hard disk with the recording partition is not available in the current equipment, a proper hard disk is selected from the rest hard disks to dynamically allocate the recording partition.
When the fact that the current device is not connected with the hard disk containing the recording partition is detected, whether the current device is connected with the hard disk which is obtained through formatting and comprises the data partition but does not comprise the recording partition (hereinafter referred to as a pure data hard disk) is detected, when the current device does not have the pure data hard disk, interface interaction service or network service is notified, and a client or a GUI is prompted that the hard disk which is suitable for distributing the recording partition is not available at present; if one or more pure data hard disks are detected in the current equipment, checking whether the residual space of the pure data hard disks is not smaller than the preset recording space (the space required by the recording partition) one by one according to the sequence of the hard disk numbers, and taking the first pure data hard disk meeting the condition as a target hard disk; if none of the pure data hard disks satisfies the condition, the interface interaction service or the network service is notified, and the client or the GUI is prompted to indicate that the capacity of the hard disk in the device is insufficient to allocate the recording partition, please format a hard disk, or replace a proper hard disk.
And B, dividing the recording partition in the target hard disk.
Selecting a region with a preset recording space size from the residual space of the target hard disk, dividing the region into recording partitions, and correspondingly modifying the header information of the target hard disk.
In one possible implementation manner, the dividing the recording partition in the target hard disk includes:
step one, according to the size of the recorded partition, updating the size of the data partition in the head information of the target hard disk partition, updating the size of an index database in the head information of the target hard disk partition, updating the initial offset and the length of the related index, and updating the size of the data partition.
The hard disk partition header information may further include a maximum number of video files, and in a possible implementation manner, the method further includes:
and updating the maximum video file number in the target hard disk partition head information according to the size of the recording partition.
First, the partition header information of the target hard disk is modified, and the updating method of each content can be shown in table 2.
TABLE 2
Figure GDA0002954522160000111
And step two, dividing the recording partition in the target hard disk.
Reconstructing the index database, and formatting the last part of storage space of the target hard disk into a recording partition. In the process of dynamically distributing the recording partition, the data such as the log, the video, the index, the event information and the like in the original data partition can not be destroyed, and the normal reading and writing can still be carried out after the dynamic distribution of the recording partition is finished.
If one hard disk with the recording partition exists in the current equipment, one or more hard disks with the recording partition are inserted at the moment, and a plurality of hard disks with the recording partition exist in the equipment. In order to reduce the waste of storage space, only one hard disk with a recording partition is reserved, and the recording partitions in the other hard disks with the recording partitions are recovered and distributed into the data partitions for recording.
The following illustrates a hard disk partitioning method according to an embodiment of the present application, and the hard disk partitioning process may be as shown in fig. 8. The hard disk connected to the host interface 1 for video monitoring is referred to as a hard disk 1, and the hard disk connected to the host interface 2 for video monitoring is referred to as a hard disk 2.
The user connects an unformatted hard disk to a host interface 1 which can be used for video monitoring, the host which can be used for video monitoring detects the hard disk 1 after starting, formats the hard disk 1, and when detecting that the hard disk 1 is the only hard disk in the device, generates a data partition and a recording partition when formatting the hard disk 1. The user connects an unformatted hard disk to a host interface 2 which can be used for video monitoring, the host which can be used for video monitoring detects the hard disk 2, formats the hard disk 2, and only generates a data partition and does not generate a recording partition when detecting that the host which can be used for video monitoring already has the hard disk 1 with the recording partition.
After a period of use, due to the needs of archiving or evidence displaying, etc., the user pulls out the hard disk 1, detects that the hard disk 2 is the only hard disk in the device, but does not have a recording partition, the recording function cannot be normally operated, at this time, dynamic allocation operation can be started, the space of the last unwritten data in the hard disk 2 is formatted, the recording partition is generated, and the operation cannot influence the recorded data such as video, log, event information, etc. in the data partition in the hard disk 2.
If a hard disk including the recording partition is inserted into the host interface 1 for video monitoring, when the number of the hard disks including the recording partition in the host for video monitoring is detected to be 2, the recording partition in the hard disk 2 is dynamically recovered.
The embodiment of the application also provides a hard disk partition device, which comprises:
the recording partition detection module is used for detecting whether each hard disk connected with the current equipment comprises a recording partition or not;
the hard disk to be released determining module is used for selecting N-1 hard disks from the hard disks containing the recording partition when the number of the hard disks containing the recording partition is N, so as to obtain each hard disk to be released, wherein N is an integer greater than 1;
and the recording partition release module is used for dividing the recording partition in each hard disk to be released into the data partition.
Optionally, the apparatus further includes:
the target hard disk determining module is used for selecting a hard disk with a residual space not smaller than a preset recording space from each hard disk when each hard disk does not contain a recording partition, so as to obtain a target hard disk, wherein the preset recording space is a space required by the recording partition;
and the recording partition dividing module is used for dividing the recording partition in the target hard disk.
Optionally, the apparatus further includes:
the hard disk partition detection module is used for detecting whether the other hard disks connected with the current equipment except the appointed hard disk contain a recording partition or not when a formatting instruction aiming at the appointed hard disk is acquired;
the first hard disk partition dividing module is used for dividing the appointed hard disk into a data partition and a recording partition when no recording partition is included in the other hard disks;
and the second hard disk partition dividing module is used for initializing the appointed hard disk into the hard disk with the data partition when the other hard disks comprise the recording partition.
Optionally, the target hard disk determining module is specifically configured to:
when the hard disks do not contain the recording partition, selecting a hard disk with the residual space not smaller than the preset recording space from the hard disks which are obtained through formatting and comprise the data partition but not the recording partition, and obtaining the target hard disk.
Optionally, the recording partition dividing module is specifically configured to:
updating the size of a data partition in the head information of the target hard disk partition according to the size of the recorded partition, updating the size of an index database in the head information of the target hard disk partition, updating the initial offset and the length of a related index, and updating the size of the data partition;
and dividing the recording partition in the target hard disk.
Optionally, the recording partition dividing module is further configured to: and updating the maximum video file number in the target hard disk partition head information according to the size of the recording partition.
The embodiment of the application also provides a host computer for video monitoring, which comprises a processor and a memory;
the memory is used for storing a computer program;
the processor is configured to implement the following steps when executing the program stored in the memory: .
Detecting whether each hard disk connected with the current equipment comprises a recording partition or not;
when the number of the hard disks containing the recording partition is N, selecting N-1 hard disks from the hard disks containing the recording partition to obtain each hard disk to be released, wherein N is an integer greater than 1;
and dividing the recording partition in each hard disk to be released into data partitions.
Optionally, the processor is configured to execute the computer program stored in the memory, and further implement any one of the hard disk partition methods.
The embodiment of the application also provides a system for video monitoring, which can be shown in fig. 9, and comprises an optical drive 001; a master control subsystem 002; a hard disk 003; an audio video processing subsystem 004; a remote control 005; GUI (Graphical User Interface ) 006; a buzzer 007 and an indicator lamp 008. The optical drive 001, the main control subsystem 002, the buzzer 007 and the indicator lamp 008 together form a host computer for video monitoring, the processor is specifically the main control subsystem 002, and the main control subsystem 002 implements any hard disk partition method during operation. Specifically, the main control subsystem 002 includes a storage service module, a recording service module, a network service module, an interface interaction module, a panel service module and a code stream data management module.
The communication bus mentioned for the above-mentioned electronic devices may be a PCI (Peripheral Component Interconnect, peripheral component interconnect standard) bus or an EISA (Extended Industry Standard Architecture ) bus, or the like. The communication bus may be classified as an address bus, a data bus, a control bus, or the like. For ease of illustration, the figures are shown with only one bold line, but not with only one bus or one type of bus.
The communication interface is used for communication between the electronic device and other devices.
The Memory may include RAM (Random Access Memory ) or NVM (Non-Volatile Memory), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the aforementioned processor.
The processor may be a general-purpose processor, including a CPU (Central Processing Unit ), NP (Network Processor, network processor), etc.; but also DSP (Digital Signal Processing, digital signal processor), ASIC (Application Specific Integrated Circuit ), FPGA (Field-Programmable Gate Array, field programmable gate array) or other programmable logic device, discrete gate or transistor logic device, discrete hardware components.
The embodiment of the application also provides a computer readable storage medium, wherein a computer program is stored in the computer readable storage medium, and when the computer program is executed by a processor, any hard disk partition method is realized.
It should be noted that, in this document, the technical features in each alternative may be combined to form a solution, so long as they are not contradictory, and all such solutions are within the scope of the disclosure of the present application. 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. Moreover, 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 one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
In this specification, each embodiment is described in a related manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments. In particular, for embodiments of the apparatus, electronic device and storage medium, the description is relatively simple as it is substantially similar to the method embodiments, where relevant see the section description of the method embodiments.
The foregoing description is only of the preferred embodiments of the present application and is not intended to limit the scope of the present application. Any modifications, equivalent substitutions, improvements, etc. that are within the spirit and principles of the present application are intended to be included within the scope of the present application.

Claims (14)

1. A method for partitioning a hard disk, the method comprising:
detecting whether each hard disk connected with the current equipment comprises a recording partition or not;
when the number of the hard disks containing the recording partition is N, selecting N-1 hard disks from the hard disks containing the recording partition to obtain each hard disk to be released, wherein N is an integer greater than 1;
and dividing the recording partition in each hard disk to be released into data partitions.
2. The method according to claim 1, wherein the method further comprises:
when each hard disk does not contain a recording partition, selecting a hard disk with a residual space not smaller than a preset recording space from each hard disk to obtain a target hard disk, wherein the preset recording space is a space required by the recording partition;
and dividing the recording partition in the target hard disk.
3. The method according to claim 1, wherein the method further comprises:
detecting whether other hard disks connected by the current equipment except the appointed hard disk contain a recording partition or not when a formatting instruction aiming at the appointed hard disk is acquired;
dividing the appointed hard disk into a data partition and a recording partition when the other hard disks do not comprise the recording partition;
and initializing the appointed hard disk as the hard disk of the data partition when the other hard disk comprises the recording partition.
4. The method according to claim 2, wherein when none of the hard disks includes a recording partition, selecting a hard disk having a remaining space not smaller than a predetermined recording space from among the hard disks to obtain a target hard disk, comprising:
when the hard disks do not contain the recording partition, selecting a hard disk with the residual space not smaller than the preset recording space from the hard disks which are obtained through formatting and comprise the data partition but not the recording partition, and obtaining the target hard disk.
5. The method of claim 2 or 4, wherein the dividing the recording partition in the target hard disk includes:
updating the size of a data partition in the head information of the target hard disk partition according to the size of the recorded partition, updating the size of an index database in the head information of the target hard disk partition, updating the initial offset and the length of a related index, and updating the size of the data partition;
and dividing the recording partition in the target hard disk.
6. The method of claim 5, wherein the method further comprises:
and updating the maximum video file number in the target hard disk partition head information according to the size of the recording partition.
7. A hard disk partitioning apparatus, said apparatus comprising:
the recording partition detection module is used for detecting whether each hard disk connected with the current equipment comprises a recording partition or not;
the hard disk to be released determining module is used for selecting N-1 hard disks from the hard disks containing the recording partition when the number of the hard disks containing the recording partition is N, so as to obtain each hard disk to be released, wherein N is an integer greater than 1;
and the recording partition release module is used for dividing the recording partition in each hard disk to be released into the data partition.
8. The apparatus of claim 7, wherein the apparatus further comprises:
the target hard disk determining module is used for selecting a hard disk with a residual space not smaller than a preset recording space from each hard disk when each hard disk does not contain a recording partition, so as to obtain a target hard disk, wherein the preset recording space is a space required by the recording partition;
and the recording partition dividing module is used for dividing the recording partition in the target hard disk.
9. The apparatus of claim 7, wherein the apparatus further comprises:
the hard disk partition detection module is used for detecting whether the other hard disks connected with the current equipment except the appointed hard disk contain a recording partition or not when a formatting instruction aiming at the appointed hard disk is acquired;
the first hard disk partition dividing module is used for dividing the appointed hard disk into a data partition and a recording partition when no recording partition is included in the other hard disks;
and the second hard disk partition dividing module is used for initializing the appointed hard disk into the hard disk with the data partition when the other hard disks comprise the recording partition.
10. The apparatus of claim 8, wherein the target hard disk determination module is specifically configured to:
when the hard disks do not contain the recording partition, selecting a hard disk with the residual space not smaller than the preset recording space from the hard disks which are obtained through formatting and comprise the data partition but not the recording partition, and obtaining the target hard disk.
11. The apparatus according to claim 8 or 10, wherein the recording partition dividing module is specifically configured to:
updating the size of a data partition in the head information of the target hard disk partition according to the size of the recorded partition, updating the size of an index database in the head information of the target hard disk partition, updating the initial offset and the length of a related index, and updating the size of the data partition;
and dividing the recording partition in the target hard disk.
12. The apparatus of claim 11, wherein the recording partition partitioning module is further configured to: and updating the maximum video file number in the target hard disk partition head information according to the size of the recording partition.
13. A host computer for video monitoring, which is characterized by comprising a processor and a memory;
the memory is used for storing a computer program;
the processor is configured to implement the hard disk partitioning method according to any one of claims 1 to 6 when executing the program stored in the memory.
14. A computer readable storage medium, characterized in that the computer readable storage medium has stored therein a computer program which, when executed by a processor, implements the hard disk partition method of any one of claims 1-6.
CN201910721949.3A 2019-08-06 2019-08-06 Hard disk partitioning method and device and electronic equipment Active CN112346648B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910721949.3A CN112346648B (en) 2019-08-06 2019-08-06 Hard disk partitioning method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910721949.3A CN112346648B (en) 2019-08-06 2019-08-06 Hard disk partitioning method and device and electronic equipment

Publications (2)

Publication Number Publication Date
CN112346648A CN112346648A (en) 2021-02-09
CN112346648B true CN112346648B (en) 2023-05-02

Family

ID=74367099

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910721949.3A Active CN112346648B (en) 2019-08-06 2019-08-06 Hard disk partitioning method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN112346648B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101409098A (en) * 2008-11-12 2009-04-15 杭州海康威视数字技术股份有限公司 Method for implementing real time CD-RW of digital HD video recorder
CN103678025A (en) * 2013-12-02 2014-03-26 创新科软件技术(深圳)有限公司 Method for processing disk failures of redundant arrays of independent disks

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7216251B2 (en) * 2000-02-19 2007-05-08 Powerquest Corporation Computer imaging recovery without a working partition or a secondary medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101409098A (en) * 2008-11-12 2009-04-15 杭州海康威视数字技术股份有限公司 Method for implementing real time CD-RW of digital HD video recorder
CN103678025A (en) * 2013-12-02 2014-03-26 创新科软件技术(深圳)有限公司 Method for processing disk failures of redundant arrays of independent disks

Also Published As

Publication number Publication date
CN112346648A (en) 2021-02-09

Similar Documents

Publication Publication Date Title
JP4744569B2 (en) Recording method and reproducing method suitable for recording / reproducing AV data, recording drive and reproducing drive thereof, information recording system, information reproducing system, and information recording medium
US8533417B2 (en) Method and apparatus for controlling data volume creation in data storage system with dynamic chunk allocation capability
US20060075293A1 (en) Pre-configured backup dvd-rws
US9152547B2 (en) Apparatus and method for scratch pad memory management
US20170132247A1 (en) Support for worm cartridges realized by linear tape file system (ltfs)
JP3595551B1 (en) Information recording apparatus, information recording method, and program
US8478109B2 (en) Recording apparatus and method, program, and storage medium
CN112346648B (en) Hard disk partitioning method and device and electronic equipment
JP2003203434A (en) System and method for configuring a removable storage medium
CN109508140B (en) Storage resource management method and device, electronic equipment and system
US20080226264A1 (en) Recording medium handling apparatus and method
JPWO2008146473A1 (en) Formatting device
JP5301666B2 (en) Data recording apparatus and audio system
US20080056674A1 (en) Data recording and recovery method for an optical storage medium and computer-readable storage medium using the method
US20140181237A1 (en) Server and method for storing data
JP3920813B2 (en) Electronic information recording device
CN117785070B (en) Data storage control method and device
US20090304364A1 (en) Digital video recorder and hard disc management method
JP5023003B2 (en) Metadata management method and data recording apparatus
JP7438528B2 (en) System and program
JP4687500B2 (en) Optical disc recording apparatus and optical disc recording method
US20080005756A1 (en) Recording of Data with Special Storage Space Requirements on a Storage Medium
JP4277707B2 (en) Information recording method
JP2010135034A (en) Information recording/reproducing device
JP6407417B2 (en) CONTENT REPRODUCTION DEVICE AND CONTENT REPRODUCTION DEVICE CONTROL METHOD

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