[go: up one dir, main page]

CN114063925B - Storage device ordering method - Google Patents

Storage device ordering method Download PDF

Info

Publication number
CN114063925B
CN114063925B CN202111382430.0A CN202111382430A CN114063925B CN 114063925 B CN114063925 B CN 114063925B CN 202111382430 A CN202111382430 A CN 202111382430A CN 114063925 B CN114063925 B CN 114063925B
Authority
CN
China
Prior art keywords
storage device
rule file
event
symbol
resource information
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
CN202111382430.0A
Other languages
Chinese (zh)
Other versions
CN114063925A (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.)
Yanxiang Smart Iot Technology Co ltd
Original Assignee
Yanxiang Smart Iot 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 Yanxiang Smart Iot Technology Co ltd filed Critical Yanxiang Smart Iot Technology Co ltd
Priority to CN202111382430.0A priority Critical patent/CN114063925B/en
Publication of CN114063925A publication Critical patent/CN114063925A/en
Application granted granted Critical
Publication of CN114063925B publication Critical patent/CN114063925B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/061Improving I/O performance
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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/0643Management of files
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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 OR CALCULATING; 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/0646Horizontal data movement in storage systems, i.e. moving data in between storage devices or systems
    • G06F3/0652Erasing, e.g. deleting, data cleaning, moving of data to a wastebasket
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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/0683Plurality of storage devices

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)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention provides a storage device ordering method, which comprises the following steps: acquiring a device event corresponding to a first storage device; searching a preset rule file in a rule file directory; when a preset rule file exists, slot resource information or driving protocol resource information corresponding to the first storage device is obtained to determine a mapping target; and processing a first symbol link corresponding to the mapping target under a first preset path according to the preset rule file. The invention can correspond the symbol link of the equipment with the slot resource information or the driving protocol resource information in the hardware, and can directly determine the position of the hard disk through the fixed slot or the driving protocol resource.

Description

