CN103777893B - hard disk control method and device - Google Patents

hard disk control method and device Download PDF

Info

Publication number
CN103777893B
CN103777893B CN201210395262.3A CN201210395262A CN103777893B CN 103777893 B CN103777893 B CN 103777893B CN 201210395262 A CN201210395262 A CN 201210395262A CN 103777893 B CN103777893 B CN 103777893B
Authority
CN
China
Prior art keywords
hard disk
wake
states
deep sleep
sleep state
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
CN201210395262.3A
Other languages
Chinese (zh)
Other versions
CN103777893A (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.)
Shenzhen Yanxiang Smart Technology Co ltd
Original Assignee
EVOC Intelligent 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 EVOC Intelligent Technology Co Ltd filed Critical EVOC Intelligent Technology Co Ltd
Priority to CN201210395262.3A priority Critical patent/CN103777893B/en
Publication of CN103777893A publication Critical patent/CN103777893A/en
Application granted granted Critical
Publication of CN103777893B publication Critical patent/CN103777893B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

A kind of hard disk control method, includes the following steps:Set data record path to one piece of hard disk at least two pieces of hard disks;Remaining hard disk for not being set as data record path at least two pieces of hard disks described in control enters deep sleep state;Cycle executes following steps:Execute countdown instruction;One of hard disk in deep sleep state is controlled at the end of countdown enters wake-up states;It sets the data record path to the hard disk into wake-up states, and records data in the hard disk into wake-up states from next write instruction;Determine whether that no data are written to previous piece of hard disk of the hard disk into wake-up states for being arranged to data record path, if so, the control previous piece of hard disk enters deep sleep state.Also provided is a kind of hard disk control devices.Above-mentioned hard disk control method and device so control multiple hard disks and work alternatively, extend the service life of hard disk.

Description

