The collocation method of a kind of Disk Array and assembling and disk insertion process method
Technical field
The invention belongs to the data processing method in great capacity data storage field, particularly relate to a kind of disk array and set
Standby collocation method and assembling and disk insertion process method.
Background technology
RAID (Redundant Array of Independent Disks), is called for short RAID,
Refer to that the physical disk of polylith independence is combined in different ways the logic magnetic disc formed.
At present, prior art generally assembles RAID or the information preserved by disk according to disk drive information
Process disk and insert event;
The detailed process assembling RAID or process disk insertion event according to the information of disk drive is:
Being pre-configured with the RAID configuration file mdadm.conf containing drive, its configuration file content is as follows:
DEVICE/dev/sd[deg]
ARRAY/dev/md0 level=raid5 num-devices=3metadata=0.90spares=1UUID=05f05cb4:22fc604b:515e60f7:3fel4bb5
Wherein, sd [deg] represents that physical disk sdd, sde, the sdg in system is assembled into independent disk is superfluous
Remaining array;
As it has been described above, prior art is when processing disk assembling or the event of insertion, it is required for the drive of reading disk.
In Disk Array, owing to using disk, such as triangular web commonly used tens or hundreds of pieces in a large number
Hard disk.Disk under a certain FPDP often occurs drive change or be replaced.If by containing disk dish
The configuration information of symbol assembles RAID or processes disk insertion event, works as independent disk redundancy
The disk that disk in array changes in drive, such as Fig. 3 because of certain reason is become sdh from sdg, then assemble
During, find sdg diskless, cause the RAID can not be by the drive of configuration file
Assemble or process disk and insert event.
When assembling Disk Array, owing to can not find the drive comprised in configuration file, it is thus impossible to complete
RAID is become to assemble.
Process insertion event time, it is impossible to by insert event detection to disk be automatically inserted into independent disk redundancy
In array, or by force the disk drive belonging to other Disk Array is inserted in this Disk Array,
Thus result in system disk entanglement.
Therefore, in the prior art, needing operator to judge, whether the disk that these different drives represent can be inserted
Enter in the RAID in configuration information, be the most manually inserted into.Operator is not existed
On-the-spot computer system, such as embedded computer system, RAID is incited somebody to action forever can not be by upper
State disk to be automatically inserted into, thus exist and damage risk.
The detailed process that prior art inserts event by the information processing disk that disk is preserved is:
Being pre-configured with the configuration file of the RAID containing disk number, common configuration content is such as
Under:
The RAID configuration information start mark */SLOT=0/*RAID of VirtualDisk :/* disk A1 and A2
Controller A place slot number */
RAID=0/*RAID rank, such as: RAID0, RAID1 or RAID5*/
WRITEPOLICY=write_back/* writes strategy, such as: the * such as direct write or write-back/
READPOLICY=adaptive_read_ahead/* reads strategy, such as: prefetches, be not prefetched or adaptive
Should prefetch etc. */
IOPOLICY=no_cached/* reads 10 strategies that write strategy strategy is comprised, and uses and deposits or not
The * such as use cache/
Disk number * that PD=0,1/*RAID comprises/
As it has been described above, when operating system nucleus detects that disk inserts event, form independent magnetic by detection
Whether multiple disks of dish redundant array exist corresponding to the information and self disk number self stored
The new disk that the configuration information of the RAID being pre-configured with is not inconsistent, when above-mentioned multiple magnetic being detected
When there is above-mentioned new disk in dish, by with the independent disk being pre-configured with corresponding to self disk number above-mentioned
The configuration information of redundant array is write in above-mentioned new disk so that it is superfluous that above-mentioned new disk becomes above-mentioned independent disk
A disk in remaining array.When the information specifying region to store of detection disk is right with self hard disk serial number institute
During the accordant configuration information of the RAID being pre-configured with answered, then illustrate that the disk inserted is
The disk before extracted from the position that the disk number of the disk inserted is corresponding, does not perform any operation.So,
This may result in Disk Array can not be inserted by this disk always, and be in the danger of damage.
Therefore, when prior art inserts event by the information processing disk that disk is preserved, need to detect multiple magnetic
Whether dish exists the information and the independent disk being pre-configured with corresponding to self disk number self stored
Whether the configuration information of redundant array is consistent.That is relevant to the information of disk storage itself.Disk is originally
The information of body storage may determine whether to be successfully processed insertion event.
Summary of the invention
The present invention solves the problem that Disk Array job stability is relatively low, it is provided that a kind of disk array sets
Standby collocation method and assemble method and disk insertion process method;
Technical scheme is as follows;
First subject matter of the present invention is: the collocation method of a kind of Disk Array;
First described collocation method creates RAID, secondly extracts described RAID
In each disk correspondence connect physical port, obtain the physical port identifier that each described disk is corresponding, finally
Each described physical port identifier is collected, generates configuration file;
Described physical port is physical port or the physical port of SAS card of SAS expander.
The first embodiment of described collocation method is:
Described physical port is the physical port of SAS expander, the most each described disk respectively with SAS expander
Physical port is connected, and each described SAS expander physical port with described SAS card respectively is connected;
Concretely comprising the following steps of described collocation method:
Step 1, uses RAID tool operation order in an operating system, creates RAID;
RAID instrument is multiple devices admin, referred to as mdadm;
Step 2, obtains in described RAID, the physical port identifier SAS of each described disk
PHY ID, its process is:
Step 2-1, the kernel information under system file clip directory in search operation system, at described kernel information
Middle acquisition:
1) numbering of SAS card;
2) numbering of SAS expander;
3) the physical port numbering being connected with disk in SAS expander;
Kernel information is included in the multiple files under system file clip directory;Such as, the physics end of SAS card
Mouthful numbering leave in/sys/class/sas_phy catalogue under, and with the physical port of SAS card number corresponding
Disk drive information leaves in the subdirectory below its identifier.
Step 2-2, described step 2-1 the number information obtained obtains the physical port identification of each described disk
Number SAS PHY ID, as shown in Equation 1:
SAS PHY ID=phy-A:B:C 1;
Wherein, A is the numbering of SAS card, and the span of A is 0~the quantity of SAS card that can insert of mainboard subtracts
1;B is the numbering of SAS expander, and the span of B is 0~254;C be in SAS expander with disk
The physical port numbering connected, the span of C be 0~the physical port sum of SAS expander subtract 1;
Step 3, generates configuration file;
The physical port identifier SAS PHY ID write disk of each described disk that described step 2 is obtained
Configuration file, the expression formula of described configuration file is as shown in formula 3, formula 4:
Mdx=[SAS PHY ID1, SAS PHY ID2 ..., SAS PHY IDN] 3;
SAS PHY IDi=phy-Ai:Bi:Ci 4;
i=1、2、…N
Wherein, mdx represents the logic magnetic disc device symbols of described RAID, x >=0;[SAS PHY
ID1, SAS PHY ID2 ..., SAS PHY IDN] represent comprise in described RAID complete
Portion physical port identifier SAS PHY ID;Phy-Ai:Bi:Ci represents the physical port identification of i-th disk
Number;
The second embodiment of described collocation method is:
Described physical port is the physical port of SAS card, the most each described disk respectively with the physical port of SAS card
It is connected;
Concretely comprising the following steps of described collocation method:
Step 1, uses RAID tool operation order in an operating system, creates RAID;
Step 2, obtains in described RAID, the physical port identifier SAS of each described disk
PHY ID, its process is:
Step 2-1, the kernel information under system file clip directory in search operation system, at described kernel information
Middle acquisition:
1) numbering of SAS card;
2) the physical port numbering being connected with disk in SAS card;
Step 2-2, described step 2-1 the number information obtained obtains the physical port identification of each described disk
Number SAS PHY ID, as shown in Equation 3:
SAS PHY ID=phy-D:E 3;
Wherein, D is the numbering of SAS card, and the span of D is 0~the quantity of SAS card that can insert of mainboard subtracts
1;E is that the physical port being connected with disk in SAS card is valiant, and span is the physical port of 0~SAS card
Quantity subtracts 1;
Step 3, generates configuration file;
The physical port identifier SAS PHY ID of each described disk described step 2 obtained writes described magnetic
The configuration file of dish, the expression formula of described configuration file is as shown in formula 5, formula 6:
Mdx=[SAS PHY ID1, SAS PHY ID2 ..., SAS PHY IDN] 5;
SAS PHY IDi=phy-Di:Ei 6;
i=1、2…N;
Wherein, mdx represents the logic magnetic disc device symbols of described RAID, x >=0;[SAS PHY
ID1, SAS PHY ID2 ..., SAS PHY IDN] represent comprise in described RAID complete
Portion physical port identifier SAS PHY ID, phy-Di:Ei represents the physical port identifier of i-th disk;
In being embodied as: sequence number can be used to replace the identifier of each described physical port, the most described configuration literary composition
The expression formula of part is as shown in formula 7, formula 8:
SAS PHY ID=phy-A:B:C=a 7;
SAS PHY ID=phy-D:E=b 8;
Described disk is SATA disk or SAS disk;
Described operating system is linux system or Unix system.
Second subject matter of the present invention is: utilize the group of the Disk Array of the configuration file realization generated
Dress method;
Described assemble method is when system restarts or disk drive changes, and utilizes described step 4 raw
The configuration file become realizes the assembling of described redundant arrays of inexpensive disks, and it concretely comprises the following steps:
Step 4-1, extracts each physical port identifier SAS PHY ID in described configuration file;
Step 4-2, each physical port identifier SAS PHY ID extracted according to described step 4-1 obtains with each
The disk drive information that physical port correspondence connects;
Step 4-3, is assembled into disk corresponding for each described disk drive information obtained in described step 4-2
Described RAID.
3rd subject matter of the present invention is: utilize the magnetic of the Disk Array of the configuration file realization generated
Dish insertion process method;
Described processing method is when occurring disk to insert event, and the configuration file utilizing described step 4 to generate is real
The insertion process of existing disk, it concretely comprises the following steps;
Step 5-1, obtains the disk drive information of insertion event;
Step 5-2, obtains the physical port identifier SAS PHY that the disk drive information of described step 5-1 is corresponding
ID;
Step 5-3, the identifier SAS PHY ID of the described physical port described step 5-2 obtained is with described
Record data in configuration file are compared;
If the physical port identifier SAS PHY ID that described step 5-2 obtains is included in described configuration file,
Then described disk is inserted described RAID;
If the physical port identifier SAS PHY ID that described step 5-2 obtains is not included in described configuration file
In, the most described disk is not inserted into described RAID.
The present invention appoints without adding during assembling RAID or processing disk insertion event
What hardware, only relevant to external physical port identifier or sequence number, store with disk drive or disk itself
Information unrelated;No matter how disk drive changes, no matter disk specify region whether contain configuration information or
How configuration information changes, and all can realize pressing the profile information restructuring of RAID or by new
Disk inserts RAID;Therefore, the method for the present invention is no longer necessary to disk storage itself
Information processes or configures, and substantially increases the job stability of Disk Array.
Accompanying drawing explanation
Fig. 1 is the collocation method workflow diagram of inventive disk array apparatus;
Fig. 2 is the assemble method workflow diagram of inventive disk array apparatus;
Fig. 3 is the disk insertion process method workflow diagram of inventive disk array apparatus;
With detailed description of the invention, the present invention is described in more detail below in conjunction with the accompanying drawings, the protection of the present invention
Scope is not limited to following detailed description of the invention.
Detailed description of the invention
Being connected with the physical port of SAS expander respectively by each described disk, each described SAS expander is respectively
It is connected with the physical port of described SAS card;
As it is shown in figure 1, the collocation method of a kind of Disk Array, it concretely comprises the following steps:
Step 1, in (SuSE) Linux OS, uses RAID tool operation order, creates independent disk redundancy
Array;
Step 2, obtains in described RAID, the physical port identifier SAS of each described disk
PHY ID, its process is:
Step 2-1, the kernel information under system file clip directory in search operation system, at described kernel information
Middle acquisition:
1) numbering of SAS card;
2) numbering of SAS expander;
3) the physical port numbering being connected with disk in SAS expander;
Step 2-2, described step 2-1 the number information obtained obtains the physical port identification of each described disk
Number SAS PHY ID, it is respectively phy-0:0:11, phy-0:0:13, phy-0:0:16;
Step 3, generates configuration file;
The physical port identifier SAS PHY ID of each described disk described step 2 obtained collects, and generates
Configuration file, the usability of program fragments of described configuration file is:
Md0=PHY-0:0:11, PHY-0:0:13, PHY-0:0:16
As in figure 2 it is shown, utilize the assemble method of the Disk Array of the configuration file realization generated;
The step of described assemble method is:
Step 4-1, extracts the identifier SAS PHY ID of physical port in described configuration file;
Step 4-2, each physical port identifier SAS PHY ID extracted according to described step 4-1 obtains with each
The disk drive information that physical port is corresponding, its process is:
In reading system/sys/class/sas_phy/<SAS PHY-ID>/dev*/port/e*/t*/* 0/ catalogue
Under device type and device symbols catalogue file, this document comprises the physical port identifier with each disk
Disk drive information corresponding for SAS PHY ID;
Step 4-3, uses RAID tool operation order, each described disk dish that will obtain in described step 4-2
Disk corresponding to symbol information is assembled into described RAID;
As it is shown on figure 3, utilize the disk insertion process method of the Disk Array of the configuration file realization generated;
The step of described processing method is:
Step 5-1, reads the disk drive information of insertion event by described operating system nucleus;
Step 5-2, search described operating system /sys catalogue under kernel information, obtain described step 5-1
Physical port identifier SAS PHY ID corresponding to disk drive information;
Step 5-3, the identifier SAS PHY ID of the described physical port described step 5-2 obtained is with described
Record data in configuration file are compared;
If the physical port identifier SAS PHY ID that described step 5-2 obtains is included in described configuration file,
Then described disk is inserted described RAID;
If the physical port identifier SAS PHY ID that described step 5-2 obtains is not included in described configuration file
In, the most described disk is not inserted into described RAID.
The test process of the inventive method is as follows:
1) RAID assembling test: create RAID, drive in configuration file
For sd [def], sdf dish is changed into sdg drive, and physical port identifier or sequence number are constant;
Re-assemblying RAID according to the assemble method of the Disk Array of the present invention, system opens
After Dong, sdg is successfully assembled into RAID, system circle after RAID restructuring
Face is as follows:
md:md0 stopped·
md:bind〈sde〉
md:bind〈sdg〉
md:bind〈sdd〉
raid5:device sdd operational as raid disk 0
raid5:device sdg operational as raid disk 2
raid5:device sde operational as raid disk 1
raid5:allocated 102976kB for md0
Raid5:raid level 5 set md0active with3out of3devices, algorithm2
RAID5 conf printout:
---rd:3 wd:3
Disk O, 0:1, cev:sdd
Disk 1, o:1, dev:sde
Disk 2, o:1, dev:sdg
md0:detected capacity change from 0 to 20480000000
md0:
2) disk inserts event test: after operating system nucleus detects sdg disk insertion event, by right
The ratio configuration file of this method, is inserted in RAID equipment md0, and independent disk is superfluous
Remaining array recovers, it is ensured that Disk Array is in serviceable condition, disk insert successfully after system interface
As follows:
Scsi0:0:10:0:SATA:handie (0 × 0010), sas_addr (0 × 5000b05b00002/4b2), device_name (0 × 5000c5002fe8eb05)
Scsi 0:0:10:0:SATA:enclosure_logical_id (0 × 500605b0000274bf), slot (18)
Scsi 0:0:10:0:atapi (n), ncq (y), asyn_notify (n), smart (y), fua (y), sw_preserve (y)
Scsi 0:0:10:O:qdepth (32), tagged (1), simple (1), ordered (0), scsi_level (7), cmd_que (1)
sd O:0:10:0:[sdg]3907029168 512_byte hardwsre sectors:(2.00TB/1.81TiB)
sd 0:0:10:0:[sdg]Write Protect is off
sd 0:0:10:0:[sdg]Mode Sense:7f 00 10 08
Sd 0:0:10:0:[sdg] Write cache:enabled, read cache:enabled, supports DPO and FUA
sd 0:0:10:0:[sdg]3907029168 512_byte hardware sectors:(2.00TB/1.81TiB)
sd 0:0:10:0:[sdg]Write Protect is off
sd 0:0:10:0:[sdg]Mode Sense:7f 00 10 08
Sd 0:0:10:0:[sdg] Write cache:enabled, read cache:enabled, suPPorts DPO and FUA
sdg:sdg1 sdg2
sdg:p1 size 4069234687 limited to end of disk
sd 0:0:10:0:[sdg]Attached SCSI disk
md:bind〈sdg〉
RAID5 conf printout:
---rd:3 wd:2
Disk 0, o:1, dev:sdd
Disk1, o:1, dev:sde
Disk2, o:1, deV:5dg
md:recovery of RAID array md0
md:minimum_guaranteed_speed:1000KB/sec/disk.
md:using maximum available idle IO bandwidth(but not more than 2O00OOKB/sec)for recovery.
Md:using 128k window, over a total of 10000000blocks.
md:md0:recoverydone·
RAID5 conf printout:
---rd:3 wd:3
Disk 0, o:1, dev:sdd
Disk1, o:1, dev:sde
Disk2, o:1, dev:sdg
What the most newly inserted disk drive is, as long as this physical port identifier or sequence number are contained in configuration
Within the corresponding RAID of file, so that it may be normally inserted into.
Technique scheme is one embodiment of the present invention, for those skilled in the art,
On the basis of the invention discloses application process and principle, it is easy to make various types of improvement or deformation,
Being not limited solely to the structure described by the above-mentioned detailed description of the invention of the present invention, the most previously described mode is simply
Preferably, and not restrictive meaning.