Storage device ordering method
Technical Field
The invention relates to the technical field of storage equipment, in particular to a storage equipment ordering method.
Background
The existing method for solving the problem of disordered sequence of multiple hard disks usually adopts a method of grabbing the serial numbers of products of the hard disks to record the hard disks, records data and compares the disordered sequence of the hard disks each time, stores the recorded data and the compared result in a record table, judges whether the hard disks are out of disk and disordered or not by checking the record table, sets test variables, time intervals, test parameter files and the like each time, the operation is troublesome, the abnormality in the test process is also required to be checked and verified repeatedly according to the test log information, the working efficiency is low, and the hard disk of the verification equipment in the use process and the verification method of the hard disk disorder are only adopted, so that the problem of the hard disk disorder is not solved actually, and a lot of inconvenience is brought in the use and maintenance processes.
Disclosure of Invention
The storage device ordering method provided by the invention can correspond the symbol links of the device to the slot resource information or the driving protocol resource information in the hardware, and can directly determine the position of the hard disk through the fixed slot or the driving protocol resource.
The invention provides a storage device ordering method, which comprises the following steps:
acquiring a device event corresponding to a first storage device;
searching a preset rule file in a rule file directory;
when a predetermined rule file exists, it is determined,
Obtaining slot resource information or driving protocol resource information corresponding to the first storage device to determine a mapping target;
and processing a first symbol link corresponding to the mapping target under a first preset path according to the preset rule file.
Optionally, when the device event is a device delete event;
processing a first symbol link corresponding to the mapping target includes: deleting the first symbol link;
when the device event is a device add event;
Processing a first symbol link corresponding to the mapping target includes: and establishing the first symbol link.
Optionally, when the predetermined rule file does not exist, processing the second symbol link corresponding to the first storage device according to a default rule under a second predetermined path.
Optionally, when the device event is a device delete event;
processing the second symbol link corresponding to the first storage device includes: deleting a second symbol link corresponding to the first storage device according to a default rule, and updating the symbol links corresponding to the storage devices outside the first storage device;
when the device event is a device add event;
Processing the second symbol link corresponding to the first storage device includes: and establishing a second symbol link corresponding to the first storage device according to a default rule.
Optionally, searching the rule file directory for the predetermined rule file includes:
According to more than one key value pair of the first storage device, the matching device adds a preset rule corresponding to the event;
when more than one key value pair is the same as the key value pairs in the rule file, determining that the corresponding rule file is a preset rule;
When more than one key value pair is different from the key value pairs in the rule file, it is determined that the predetermined rule file does not exist.
Optionally, the method further comprises:
Partitioning, formatting or mounting the first symbol connection, or performing hot plug operation on the first storage device;
And inquiring a log file corresponding to the partition, formatting, mounting or hot plug operation to verify whether the preset rule is effective.
Optionally, the method further comprises:
Storing a preset rule file in a storage path of the rule file, and configuring the preset rule file into a startup self-starting state.
Optionally, when a predetermined rule file exists, acquiring the device type of the first storage device, and acquiring slot resource information or driving protocol resource information corresponding to the first storage device according to the first device type to determine a mapping target.
Optionally, when the device type of the first storage device is a disk array card, the disk array card is in communication connection with a plurality of hard disks;
And obtaining slot resource information or driving protocol resource information corresponding to the disk array card so as to determine a mapping target.
Optionally, when the device type of the first storage device is a hard disk;
and obtaining slot resource information or drive protocol resource information corresponding to the hard disk so as to determine a mapping target.
In the technical scheme provided by the invention, the symbol link is mapped with the fixed hardware slot or mapped with the drive protocol resource, so that the connection position of the hard disk or the used resource can be directly determined through the symbol link. According to the technical scheme provided by the invention, the disorder of hard disk sequence identification caused by hot plug of the hard disk is avoided, the time is not required to be consumed to check which specific hard disk name corresponds to which hard disk interface on the equipment, the ordering of the multiple hard disks can be completed by only adding the program into the startup self-starting operation at one time, and the efficiency of the multiple hard disk equipment in the use process is improved.
Drawings
FIG. 1 is a flow chart of a method for ordering storage devices according to an embodiment of the invention;
FIG. 2 is a flowchart of a storage device ordering method according to another embodiment of the present invention for determining event types;
FIG. 3 is a flow chart of generating symbolic links according to default rules of a storage device ordering method according to an embodiment of the present invention;
FIG. 4 is a flowchart illustrating a storage device ordering method according to another embodiment of the present invention for determining event types.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is apparent that the described embodiments are only some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
An embodiment of the present invention provides a storage device ordering method, as shown in fig. 1, including:
acquiring a device event corresponding to a first storage device; in some embodiments, the first storage device refers to a storage device on an interface connected to the motherboard, and the first storage device includes a variety of storage devices, for example, one or more of a hard disk, a usb disk, a floppy disk, an optical disk, and a magnetic memory. The device event refers to an event in which a change in the setting state occurs, for example, a new device or a deletion of a device.
Searching a preset rule file in a rule file directory; in some embodiments, the rule file directory is a directory path for storing a plurality of rule files, and the predetermined rule file is a user-defined rule file that includes at least a rule for device file naming or device symbolic link naming. For example, the custom rule file is named 10-disk.rule, and is added UDEV to the default storage path/etc/udev/rule.d/usr/lib/udev/rule.d/for the rule file. The custom rule file is reloaded udev during the boot-up self-start up using udevadmin.
When a predetermined rule file exists, in some embodiments, when a device is newly added or deleted, the key value pair of the device is extracted, then the key value pair of the device is compared with the key value pair in the rule file, and when the key value pairs of the two are the same, the rule file can be indicated to be applied to the first storage device which is newly added or deleted currently.
Obtaining slot resource information or driving protocol resource information corresponding to the first storage device to determine a mapping target; in some embodiments, the first storage device is connected to the motherboard through slots, where the first storage device is in one-to-one correspondence with the slots, and thus, the ordering position of the first storage device may be determined by using the corresponding slots. In other embodiments, when the first storage device is connected to the motherboard, the first storage device may use a driving protocol resource, for example, the first storage device may correspond to a PHY resource of the driving protocol, where PHY refers to a physical layer in a hard disk driving protocol, and a typical driving controller supports 8 PHY resources, and the first storage device may correspond to one of the PHY resources, and due to the corresponding characteristics of the PHY resources and the first storage device, the ordering position of the first storage device may be determined by the PHY resources.
And processing a first symbol link corresponding to the mapping target under a first preset path according to the preset rule file. In some embodiments, because the mapping target is corresponding to each first storage device and the mapping target is unique, the correspondence between the first symbolic link and the mapping target indirectly reflects the correspondence between the first symbolic link and the slot, or the correspondence between the first symbolic link and the driving protocol resource. Therefore, when the first symbol link exists, the corresponding driving protocol resource is occupied, or the corresponding slot is occupied, so that the hardware resource or the software resource occupied by the first storage device can be intuitively represented. In some embodiments, to prevent confusion in the identification order caused by hot plug of the hard disk, the hard disk needs to be sorted fixedly. In order to avoid conflict with symbolic links generated by the system in a default file directory/dev/the device files under/dev/are subjected to symbolic links by using a preset rule file, namely a custom udev rule file in the ordering process. For example, when the system is started, all device systems connected to our hardware will perform device naming for each device in a default order, for example, the device connected to Phy0 under the system is described as dev/sda, in the predetermined rule file, the device name sda under the/dev/directory is not modified, but a symbolic link, such as/dev/scsi/sda, is created under the new directory.
In the technical scheme provided by the embodiment of the invention, the symbol link is mapped with the fixed hardware slot or mapped with the driving protocol resource, so that the connection position of the hard disk or the used resource can be directly determined through the symbol link. According to the technical scheme provided by the invention, the disorder of hard disk sequence identification caused by hot plug of the hard disk is avoided, the time is not required to be consumed to check which specific hard disk name corresponds to which hard disk interface on the equipment, the ordering of the multiple hard disks can be completed by only adding the program into the startup self-starting operation at one time, and the efficiency of the multiple hard disk equipment in the use process is improved.
As an alternative implementation manner, as shown in fig. 2, in the storage device ordering method, in some embodiments, when a first device is hot plugged, a device event is represented by a device addition event or a device deletion event, respectively, and hot plug, i.e. hot plug, refers to that a module and a board card are plugged into or pulled out of a system without shutting down a system power supply, so that normal operation of the system is not affected.
When the device event is a device delete event; in some embodiments, the device delete event refers to the first storage device being unplugged without powering down the system.
Processing a first symbol link corresponding to the mapping target includes: deleting the first symbol link; in some embodiments, since the first symbolic link is in one-to-one correspondence with the hardware slot or the driving protocol resource, when the first symbolic link exists, it indicates that the corresponding slot is occupied or the corresponding driving protocol resource is occupied, and when the first symbolic link is deleted, it indicates that the corresponding slot or driving protocol resource is released. Therefore, the released slot or the driving protocol resource can be determined through the deleted first symbol link, and the ordering position of the pulled first storage device can be further confirmed. It should be noted that since each symbolic link is in a one-to-one correspondence with the ordering location of the corresponding storage device, the other symbolic links should remain unchanged after deleting the first symbolic link, so that the ordering location of the remaining hard disk can be determined by the remaining symbolic links.
When the device event is a device add event; in some embodiments, the device add event refers to the insertion of the first storage device without powering down the system.
Processing a first symbol link corresponding to the mapping target includes: and establishing the first symbol link. In some embodiments, since the first symbolic link is in one-to-one correspondence with the hardware slot or the driving protocol resource, when the first symbolic link exists, it indicates that the corresponding slot is occupied or the corresponding driving protocol resource is occupied, and when the first symbolic link is newly built, it indicates that the corresponding slot or the driving protocol resource is occupied. Therefore, the released slot or the driving protocol resource can be determined through the newly-built first symbol link, and the ordering position of the inserted first storage device can be further confirmed. It should be noted that since each symbolic link is in one-to-one correspondence with the ordering position of the corresponding storage device, after the first symbolic link is newly created, the other symbolic links should remain unchanged, so that the ordering position of the remaining hard disk can be determined by the remaining symbolic links.
In this embodiment, the arrangement order of the storage devices can be confirmed by the correspondence relation between the storage devices and the symbol links, and the newly added or deleted storage device creates or deletes the corresponding symbol link without affecting other symbol links, so that the newly added or deleted first storage device does not affect the overall ordering of the storage devices.
As an alternative embodiment, as shown in fig. 3, when the predetermined rule file does not exist, the second symbolic link corresponding to the first storage device is processed according to the default rule under the second predetermined path. In some embodiments, in some application scenarios, only symbol links with custom rules need to be performed on some storage devices, so, for storage devices other than some storage devices, a default rule may be applied to process a second symbol link corresponding to the first storage device. For example, LINUX UDEV rules define kernel device names for all devices under the/dev/path through a default rule file, naming a second symbolic link with the kernel device name, such as/dev/sda,/dev/sdb, etc.
As an alternative embodiment, as shown in fig. 4, when a predetermined rule file does not exist, performing the storage device ordering method includes:
When the device event is a device delete event; in some embodiments, the device delete event refers to the first storage device being unplugged without powering down the system.
Processing the second symbol link corresponding to the first storage device includes: deleting a second symbol link corresponding to the first storage device according to a default rule, and updating the symbol links corresponding to the storage devices outside the first storage device; in some embodiments, according to a default rule, when deleting the first storage device, the second symbolic link corresponding to the first storage device is deleted, and at the same time, other symbolic links except the second symbolic link are reordered.
When the device event is a device add event; in some embodiments, the device addition event refers to the insertion of the first storage device without powering down the system.
Processing the second symbol link corresponding to the first storage device includes: and establishing a second symbol link corresponding to the first storage device according to a default rule. In some embodiments, when the second symbol link corresponding to the first storage device is established, no matter which slot is currently inserted, or which driving protocol resource is occupied, a new second symbol link is established after the other symbol link sequences.
In this embodiment, under a partial application scenario, only a symbol link of a custom rule needs to be performed on a part of storage devices, so that, for a storage device other than a part of storage devices, a default rule may be applied to process a second symbol link corresponding to the first storage device. The embodiment provides a specific method for establishing and deleting the second symbol link according to a default rule.
As an alternative embodiment, searching the rule file directory for the predetermined rule file includes:
According to more than one key value pair of the first storage device, the matching device adds a preset rule corresponding to the event; in some embodiments, a key-value pair of a first storage device refers to an attribute of the first storage device and a corresponding attribute value, e.g., a name field of the first storage device and a name of the first storage device. The first storage device and the predetermined rule may be matched in a plurality of key-value pairs during the lookup process.
When more than one key value pair is the same as the key value pairs in the rule file, determining that the corresponding rule file is a preset rule; in some embodiments, when the key value pairs in the first storage device are identical to the key value pairs in the rule file, it may be confirmed that the corresponding rule file may be applied to establishment and deletion of the symbolic link of the first storage device.
When more than one key value pair is different from the key value pairs in the rule file, it is determined that the predetermined rule file does not exist. In some embodiments, when one of the plurality of key-value pairs in the first storage device is different from the rule file, it is determined that the rule file cannot be applied to establishment and deletion of symbolic links of the first storage device.
In this embodiment, a specific rule matching method is provided, in which a rule file may be matched by using only one key value pair, and at this time, the matching efficiency may be higher. Multiple key value pairs may also be used to match rule files, where the matching efficiency may be lower, but the matching accuracy may be higher.
As an alternative embodiment, further comprising:
Partitioning, formatting or mounting the first symbol connection, or performing hot plug operation on the first storage device; the first symbolic link is partitioned, formatted or mounted, and if the operation can be performed correctly, the establishment of the first symbolic link is indicated to be accurate. Or when the first storage device is subjected to hot plug operation, whether the predetermined rule can be correctly executed or not can be judged through the state of establishment and deletion of the first symbol link.
And inquiring a log file corresponding to the partition, formatting, mounting or hot plug operation to verify whether the preset rule is effective. In some embodiments, when operating the storage device, the system may generate a log file, through which the operation results of various operations can be obtained. For example, a plug test is performed on the hard disk at the Phy0 port, and after the system is started, the temporary log file/tmp/udev.log is checked for information printed in, and whether the sda device exists in the dev/scsi directory. Thereby determining whether the predetermined rule of the sda hard disk is valid. For example, after 5 partitions of the/dev/scsi/sdg are completed, sdg, sdg, sdg, sdg, sdg are checked to see the information printed in the temporary log file/tmp/udev.log, see if there are sdg five partitions under the/dev/scsi directory, if the 5 partitions can be formatted, and if the 5 partitions can be mounted by mount. Thereby confirming sdg whether the hard disk predetermined rule is valid or not through these operations.
As an alternative embodiment, further comprising: storing a preset rule file in a storage path of the rule file, and configuring the preset rule file into a startup self-starting state. The predetermined rule file may be initialized prior to execution, for example, by adding the predetermined rule file 10-disk.rule to UDEV the default storage path/etc/udev/rule.d/usr/lib/udev/rule.d/for the rule file. The pre-determined rule file is reloaded udev in a power-on self-start-up using udevadmin. Copying and copying the program copy corresponding to the storage device ordering method to a system catalog, for example, installing under a/home catalog, and restarting the system after the installation is finished.
As an optional implementation manner, when a predetermined rule file exists, the device type of the first storage device is obtained, and slot resource information or driving protocol resource information corresponding to the first storage device is obtained according to the first device type to determine a mapping target. In some embodiments, when the hard disk is connected to the motherboard, the hard disk may be directly connected to the motherboard, or may be formed into a disk array by an array card and connected to the motherboard. Before determining the mapping target, a corresponding predetermined rule file needs to be acquired, and when determining the predetermined rule file, the acquired key value pair usually includes the drive name of the first storage device, so that the mapping target needs to be determined according to different device types, for example, when no disk array card is used, the hard disk drive name of the key value pair of the first storage device is AHCI; when the disk array card exists, the name of the corresponding driver of the first storage device in the key value pair of the used first storage device is mpt SAs.
As an optional implementation manner, when the device type of the first storage device is a disk array card, the disk array card is in communication connection with a plurality of hard disks; and obtaining slot resource information or driving protocol resource information corresponding to the disk array card so as to determine a mapping target. In some embodiments, when the system is started and has a disk array card, the disk array card is connected with the hard disk to form a logical hard disk, only one hard disk identifier is seen under the system/dev, and when a new fixed rule is formulated, a symbol link is created under a new file directory according to the device name read by the system, if two hard disks connected under the disk array card are/dev/scsi/sdd,/dev/scsi/sdf; when the data are combined into a disk array, the device name read by the system is sdx; the disk link corresponding to the created disk array is/dev/scsi/sdx and the operation/dev/scsi/sdx may be operated to the disk array. During debugging, a plugging test is carried out on the RAID hard disk group at the Phy3 port, after the system is started, the information printed in the temporary log file/tmp/udev.log is checked, and whether sdx equipment exists under the v/scsi directory or not is checked. Thereby determining whether the rule after RAID group is valid. The method can also divide the/dev/scsi/sdx into 5 areas, after the 5 areas of sdx, sdx, sdx3, sdx, sdx are finished, check the information printed in the temporary log file/tmp/udev.log, check whether there are five areas of sdx under the/dev/scsi directory, and then judge whether the 5 areas can be formatted or not and mount the 5 areas or not through operations such as mkfs and mount instructions.
As an optional implementation manner, when the device type of the first storage device is a hard disk; and obtaining slot resource information or drive protocol resource information corresponding to the hard disk so as to determine a mapping target. In some embodiments, when the system is started, the device name sda under the/dev/directory is not modified according to a predetermined rule, but a symbolic link, such as/dev/scsi/sda, is created under the new directory. During debugging, a plugging test is carried out on a hard disk at the Phy0 port, after a system is started, the information printed in a temporary log file/tmp/udev.log is checked, and whether the sda equipment exists in the record of the dev/scsi. Thereby judging whether the rules of the sda hard disk are valid. Or dividing the/dev/scsi/sdg into 5 areas, after finishing the sdg, sdg, sdg3, sdg, sdg5 areas, checking the information printed in the temporary log file/tmp/udev.log, checking whether there are sdg five areas under the/dev/scsi directory, whether the 5 areas can be formatted, and whether the 5 areas can be mounted by mount. Thereby confirming sdg whether the hard disk rule is valid or not through these operations.
The storage device ordering method is described by a specific embodiment as follows:
Embodiment 1:
In the case of a diskless array card, the ordering of the plurality of hard disks is shown in the following table 1, the script does not modify the device description under the dev directory, only symbol links under the dev/scsi directory in a fixed order are determined according to the occupation relation of the drive protocol resources, the link files under the operation/dev/scsi directory such as partitioning, formatting or mounting are operated to the designated hard disk, the hard disk is plugged and unplugged, the existence of the hard disk is displayed at the dev/scsi, and the hard disk order is displayed.
TABLE 1
Phy0:/dev/scsi/sda Phy2:/dev/scsi/sdc Phy4:/dev/scsi/sde Phy6:/dev/scsi/sdg
Phy1:/dev/scsi/sdb Phy3:/dev/scsi/sdd Phy5:/dev/scsi/sdf Phy7:/dev/scsi/sdh
Embodiment 2:
When the disk array card is provided, a disk array can be assembled on the disk array card, a group of disk arrays are supposed to be made on the disk array card, for example, the disk arrays of two hard disks are supposed to be made, and the hard disks for making the disk arrays are supposed to be/dev/scsi/sdd and/dev/scsi/sdf, so that the following links can be seen under the/dev/scsi directory after the ordering:
/dev/scsi/sda
/dev/scsi/sdb
/dev/scsi/sdc
/dev/scsi/sde
/dev/scsi/sdg
/dev/scsi/sdh
/dev/scsi/sdx
Wherein/dev/scsi/sdx is the symbolic link of the disk array, wherein the disk array card occupies the resources of Phy3, phy5 is not connected to any storage device, and at this time, the operation/dev/scsi/sdx can operate to the disk array. The specific ordering relationship may be as shown in table 2:
TABLE 2
Phy0:/dev/scsi/sda Phy2:/dev/scsi/sdc Phy4:/dev/scsi/sde Phy6:/dev/scsi/sdg
Phy1:/dev/scsi/sdb Phy3:/dev/scsi/sdx Phy7:/dev/scsi/sdh
Embodiment 3:
The disk array card can be used for two groups of disk arrays, and is assumed that two hard disks at positions of/dev/scsi/sdc and/dev/scsi/sdd are used as disk arrays and are named as sdx,/dev/scsi/sde,/dev/scsi/sdf,/dev/scsi/sdg,/dev/scsi/sdh are used as disk arrays and are named as sdy, wherein the disk array card corresponding to sdx occupies the resource of Phy2, the disk array card corresponding to sdy occupies the resource of Phy4, and then the ordered disk array card can be seen under the catalog of/dev/scsi:
/dev/scsi/sda
/dev/scsi/sdb
/dev/scsi/sdx
/dev/scsi/sdy
the specific ordering relationship may be as shown in table 3:
TABLE 3 Table 3
Phy0:/dev/scsi/sda Phy2:/dev/scsi/sdx Phy4:/dev/scsi/sdy
Phy1:/dev/scsi/sdb
Embodiment 4:
in the case of a diskless array card, the ordering of the plurality of hard disks is shown in the following table 1, the script does not modify the device description under the dev directory, only symbol links under the dev/scsi directory in a fixed order are determined according to the occupation relation of the drive protocol resources, the link files under the operation/dev/scsi directory such as partitioning, formatting or mounting are operated to the designated hard disk, the hard disk is plugged and unplugged, the existence of the hard disk is displayed at the dev/scsi, and the hard disk order is displayed. In this embodiment, the correspondence between Phy0-Phy7 and sda-sdh does not need to be sequential, and may be in an out-of-order correspondence manner, see table 4 for details:
TABLE 4 Table 4
Phy0:/dev/scsi/sdc Phy2:/dev/scsi/sde Phy4:/dev/scsi/sdb Phy6:/dev/scsi/sdf
Phy1:/dev/scsi/sdg Phy3:/dev/scsi/sda Phy5:/dev/scsi/sdh Phy7:/dev/scsi/sdd
Those skilled in the art will appreciate that implementing all or part of the above-described method embodiments may be accomplished by way of computer programs, which may be stored on a computer readable storage medium, which when executed may comprise the steps of the method embodiments described above. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a random-access Memory (Random Access Memory, RAM), or the like.
The foregoing is merely illustrative of the present invention, and the present invention is not limited thereto, and any changes or substitutions easily contemplated by those skilled in the art within the scope of the present invention should be included in the present invention. Therefore, the protection scope of the present invention should be subject to the protection scope of the claims.