Hard disk control method and device
Technical field
The present invention relates to computer control fields, more particularly to a kind of hard disk control method and device.
Background technology
Hard disk is broadly divided into common hard disc and wide warm hard disk as storage device is commonly used.Common hard disc normal working hours It is to work for continuous 5 days, daily continuous work 8 hours;Wide temperature hard disk to its internal mechanical structure, is changed on the basis of common hard disc Material, electronic device have done specially treated, thus it can be operated in broader temperature range.With regard to hard disk design feature and Speech, it is internal that there is very accurate Design of Mechanical Structure, collocation control chip and control software, it records data to high speed and revolves On the disk turned.
It counts by mass data, when its working time of common hard disc is more than 5 × 8 specification, can occur at random certain not true Determine failure, such as data read-write error, hard disk controller abnormal state, causes data transmission unstable, unreliable.So when (common hard disc is such as applied to intelligent transportation industry when needing to use common hard disc as video monitoring data record storage equipment On bayonet industrial personal computer), 24 hours uninterrupted continuous works are generally required, until periodic maintenance maintenance, stream time Inherently far beyond its specification, hard disk life-span is reduced, or even cause application and trouble.
Invention content
Based on this, it is necessary to provide a kind of hard disk control method that can extend common hard disc service life.
A kind of hard disk control device that can extend common hard disc service life is provided in addition, there is a need to.
A kind of hard disk control method, includes the following steps:
Set data record path to one piece of hard disk at least two pieces of hard disks;
Remaining hard disk for not being set as data record path at least two pieces of hard disks described in control enters deep sleep state;
Execute countdown instruction;
One of hard disk in deep sleep state is controlled at the end of countdown enters wake-up states;
Set the data record path to the hard disk into wake-up states, and from next write instruction by Data are recorded in the hard disk into wake-up states;
Determine whether that no data are written to the hard disk into wake-up states for being arranged to data record path Previous piece of hard disk, if so, the control previous piece of hard disk enters deep sleep state.
The one piece of hard disk in one of the embodiments, set data record path to described at least two pieces of hard disks The step of before, further include step:
The state of at least two pieces hard disks, judges whether to work normally, if so, data record path is arranged described in reading It is one piece of hard disk at least two pieces of hard disks, otherwise reboot operation system.
It is not set as its of data record path at least two pieces of hard disks described in the control in one of the embodiments, After the step of remaining hard disk enters deep sleep state, further include:
The status register value for reading remaining hard disk, judges whether remaining described hard disk enters deep sleep state, If so, execute countdown instruction, if it is not, then control does not enter remaining hard disk of deep sleep state and is resetted, then again Hard disk after control resets enters deep sleep state.
The control at the end of countdown is described therein in deep sleep state in one of the embodiments, Further include step after the step of one piece of hard disk enters wake-up states:
The status register value for reading the hard disk into wake-up states, judge described be into the hard disk of wake-up states It is no to enter normal operating conditions, if so, set the data record path to the hard disk into wake-up states, if It is no, then the hard disk into wake-up states is resetted, then sets the data record path to the entrance again The hard disk of wake-up states.
The control at the end of countdown is described in one of the embodiments, is in wherein the one of deep sleep state Further include step after the step of block hard disk enters wake-up states:
Tentation data, and verification data is written to the hard disk into wake-up states;
Judge whether verification passes through, if so, the data record path is set as described into the hard of wake-up states Disk, if it is not, then re-writing wake-up instruction to the hard disk into wake-up states.
A kind of hard disk control device, including:
Path setup module, one piece of hard disk for setting data record path at least two pieces of hard disks;
Suspend mode control module, for controlling remaining hard disk for not being set as data record path at least two pieces of hard disks Into deep sleep state;
Timing module, for executing countdown instruction;
Wake-up module enters for controlling one of hard disk in deep sleep state at the end of countdown Wake-up states;
The path setup module is additionally operable to set the data record path to the hard disk into wake-up states, And the hard disk into wake-up states is recorded data in from next write instruction;
Judgment module is written in data, is arranged to described in data record path for determining whether that no data are written to Into previous piece of hard disk of the hard disk of wake-up states;
The suspend mode control module, which is additionally operable to be written in the no data of judgement, to be arranged to described in data record path Into the hard disk of wake-up states previous piece of hard disk when, control the previous piece of hard disk and enter deep sleep state, it is then described Timing module, wake-up module, path setup module, data write-in judgment module execute successively.
Further include in one of the embodiments,:
First state judgment module, the state for reading at least two pieces hard disks, judges whether to work normally;
The path setup module is additionally operable to, when judging at least two pieces of hard disk normal works, data record path be set One piece of hard disk being set at least two pieces of hard disks;
Restart module, for when judging that at least two pieces of hard disks do not work normally, reboot operation system.
Further include in one of the embodiments,:
Dormant state judgment module, the status register value for reading remaining hard disk judge remaining described hard disk Whether deep sleep state is entered;
The timing module is additionally operable to, when judging that remaining described hard disk enters deep sleep state, execute countdown and refer to It enables;
First reseting module, when not entering deep sleep state for remaining hard disk described in judging, then to not entering Remaining hard disk of deep sleep state is resetted;
The suspend mode control module is additionally operable to the hard disk after control resets and enters deep sleep state.
Further include in one of the embodiments,:
Second condition judgment module, the status register value for reading the hard disk into wake-up states, judges institute Whether the hard disk stated into wake-up states enters normal operating conditions;
The path setup module is additionally operable to judging described to enter normal operating conditions into the hard disk of wake-up states When, set the data record path to the hard disk into wake-up states;
Second reseting module, for judge it is described do not enter normal operating conditions into the hard disk of wake-up states when, The hard disk into wake-up states is resetted, then the path setup module sets the data record path to The hard disk into wake-up states.
Further include in one of the embodiments,:
Correction verification module for tentation data, and verification data to be written to the hard disk into wake-up states, and judges school It tests and whether passes through;
When the path setup module is additionally operable to judge that verification passes through, it sets the data record path to the entrance The hard disk of wake-up states;
The wake-up module be additionally operable to verification not by when, wake-up is re-write to the hard disk into wake-up states Instruction.
Above-mentioned hard disk control method and device are used as data record road by one piece of hard disk being arranged at least two pieces of hard disks Diameter controls remaining hard disk and enters deep sleep state, and timing, and timing time arrives, and wakes up one piece and is in deep sleep state Hard disk is set as data record path, and original in running order hard disk controlling is entered deep sleep state, is so controlled Multiple hard disks work alternatively, and extend the service life of hard disk, and judge originally in running order hard of no data write-in Disk just controls it and enters deep sleep state, it is ensured that when switching hard disk, does not lose data.
Description of the drawings
Fig. 1 is the flow diagram of hard disk control method in one embodiment;
Fig. 2 is the flow diagram of the hard disk control method by taking two pieces of hard disks as an example;
Fig. 3 is the internal structure schematic diagram of hard disk control device in one embodiment;
Fig. 4 is the internal structure schematic diagram of hard disk control device in another embodiment;
Fig. 5 is the internal structure schematic diagram of hard disk control device in another embodiment;
Fig. 6 is that the application schematic diagram on south bridge is arranged in hard disk control device.
Specific implementation mode
Detailed retouch is carried out to the technical solution of hard disk control method and device with reference to specific embodiment and attached drawing It states, so that it is clearer.
As shown in Figure 1, in one embodiment, a kind of hard disk control method includes the following steps:
Step S110 sets data record path to one piece of hard disk at least two pieces of hard disks.
Specifically, at least two pieces of hard disks can be two pieces, three pieces or more hard disks etc..Select wherein any one piece of hard disk as number According to the hard disk of record path.For example, at least two pieces of hard disks are hard disk A, hard disk B and disk C, data record path is set as hard Disk A.Refer to that data record path is set as a certain hard by one piece of hard disk that data record path is set as at least two pieces of hard disks Disk drive, such as disk identifier of hard disk A.After data record path is set, subsequently data are stored to the hard disk as data record path.
In a preferred embodiment, in order to ensure operating system long-term stable operation, the hard disk control in the present embodiment Before method processed executes, first operating system is mounted in solid-state electronic disk, selects at least two pieces of common hard discs as video, figure The equipment of piece or text data store record.Certainly, also operating system can be mounted on CF cards or other reading-writing life-spans is longer Storage device in, the hard disk control method in the embodiment of the present invention be for as video, picture or text data store note What the common hard disc of record was controlled.
Secondly, start-up operation system reads the shape of at least two pieces hard disks of state, in particular to reading of at least two pieces hard disks The value of state register judges whether at least two pieces of hard disks work normally, if so, by data record by the value of status register Path is set as one piece of hard disk at least two pieces of hard disks, otherwise reboot operation system.Specifically, normal work refers to that hard disk can Normal operation can carry out accurately reading from hard disk or data are written, and can be controlled.
Step S120 is controlled and is not set as remaining hard disk in data record path at least two pieces of hard disks and enters deep-sleep State.
Specifically, selecting one of hard disk then to can control as the hard disk in data record path at least two pieces of hard disks Remaining hard disk enters deep sleep state so that only needs a hard disk in running order.By the way that suspend mode is written to remaining hard disk Instruction, controls remaining hard disk and enters deep sleep state.It can be toward remaining hard disk controlling chip power management that dormancy instruction, which is written, Value is write in register.Then hard disk is controlled according to the value of write-in and enters deep sleep state.Hard disk in deep sleep state It does not operate, does not carry out data read-write operation, extend the service life of hard disk.
In one embodiment, further include step after step S120:The status register value of remaining hard disk is read, Judge whether remaining hard disk enters deep sleep state, if so, countdown instruction is executed, if it is not, then stopping to not entering depth Remaining hard disk of dormancy state is resetted, and is then controlled the hard disk after resetting again and is entered deep sleep state.
Deep sleep state, Status register are indicated specifically, can preset when status register value is first predetermined value Wake-up states etc. are indicated when device value is second predetermined value.The status register value for reading hard disk, by the status register value of reading Compared with first predetermined value, if identical, then it represents that hard disk enters deep sleep state.
Reset instruction is written into remaining hard disk for not entering deep sleep state, it is answered according to reset instruction Position.Hard disk reset refers to restarting hard disk, becomes init state, which refers to that hard disk is in normal work shape State.Specifically, normal operating conditions refer to hard disk can normal operation, can carry out accurately reading or being written data, and energy from hard disk It is controlled.
Step S130 executes countdown instruction.
Specifically, the time of countdown can be arranged according to practical application, such as grade within 7 hours 50, but not limited to this.Countdown Time be less than the normal working hours that hard disk allows, the permission working time of such as common hard disc is 8 hours, and count down time is 7 hours 50 points.
Step S140, one of hard disk of the control in deep sleep state enters wake-up shape at the end of countdown State.
Specifically, timing time arrives, one of hard disk in remaining hard disk need to only be waken up, as data record path New hard disk, other hard disks, still in deep sleep state, can extend the service life of hard disk by it.By stopping to being in depth One of hard disk write-in of dormancy state, which wakes up, to be instructed, and instructs the hard disk that control write-in wake-up instructs from deep-sleep according to wake-up State enters wake-up states.It, can be toward the electricity of the control chip of one of hard disk in deep sleep state in the present embodiment Value is write in source control register, the hard disk is waken up according to value is write.
In one embodiment, after step s 140, further include step:Read the state into the hard disk of wake-up states Register value judges whether the hard disk into wake-up states enters normal operating conditions, if so, data record path is arranged Enter the hard disk of wake-up states for this, if it is not, then resetting the hard disk for entering wake-up states, then again by data record road Diameter is set as the hard disk into wake-up states.
Specifically, the status register value of hard disk is read, by the status register value of reading compared with second predetermined value, if It is identical, then it represents that hard disk enters normal operating conditions.Reset instruction is written to the hard disk for entering wake-up states, according to reset instruction It is resetted.Hard disk reset refers to restarting hard disk, becomes init state, which refers to that hard disk is in just Normal working condition.When hard disk is to be waken up into normal operating conditions, it can be used and hard disk is resetted, make it into normal Working condition, the hard disk to be guaranteed at deep sleep state are waken up, it is ensured that have the hard disk of wake-up to be fallen instead of continue working The hard disk of timing time.
Further, in one embodiment, after step s 140, further include step:To the hard of entrance wake-up states Tentation data, and verification data is written in disk;Judge whether verification passes through, is called out if so, data record path is set as entering The hard disk for the state of waking up, if it is not, then re-writing wake-up instruction to the hard disk for entering wake-up states.
Specifically, tentation data can be selected as needed, verify whether the tentation data is correct, can avoid wake-up states There is unstable, reinforcement data record reliability in hard-disc storage data.
Step S150 sets data record path to the hard disk into wake-up states, and refers to from next write-in It has enabled and has recorded data in the hard disk into wake-up states.
Specifically, setting into after the hard disk of wake-up states data record path to, new write instruction is executed, will be counted According to being recorded in on the hard disk of wake-up states.
Step S160 determines whether that no data are written to and is arranged to the described into wake-up states of data record path Previous piece of hard disk, if so, execute step S170, if it is not, return to step S160.
For example, data record path is set as hard disk A first, between countdown at the end of, control is in deep sleep state Hard disk B enter wake-up states, and data record path is set to hard disk B, then hard disk A is to be arranged to data record road The previous piece of hard disk of the hard disk B of diameter.
Step S170, previous piece of hard disk of control enter deep sleep state.
Specifically, when judging that previous piece of hard disk is written in no data, which is entered into deep-sleep shape State so that previous piece of hard disk is in resting state, extends the service life of previous piece of hard disk.Judge that no data are written previous piece Hard disk can avoid switching hard disk and data storage caused to omit.
Cycle executes above-mentioned steps S130 to step S170.
Above-mentioned hard disk control method is used as data record path by one piece of hard disk being arranged at least two pieces of hard disks, is controlled It makes remaining hard disk and enters deep sleep state, and timing, timing time arrives, and wakes up one piece of hard disk in deep sleep state and sets It is set to data record path, original in running order hard disk controlling is entered into deep sleep state, is so controlled multiple hard Disk works alternatively, and extends the service life of hard disk, and after judging the original in running order hard disk of no data write-in, It controls it and enters deep sleep state, it is ensured that when switching hard disk, do not lose data.
As shown in Fig. 2, in one embodiment, by taking two pieces of hard disks (hard disk A and hard disk B) as an example, hard disk control is described in detail The work step of method processed, specifically includes:
Step S201, booting/reboot operation system, and start hard disk management program.
Specifically, hard disk management program is hard disk controlling software, for realizing above-mentioned hard disk control method.
Step S203, whether two pieces of hard disks of detection work normally, if so, step S205 is executed, if it is not, return to step S201。
Specifically, two pieces of hard disks normal work refer to hard disk can normal operation, can carry out accurately reading or being written from hard disk Data, and can be controlled.The value for specifically referring to read the status register of two pieces of hard disks is judged by the value of status register Whether two pieces of hard disks work normally.
Step S205 sets data record path to hard disk A, and starts to store data to hard disk A.Step S207, Control hard disk B enters deep sleep state.
Specifically, dormancy instruction is written to hard disk B, controlling hard disk B according to dormancy instruction enters deep sleep state.
Step S209, judges whether hard disk B enters deep sleep state, if so, S213 is thened follow the steps, if it is not, then holding Row step S211.
Step S211 resets hard disk B, returns again to step S207.
Specifically, reset instruction is written to hard disk B, hard disk B is resetted according to reset instruction.
Step S213 executes countdown instruction.
Step S215, judges whether countdown terminates, if so, thening follow the steps S217, otherwise continues to execute step S215.
Step S217 wakes up instruction to hard disk B write-ins.
Step S219, judges whether hard disk B enters normal operating conditions, if so, S223 is thened follow the steps, if it is not, then holding Row step S221.
Step S221 resets hard disk B.
Specifically, reset instruction is written to hard disk B, hard disk B is resetted according to reset instruction.
A string of tentation datas and verification data are written to hard disk B in step S223.
Step S225, judge hard disk B whether can normal recordings data, if so, then follow the steps S227, otherwise return to step S217。
Step S227 sets data record path to hard disk B, hard disk is recorded data in from next write instruction B.Step S229 determines whether that hard disk A is written in no data, if so, step S231 is executed, if it is not, return to step S229.
Step S231, control hard disk A enter deep sleep state.
Specifically, dormancy instruction is written to hard disk A, controlling hard disk A according to dormancy instruction enters deep sleep state.
Step S233, judges whether hard disk A enters deep sleep state, if so, S237 is thened follow the steps, if it is not, executing Step S235.
Step S235 resets hard disk A, returns again to step S231.
Specifically, reset instruction is written to hard disk A, hard disk A is resetted according to reset instruction.
Step S237 executes countdown instruction.
Step S239, judges whether countdown terminates, if so, executing step S241, otherwise return to step S239.
Step S241 wakes up instruction to hard disk A write-ins.
Step S243, judges whether hard disk A enters normal operating conditions, if so, step S247 is executed, if it is not, executing step Rapid S245.
Step S245 resets hard disk A.
Specifically, reset instruction is written to hard disk A, hard disk A is resetted according to reset instruction.
A string of tentation datas and verification data are written to hard disk A in step S247.
Step S249, judge hard disk A whether can normal recordings data, if so, execute step S251, if it is not, execute step S241。
Step S251 sets data record path to hard disk A, hard disk is recorded data in from next write instruction A。
Step S253 determines whether that hard disk B is written in no data, if return to step S207, if it is not, then return to step S253。
Above-mentioned hard disk control method is worked alternatively by using two pieces of hard disks, both ensure that data record stored, and had also been ensured Hard disk works within normal working hours, extends the service life of hard disk, and judges no original place of data write-in It after the hard disk of working condition, just controls it and enters deep sleep state, it is ensured that when switching hard disk, do not lose data.
As shown in figure 3, in one embodiment, a kind of hard disk control device, including path setup module 110, suspend mode control Judgment module 150 is written in molding block 120, timing module 130, wake-up module 140 and data.Wherein:
One piece of hard disk that path setup module 110 is used to set data record path at least two pieces of hard disks.
Specifically, at least two pieces of hard disks can be two pieces, three pieces or more hard disks etc..Select wherein any one piece of hard disk as number According to the hard disk of record path.For example, at least two pieces of hard disks are hard disk A, hard disk B and disk C, data record path is set as hard Disk A.Refer to that data record path is set as a certain hard by one piece of hard disk that data record path is set as at least two pieces of hard disks Disk drive, such as disk identifier of hard disk A.After data record path is set, subsequently data are stored to the hard disk as data record path.
It, first will behaviour before the hard disk control device work in the present embodiment in order to ensure operating system long-term stable operation Make system in solid-state electronic disk, at least two pieces of common hard discs is selected to be recorded as video, picture or text data store Equipment.Certainly, operating system can be also mounted in CF cards or the longer storage device of other reading-writing life-spans, the present invention is real Applying the hard disk control device in example is controlled for the common hard disc recorded as video, picture or text data store 's.Secondly, start-up operation system reads the state of at least two pieces hard disks, judges whether at least two pieces of hard disks work normally, if It is then to set data record path to one piece of hard disk at least two pieces of hard disks, otherwise reboot operation system.Specifically, just Often work refer to hard disk can normal operation, can carry out accurately reading or being written data from hard disk, and can be controlled.
Suspend mode control module 120 be used to control be not set as at least two pieces of hard disks remaining hard disk in data record path into Enter deep sleep state.
Specifically, selecting one of hard disk as the hard disk in data record path, then suspend mode control at least two pieces of hard disks Molding block 120 can control remaining hard disk to enter deep sleep state so that only need a hard disk in running order.By to its Dormancy instruction is written in remaining hard disk, controls remaining hard disk and enters deep sleep state.It can be toward remaining hard disk control that dormancy instruction, which is written, Value is write in coremaking piece power management registers.Then hard disk is controlled according to the value of write-in and enters deep sleep state.In depth The hard disk of dormant state does not operate, and does not carry out data read-write operation, extends the service life of hard disk.
Timing module 130 is for executing countdown instruction.Specifically, the time of countdown can be arranged according to practical application, If graded within 7 hours 50, but not limited to this.The time of countdown is less than the normal working hours that hard disk allows, such as common hard disc Allow the working time be 8 hours, count down time be 7 hours 50 points.
Wake-up module 140 terminates for countdown, enters wake-up shape to one of hard disk in deep sleep state State.
Specifically, timing time arrives, one of hard disk in remaining hard disk need to only be waken up, as data record path New hard disk, other hard disks, still in deep sleep state, can extend the service life of hard disk by it.By stopping to being in depth One of hard disk write-in of dormancy state, which wakes up, to be instructed, and instructs the hard disk that control write-in wake-up instructs from deep-sleep according to wake-up State enters wake-up states.In the present embodiment, wake-up module 140 can be toward the control of one of hard disk in deep sleep state Value is write in the power management registers of coremaking piece, the hard disk is waken up according to value is write.
Path setup module 110 is additionally operable to set the data record path to hard disk into wake-up states, and from Next write command acts the hard disk recorded data into wake-up states.
Data write-in judgment module 150 is for determining whether that no data are written to the institute for being arranged to data record path State the previous piece of hard disk into wake-up states.
For example, data record path is set as hard disk A first, between countdown at the end of, control is in deep sleep state Hard disk B enter wake-up states, and data record path is set to hard disk B, then hard disk A is to be arranged to data record road The previous piece of hard disk of the hard disk B of diameter.
Suspend mode control module 120 be additionally operable to judge no data be written to be arranged to described in data record path into When entering previous piece of hard disk of wake-up states, previous piece of hard disk of control enters deep sleep state, then timing module 130, wake-up Module 140, path setup module 110, data write-in judgment module 150 execute successively.
Specifically, when judging that previous piece of hard disk is written in no data, which is entered into deep-sleep shape State so that previous piece of hard disk is in resting state, extends the service life of previous piece of hard disk.Judge that no data are written previous piece Hard disk can avoid switching hard disk and data storage caused to omit.
One piece of hard disk at least two pieces of hard disks is arranged as data in above-mentioned hard disk control device, path setup module 110 Record path, suspend mode control module 120 control remaining hard disk and enter deep sleep state, 130 timing of timing module, timing time It arrives, wake-up module 140 wakes up one piece of hard disk for being in deep sleep state, and path setup module 110 sets the hard disk of wake-up It is set to data record path, original in running order hard disk controlling is entered deep sleep state by suspend mode control module 120, It so controls multiple hard disks to work alternatively, extends the service life of hard disk, and judge that no data write-in is in work originally The hard disk of state just controls it and enters deep sleep state, it is ensured that when switching hard disk, does not lose data.
As shown in figure 4, in one embodiment, above-mentioned hard disk control device, in addition to including path setup module 110, stopping Judgment module 150 is written in dormancy control module 120, timing module 130, wake-up module 140 and data, further includes that first state judges Module 160 and restart module 170.Wherein:
First state judgment module 160 is used to read the state of at least two pieces hard disks, in particular to first state is sentenced Disconnected module 160 reads the value of the status register of at least two pieces hard disks, judges whether to work normally by the value of status register.
Path setup module 110 is additionally operable to, when judging at least two pieces of hard disk normal works, data record path be set One piece of hard disk being set at least two pieces of hard disks.
Restart module 170 to be used for when judging that at least two pieces of hard disks do not work normally, reboot operation system.Specifically, Normal work refer to hard disk can normal operation, can carry out accurately reading or being written data from hard disk, and can be controlled.
In the present embodiment, by judging the state of at least two pieces hard disks, before data write-in, ensure that hard disk can normal work Make.
As shown in figure 5, in one embodiment, above-mentioned hard disk control device, in addition to including path setup module 110, stopping Judgment module 150 is written in dormancy control module 120, timing module 130, wake-up module 140 and data, further includes that dormant state judges Module 180, the first reseting module 190, the second condition judgment module 200, the second reseting module 210 and correction verification module 220.Its In:
Dormant state judgment module 180, which is used to control remaining hard disk according to dormancy instruction in suspend mode control module 120, to be entered After deep sleep state, the status register value of remaining hard disk is read, judges whether remaining hard disk enters deep sleep state.
Deep sleep state, Status register are indicated specifically, can preset when status register value is first predetermined value Wake-up and normal operating conditions etc. are indicated when device value is second predetermined value.The status register value for reading hard disk, by the shape of reading State register value is compared with first predetermined value, if identical, then it represents that hard disk enters deep sleep state.
Timing module 130 is additionally operable to when judging that remaining hard disk enters deep sleep state, executes countdown instruction.
First reseting module 190 is used for when judging that remaining hard disk does not enter deep sleep state, then to not entering depth Remaining hard disk of degree dormant state is resetted.
Specifically, reset instruction is written into remaining hard disk for not entering deep sleep state, according to reset instruction to it It is resetted.Hard disk reset refers to restarting hard disk, becomes init state, which refers to that hard disk is in normal work Make state.Specifically, normal operating conditions refer to hard disk can normal operation, can from hard disk carry out accurately read or be written data, And it can be controlled.
Suspend mode control module 120 is additionally operable to the hard disk after control resets and enters deep sleep state.
Second condition judgment module 200 is used for one of hard in deep sleep state in the control of wake-up module 140 After disk enters wake-up states, the status register value into the hard disk of wake-up states is read, judges the hard disk into wake-up states Whether normal operating conditions is entered.
Specifically, the status register value of hard disk is read, by the status register value of reading compared with second predetermined value, if It is identical, then it represents that hard disk enters normal operating conditions.
Path setup module 110 is additionally operable to when judging that the hard disk into wake-up states enters normal operating conditions, will Data record path is set as the hard disk into wake-up states.
Second reseting module 210 is used for when judging that the hard disk into wake-up states does not enter normal operating conditions, will The hard disk into wake-up states is resetted.Then path setup module 110 by data record path be set as it is described into Enter the hard disk of wake-up states.
Specifically, reset instruction is written to the hard disk for entering wake-up states in the second reseting module 210, according to reset instruction pair It is resetted.Hard disk reset refers to restarting hard disk, becomes init state, which refers to that hard disk is in normal Working condition.When hard disk is to be waken up into normal operating conditions, it can be used and hard disk is resetted, make it into normal work Make state, the hard disk to be guaranteed at deep sleep state is waken up, it is ensured that there is the hard disk of wake-up to fall to count instead of continue working When the time hard disk.
Correction verification module 220 is used to that tentation data, verification data to be written to the hard disk for entering wake-up states, and judges that verification is It is no to pass through.
Specifically, tentation data can be selected as needed, verify whether the tentation data is correct, can avoid wake-up states There is unstable, reinforcement data record reliability in hard-disc storage data.
When path setup module 110 is additionally operable to judge that verification passes through, set data record path to enter wake-up states Hard disk.
Wake-up module 140 be additionally operable to verification not by when, to enter wake-up states hard disk re-write wake-up instruction. Specifically, wake-up module 140 re-writes wake-up instruction to the hard disk for entering wake-up states, to make the hard disk enter wake-up again State.
In other embodiments, above-mentioned hard disk control device, in addition to including path setup module 110, suspend mode control module 120, judgment module 150 is written in timing module 130, wake-up module 140 and data, further includes 180 He of dormant state judgment module First reseting module 190;Alternatively, may also include the second condition judgment module 200 and the second reseting module 210;Or it can also wrap Include correction verification module 220 etc..First reseting module 190 and the second reseting module 210 can be collectively referred to as reseting module.
In one embodiment, by taking two pieces of hard disks (hard disk A and hard disk B) as an example, the work of hard disk control device is described in detail Make process, specifically includes:
(1) booting/reboot operation system, and start hard disk management program.
Specifically, hard disk management program is hard disk controlling software, for realizing hard disk control method.
(2) whether two pieces of hard disks of the detection of first state judgment module 160 are working properly, if so, (3) are executed, if it is not, returning (1)。
Specifically, two pieces of hard disk operationals are just referring to be read out, data are written.
(3) path setup module 110 sets data record path to hard disk A, and starts to store data to hard disk A.
(4) control of suspend mode control module 120 hard disk B enters deep sleep state.
Specifically, dormancy instruction is written to hard disk B, controlling hard disk B according to dormancy instruction enters deep sleep state.
(5) dormant state judgment module 180 judges whether hard disk B enters deep sleep state, if so, (7) are executed, if It is no, then it executes (6).
(6) first reseting modules 190 reset hard disk B, return again to (4).
Specifically, reset instruction is written to hard disk B, hard disk B is resetted according to reset instruction.
(7) timing module 130 executes countdown instruction.
(8) timing module 130 judges whether countdown terminates, if so, executing (9), otherwise continues to execute (8).
(9) wake-up module 140 wakes up instruction to hard disk B write-ins.
(10) second condition judgment modules 160 judge whether hard disk B enters normal operating conditions, if so, (12) are executed, If it is not, then executing (11).
(11) second reseting modules 210 reset hard disk B.
Specifically, reset instruction is written to hard disk B, hard disk B is resetted according to reset instruction.
(12) a string of tentation datas and verification data are written to hard disk B in correction verification module 220.
(13) correction verification module 220 judge hard disk B whether can normal recordings data, if so, execute (14), otherwise return step (9)。
(14) path setup module 110 sets operating system data record path to hard disk B.
(15) number write-in judgment module 150 judges whether that hard disk A is written in no data, if so, (16) are executed, if it is not, returning (15)。
(16) control of suspend mode control module 120 hard disk A enters deep sleep state.
Specifically, dormancy instruction is written to hard disk B, controlling hard disk B according to dormancy instruction enters deep sleep state.
(17) dormant state judgment module 180 judges whether hard disk A enters deep sleep state, if so, (19) are executed, If it is not, executing (18).
(18) first reseting modules 190 reset hard disk A, return again to (16).
Specifically, reset instruction is written to hard disk A, hard disk A is resetted according to reset instruction.
(19) timing module 130 executes countdown instruction.
(20) timing module 130 judges whether countdown terminates, if so, executing (21), otherwise (20).
(21) wake-up module 140 wakes up instruction to hard disk A write-ins.
(22) second condition judgment modules 200 judge whether hard disk A enters normal operating conditions, if so, (24) are executed, if It is no, it executes (23).
(23) second reseting modules 210 reset hard disk A, execute (24).
Specifically, reset instruction is written to hard disk A, hard disk A is resetted according to reset instruction.
(24) a string of tentation datas and verification data are written to hard disk A in correction verification module 220.
(25) correction verification module 220 judge hard disk A whether can normal recordings data, if so, execute (26), if it is not, execute (21)。
(26) path setup module 110 sets operating system data record path to hard disk A.
(27) data write-in judgment module 150 determines whether that hard disk B is written in no data, if (4) are returned to, if it is not, then returning It returns (27).
Above-mentioned hard disk control device is worked alternatively by using two pieces of hard disks, both ensure that data record stored, and had also been ensured Hard disk works within normal working hours, extends the service life of hard disk, and judges no original place of data write-in It in the hard disk of working condition, just controls it and enters deep sleep state, it is ensured that when switching hard disk, do not lose data.
In addition, above-mentioned hard disk control device may be provided in the south bridge (South Bridge) of computer, may also be arranged on The PCH (Platform Controller Hub, platform controller hub) or CPU (Center Processing of computer Unit, central processing unit) in.It is illustrated so that hard disk control device is arranged in the south bridge of computer as an example.As shown in fig. 6, South bridge and multiple hard disks (hard disk 1, hard disk 2 ..., hard disk n) pass through SATA (Serial Advanced Technology Attachment, serial advanced technology) bus be connected, data are transferred to north bridge by south bridge by controlling bus, then again by north Data are transferred to central processing unit by bridge by controlling bus.The path setup module 110 of hard disk control device is by data record Path is set as hard disk 1, and suspend mode control module 120 controls hard disk 2 and enters deep sleep state to hard disk n, and timing module 130 is opened Beginning timing, timing time arrive, and hard disk 2 of the control of wake-up module 140 in deep sleep state enters wake-up states, then path Setup module 110 sets data record path to hard disk 2, and data write-in judgment module 150 judges whether no data write-in Into hard disk 1, if so, suspend mode control module 120, which controls hard disk 1, enters deep sleep state, timing module 130 starts to count When, timing time arrives, and hard disk 3 of the control of wake-up module 140 in deep sleep state enters wake-up states, path setup module 110 set data record path to hard disk 3, and data write-in judgment module 150 judges whether that no data are written to hard disk 3 In, if so, suspend mode control module 120, which controls hard disk 2, enters deep sleep state, so cycle executes successively.Per secondary control One piece of hard disk operational, other hard disks are in deep sleep state, extend the service life of hard disk.The hard disk waken up every time be not required to by It is arbitrarily waken up according to hard disk order.
Further, it should be noted that in order to extend standard machinery hard disk service life, above-mentioned hard disk control method and dress It sets, therefore, to assure that at least two pieces of hard disks can work normally, and can be only achieved the purpose of hard disk alternation.
For this purpose, when system starts, it can be by the corresponding fixed drive of hard disk distribution of each SATA controller interface, such as:With The hard disk of SATA PORT1 connections is fixed as drive A, drive B is fixed as with the SATA PORT2 hard disks connecting, with SATA The hard disk of PORT3 connections is fixed as drive C, and being fixed as drive D ... with the SATA PORT4 hard disks connecting, the rest may be inferred.
When judging that the hard disk quantity of any hard disk failure or judgement normal work is less than 2, monitoring software can report hard disk Fault message, it is desirable that carry out plant maintenance, and close whole monitoring device.It is any when judging if equipment is only configured with 2 hard disks When hard disk failure, monitoring software can pass hull closure operating system;It is such as 4, any hard when judging if the multiple hard disks of device configuration When disk failure (such as hard disk B failures), monitoring software can set data record path to next disk C;It is multiple hard when judging When disk failure (such as hard disk B, C failure), monitoring software can set data record path to next hard disk D.Wherein, path is set It sets sequence and " A → B → C → D →... ... → A " cycle can be used, when the hard disk quantity of judgement normal work is less than 2, close Device operating system.In this way, when hard disk breaks down, monitoring software is avoided to enter endless loop state, and from sending out hard disk failure Report, it is desirable that necessary maintenance is carried out to equipment.Wherein, monitoring software is the hard disk control method or device pair of foregoing description The program answered.
Above-mentioned hard disk control method and device are used as data record road by one piece of hard disk being arranged at least two pieces of hard disks Diameter controls remaining hard disk and enters deep sleep state, and timing, and timing time arrives, and wakes up one piece and is in deep sleep state Hard disk is set as data record path, and original in running order hard disk controlling is entered deep sleep state, is so controlled Multiple hard disks work alternatively, and extend the service life of hard disk, and judge originally in running order hard of no data write-in Disk just controls it and enters deep sleep state, it is ensured that when switching hard disk, does not lose data.
In addition, judging whether hard disk enters deep sleep state by detecting state register value, the standard of control can be improved True property ensures that the hard disk for not being set as data record path is in deep sleep state, to extend its service life;By to inspection When the status register value for the hard disk that survey wakes up judges that hard disk does not enter normal operating conditions, it can be resetted, ensure to call out Awake hard disk can work normally, it is ensured that the replaceable hard disk for having reached normal working hours;By the way that number is written to the hard disk of wake-up According to and verify, it is ensured that the accuracy of the hard disc data that is waken up write-in.
Several embodiments of the invention above described embodiment only expresses, the description thereof is more specific and detailed, but simultaneously Cannot the limitation to the scope of the claims of the present invention therefore be interpreted as.It should be pointed out that for those of ordinary skill in the art For, without departing from the inventive concept of the premise, various modifications and improvements can be made, these belong to the guarantor of the present invention Protect range.Therefore, the protection domain of patent of the present invention should be determined by the appended claims.

Claims (10)

1. a kind of hard disk control method, includes the following steps:
Set data record path to one piece of hard disk at least two pieces of hard disks;
Remaining hard disk for not being set as data record path at least two pieces of hard disks described in control enters deep sleep state;
Cycle executes following steps:
Execute countdown instruction;
One of hard disk in deep sleep state is controlled at the end of countdown enters wake-up states;
Set the data record path to the hard disk into wake-up states, and by data from next write instruction It is recorded in the hard disk into wake-up states;
Determine whether that no data are written to the previous of the hard disk into wake-up states for being arranged to data record path Block hard disk, if so, the control previous piece of hard disk enters deep sleep state;
The step for controlling one of hard disk in deep sleep state at the end of countdown and entering wake-up states Suddenly include:
By waking up instruction to one of hard disk write-in in deep sleep state, control write-in is instructed to wake up according to waking up The hard disk of instruction enters wake-up states from deep sleep state, and the hard disk in deep sleep state does not operate, and does not carry out Data read-write operation.
2. hard disk control method according to claim 1, which is characterized in that it is described by data record path be set as to Further include step before the step of lacking one piece of hard disk in two pieces of hard disks:
Read described at least two pieces hard disks state, judge whether to work normally, if so, by data record path be set as to Lack one piece of hard disk in two pieces of hard disks, otherwise reboot operation system.
3. hard disk control method according to claim 1, which is characterized in that at least two pieces of hard disks described in the control not After being set as the step of remaining hard disk in data record path enters deep sleep state, further include:
The status register value for reading remaining hard disk, judges whether remaining described hard disk enters deep sleep state, if so, Countdown instruction is then executed, if it is not, then control does not enter remaining hard disk of deep sleep state and resetted, is then controlled again multiple Hard disk behind position enters deep sleep state.
4. hard disk control method according to claim 1, which is characterized in that described to control the place at the end of countdown Further include step after the step of one piece of hard disk therein of deep sleep state enters wake-up states:
The status register value for reading the hard disk into wake-up states, judge the hard disk into wake-up states whether into Enter normal operating conditions, if so, the data record path is set to the hard disk into wake-up states, if it is not, then The hard disk into wake-up states is resetted, the data record path, which is then set as described, again enters wake-up shape The hard disk of state.
5. hard disk control method according to any one of claim 1 to 4, which is characterized in that described when countdown terminates When control one of hard disk in deep sleep state the step of entering wake-up states after, further include step:
Tentation data, and verification data is written to the hard disk into wake-up states;
Judge whether verification passes through, if so, set the data record path to the hard disk into wake-up states, if It is no, then wake-up instruction is re-write to the hard disk into wake-up states.
6. a kind of hard disk control device, which is characterized in that including:
Path setup module, one piece of hard disk for setting data record path at least two pieces of hard disks;
Suspend mode control module, for controlling remaining hard disk entrance for not being set as data record path at least two pieces of hard disks Deep sleep state;
Timing module, for executing countdown instruction;
Wake-up module enters wake-up for controlling one of hard disk in deep sleep state at the end of countdown State;
The path setup module is additionally operable to set the data record path to the hard disk into wake-up states, and from Next write instruction, which rises, records data in the hard disk into wake-up states;
Judgment module is written in data, is arranged to the entrance in data record path for determining whether that no data are written to Previous piece of hard disk of the hard disk of wake-up states;
The suspend mode control module is additionally operable to be arranged to the entrance in data record path judging that no data are written to When previous piece of hard disk of the hard disk of wake-up states, controls the previous piece of hard disk and enter deep sleep state, the then timing Module, wake-up module, path setup module, data write-in judgment module execute successively;
The wake-up module, for by waking up instruction to one of hard disk write-in in deep sleep state, according to calling out The hard disk that instruction control write-in of waking up wakes up instruction enters wake-up states from deep sleep state, wherein is in deep sleep state Hard disk do not operate, do not carry out data read-write operation.
7. hard disk control device according to claim 6, which is characterized in that further include:
First state judgment module, the state for reading at least two pieces hard disks, judges whether to work normally;
The path setup module is additionally operable to, when judging at least two pieces of hard disk normal works, set data record path to One piece of hard disk at least two pieces of hard disks;
Restart module, for when judging that at least two pieces of hard disks do not work normally, reboot operation system.
8. hard disk control device according to claim 6, which is characterized in that further include:
Whether dormant state judgment module, the status register value for reading remaining hard disk judge remaining described hard disk Into deep sleep state;
The timing module is additionally operable to, when judging that remaining described hard disk enters deep sleep state, execute countdown instruction;
First reseting module, when not entering deep sleep state for remaining hard disk described in judging, then to not entering depth Remaining hard disk of dormant state is resetted;
The suspend mode control module is additionally operable to the hard disk after control resets and enters deep sleep state.
9. hard disk control device according to claim 6, which is characterized in that further include:
Second condition judgment module, the status register value for reading the hard disk into wake-up states, judge it is described into Whether the hard disk for entering wake-up states enters normal operating conditions;
The path setup module be additionally operable to judge it is described enter normal operating conditions into the hard disk of wake-up states when, will The data record path is set as the hard disk into wake-up states;
Second reseting module, for judge it is described do not enter normal operating conditions into the hard disk of wake-up states when, by institute The hard disk stated into wake-up states is resetted, and then the data record path is set as described by the path setup module Into the hard disk of wake-up states.
10. the hard disk control device according to any one of claim 6 to 9, which is characterized in that further include:
Correction verification module for tentation data, and verification data to be written to the hard disk into wake-up states, and judges that verification is It is no to pass through;
When the path setup module is additionally operable to judge that verification passes through, the data record path is set as described and enters wake-up The hard disk of state;
The wake-up module be additionally operable to verification not by when, wake-up is re-write to the hard disk into wake-up states and is referred to It enables.
CN201210395262.3A 2012-10-17 2012-10-17 hard disk control method and device Active CN103777893B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210395262.3A CN103777893B (en) 2012-10-17 2012-10-17 hard disk control method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210395262.3A CN103777893B (en) 2012-10-17 2012-10-17 hard disk control method and device