Claims (10)

1. A method for ordering storage devices, comprising:
acquiring a device event corresponding to a first storage device;
searching a preset rule file in a rule file directory;
when a predetermined rule file exists, it is determined,
Obtaining slot resource information or driving protocol resource information corresponding to the first storage device to determine a mapping target;
according to the preset rule file, processing a first symbol link corresponding to the mapping target under a first preset path;
Wherein, under a first predetermined path, processing a first symbol link corresponding to the mapping target includes: the device name under the default directory is kept unchanged and symbolic links are created under the new directory.
2. The method of claim 1, wherein,
When the device event is a device delete event;
processing a first symbol link corresponding to the mapping target includes: deleting the first symbol link;
when the device event is a device add event;
Processing a first symbol link corresponding to the mapping target includes: and establishing the first symbol link.
3. The storage device ordering method of claim 1, wherein when a predetermined rule file does not exist, processing a second symbolic link corresponding to the first storage device according to a default rule under a second predetermined path.
4. The method of claim 3, wherein,
When the device event is a device delete event;
processing the second symbol link corresponding to the first storage device includes: deleting a second symbol link corresponding to the first storage device according to a default rule, and updating the symbol links corresponding to the storage devices outside the first storage device;
when the device event is a device add event;
Processing the second symbol link corresponding to the first storage device includes: and establishing a second symbol link corresponding to the first storage device according to a default rule.
5. The storage device ordering method of claim 1, wherein searching for a predetermined rule file in a rule file directory comprises:
According to more than one key value pair of the first storage device, the matching device adds a preset rule corresponding to the event;
when more than one key value pair is the same as the key value pairs in the rule file, determining that the corresponding rule file is a preset rule;
When more than one key value pair is different from the key value pairs in the rule file, it is determined that the predetermined rule file does not exist.
6. The storage device ordering method of claim 1, further comprising:
Partitioning, formatting or mounting the first symbol connection, or performing hot plug operation on the first storage device;
And inquiring a log file corresponding to the partition, formatting, mounting or hot plug operation to verify whether the preset rule is effective.
7. The storage device ordering method of claim 1, further comprising:
Storing a preset rule file in a storage path of the rule file, and configuring the preset rule file into a startup self-starting state.
8. The storage device ordering method according to claim 1, wherein when a predetermined rule file exists, a device type of the first storage device is obtained, and slot resource information or driving protocol resource information corresponding to the first storage device is obtained according to the device type of the first storage device, so as to determine a mapping target.
9. The storage device ordering method according to claim 8, wherein when the device type of the first storage device is a disk array card, the disk array card is communicatively connected to a plurality of hard disks;
And obtaining slot resource information or driving protocol resource information corresponding to the disk array card so as to determine a mapping target.
10. The storage device ordering method according to claim 9, wherein when the device type of the first storage device is a hard disk;
and obtaining slot resource information or drive protocol resource information corresponding to the hard disk so as to determine a mapping target.
CN202111382430.0A 2021-11-19 2021-11-19 Storage device ordering method Active CN114063925B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111382430.0A CN114063925B (en) 2021-11-19 2021-11-19 Storage device ordering method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111382430.0A CN114063925B (en) 2021-11-19 2021-11-19 Storage device ordering method