Publications (2)

Publication Number Publication Date
CN103777893A CN103777893A (en) 2014-05-07
CN103777893B true CN103777893B (en) 2018-09-21

Family

ID=50570192

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210395262.3A Active CN103777893B (en) 2012-10-17 2012-10-17 hard disk control method and device

Country Status (1)

Country Link
CN (1) CN103777893B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107329710A (en) * 2017-07-06 2017-11-07 郑州云海信息技术有限公司 A kind of method of storage performance optimization, system and storage software
CN109918952B (en) * 2019-03-08 2019-10-18 中融科创信息技术河北有限公司 A kind of safer cloud computing platform system and processing method
CN112988083B (en) * 2021-05-19 2021-08-03 四川省商投信息技术有限责任公司 Cold data storage method and system

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101262580A (en) * 2007-08-31 2008-09-10 深圳市同洲电子股份有限公司 A digital TV receiving device and method and system for monitoring hard disk dormancy
CN101600077A (en) * 2009-03-02 2009-12-09 深圳南方汉邦数字技术有限公司 A kind of digital hard disc video recorder system and its implementation based on stream media file management
CN101782865A (en) * 2010-02-05 2010-07-21 浪潮(北京)电子信息产业有限公司 Device for realizing disk array and method therefor
CN202422747U (en) * 2012-02-07 2012-09-05 青岛海信网络科技股份有限公司 Vehicle-mounted hard disk monitoring system and vehicle-mounted hard disk video tape recorder

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5080201B2 (en) * 2007-10-22 2012-11-21 京セラドキュメントソリューションズ株式会社 Information processing apparatus and device driver provided therein

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101262580A (en) * 2007-08-31 2008-09-10 深圳市同洲电子股份有限公司 A digital TV receiving device and method and system for monitoring hard disk dormancy
CN101600077A (en) * 2009-03-02 2009-12-09 深圳南方汉邦数字技术有限公司 A kind of digital hard disc video recorder system and its implementation based on stream media file management
CN101782865A (en) * 2010-02-05 2010-07-21 浪潮(北京)电子信息产业有限公司 Device for realizing disk array and method therefor
CN202422747U (en) * 2012-02-07 2012-09-05 青岛海信网络科技股份有限公司 Vehicle-mounted hard disk monitoring system and vehicle-mounted hard disk video tape recorder