Publications (2)

Publication Number Publication Date
CN114063925A CN114063925A (en) 2022-02-18
CN114063925B true CN114063925B (en) 2024-09-17

Family

ID=80278738

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111382430.0A Active CN114063925B (en) 2021-11-19 2021-11-19 Storage device ordering method

Country Status (1)

Country Link
CN (1) CN114063925B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114816918A (en) * 2022-04-25 2022-07-29 苏州浪潮智能科技有限公司 NVME hard disk sequencing method, system, equipment and storage medium based on BMC

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103761202A (en) * 2014-02-18 2014-04-30 深圳英飞拓科技股份有限公司 Data storage node hard disk position identification method and system

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7610295B2 (en) * 2002-10-01 2009-10-27 Hewlett-Packard Development Company, L.P. Method and apparatus for generating persistent path identifiers
US20040088294A1 (en) * 2002-11-01 2004-05-06 Lerhaupt Gary S. Method and system for deploying networked storage devices
CN1258713C (en) * 2003-11-14 2006-06-07 清华大学 Data distribution dynamic mapping method based on magnetic disc characteristic
KR100563658B1 (en) * 2003-11-20 2006-03-23 한국전자통신연구원 Link Aggregation Device and Method
CN105657464B (en) * 2016-01-28 2018-12-07 四川长虹电器股份有限公司 A kind of screen method of USB duplicate node
CN107247672A (en) * 2017-05-03 2017-10-13 深圳市同泰怡信息技术有限公司 Pass through the method for udev and expander relevant interface hyperdisks
CN107807791A (en) * 2017-10-20 2018-03-16 郑州云海信息技术有限公司 A kind of hard disc of computer sequence binding method and system
US10866963B2 (en) * 2017-12-28 2020-12-15 Dropbox, Inc. File system authentication
CN109189342B (en) * 2018-08-30 2021-07-16 郑州云海信息技术有限公司 Disk mounting method, device, device and storage medium

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103761202A (en) * 2014-02-18 2014-04-30 深圳英飞拓科技股份有限公司 Data storage node hard disk position identification method and system

Also Published As

Publication number Publication date
CN114063925A (en) 2022-02-18

Similar Documents

Publication Publication Date Title
CN112256558B (en) Test case generation method and device, computer equipment and storage medium
CN110879712B (en) Cloud data center physical host installation method and related device
US8150674B2 (en) Automated testing platform for event driven systems
CN111737227B (en) Data modification method and system
WO2021174817A1 (en) Database automated auditing method and system, device, and storage medium
CN103677650A (en) Drive letter drifting preventing and treating method and device
CN114333977A (en) Method and device for testing solid state disk, computer storage medium and terminal
CN114063925B (en) Storage device ordering method
CN104731617A (en) Server starting device determining method
CN100395727C (en) Media access control address burning method
CN113835762A (en) Method and system for updating default configuration of hard disk backplane
CN117215602A (en) Method, device, computer equipment and storage medium for updating drive program
CN116880872A (en) Cluster firmware combination upgrading method, system, terminal and storage medium
JP4613598B2 (en) Disk system
CN114020306B (en) A method, device, electronic device and storage medium for updating hard disk firmware
CN120581060A (en) A stability testing method, system, device and storage medium for UFS devices
CN114443060A (en) Operating system deployment method and system
CN109783031B (en) Method, device, terminal and storage medium for checking drive letter and slot number of RAID card
CN115757099B (en) Automatic testing method and device for platform firmware protection and recovery function
CN118069166A (en) Security system installation method, device, system, electronic equipment and storage medium
CN116524987A (en) RPMB test method, device, computer equipment and storage medium
CN114610644A (en) Method and device for testing database
CN114153507A (en) A control method and device, and storage medium
CN119922200B (en) Node online method, device, server and storage medium
CN117234424A (en) Storage cluster metadata management method, system and device for distributed storage

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
TA01 Transfer of patent application right

Effective date of registration: 20230627

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

Applicant after: Yanxiang smart IOT Technology Co.,Ltd.

Address before: No.1, Yanxiang Zhigu chuangxiangdi, No.11, Gaoxin Road, Guangming New District, Shenzhen, Guangdong 518107

Applicant before: EVOC INTELLIGENT TECHNOLOGY Co.,Ltd.

TA01 Transfer of patent application right
GR01 Patent grant
GR01 Patent grant