Also Published As

Publication number Publication date
CN103777893A (en) 2014-05-07

Similar Documents

Publication Publication Date Title
US7246210B2 (en) Archival cartridge management system with auto-refresh
CN104700886B (en) Memory circuit with power supply status sensor
CN103514068A (en) Method for automatically locating internal storage faults
CN103744764A (en) Crontab based whole computer memory stability test method
US8677162B2 (en) Reliability-aware disk power management
CN103777893B (en) hard disk control method and device
CN106356097A (en) Protection method and device for preventing data loss
CN102760090A (en) Debugging method and computer system
CN101770404B (en) Watchdog circuit capable of keeping status and method for keeping restart status thereof
CN110704287B (en) RAID card abnormal log collection method and system under Linux system and storage medium
CN103378986A (en) System event log recording system and method
CN108152706A (en) Mobile terminal and power management chip restart detection process method and storage medium
CN105137227A (en) Testing device and method for power-down protection of intelligent card
CN112270945B (en) Method, device, storage medium and terminal for recording power failure during erasing
CN101329594A (en) Method for reducing notebook computer battery-exchanging working time and battery detector
CN111858178B (en) Method, device and equipment for judging power supply starting type and readable medium
US20130321944A1 (en) Server and method for preventing the server from vibration damage
CN101645014A (en) Method for simulating data storage of EEPROM by using built-in FLASH program storing device of single-chip
CN116705138A (en) Solid state disk testing method and storage medium
CN103109265A (en) Method and system for performing system maintenance in a computing device
CN113742166B (en) Method, device and system for recording logs of server system devices
CN109634796A (en) A kind of method for diagnosing faults of computer, apparatus and system
CN101097539A (en) Data copy device of movable memory apparatus and method
WO2018050070A1 (en) Charging control method and device, terminal and computer storage medium
CN100524239C (en) Method for protecting data of memory mechanism

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20230713

Address after: 518057 1701, Yanxiang science and technology building, 31 Gaoxin middle Fourth Road, Maling community, Yuehai street, Nanshan District, Shenzhen City, Guangdong Province

Patentee after: Shenzhen Yanxiang Smart Technology Co.,Ltd.

Address before: 518057 Guangdong city of Shenzhen province Nanshan District high in the four EVOC Technology Building No. 31

Patentee before: EVOC INTELLIGENT TECHNOLOGY Co.,Ltd.