CN113867810B - Method, device, terminal and storage medium for checking server hard disk topology - Google Patents

Method, device, terminal and storage medium for checking server hard disk topology Download PDF

Info

Publication number
CN113867810B
CN113867810B CN202111005446.XA CN202111005446A CN113867810B CN 113867810 B CN113867810 B CN 113867810B CN 202111005446 A CN202111005446 A CN 202111005446A CN 113867810 B CN113867810 B CN 113867810B
Authority
CN
China
Prior art keywords
hard disk
server
information
operating system
command
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
CN202111005446.XA
Other languages
Chinese (zh)
Other versions
CN113867810A (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.)
Suzhou Inspur Intelligent Technology Co Ltd
Original Assignee
Suzhou Inspur 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 Suzhou Inspur Intelligent Technology Co Ltd filed Critical Suzhou Inspur Intelligent Technology Co Ltd
Priority to CN202111005446.XA priority Critical patent/CN113867810B/en
Publication of CN113867810A publication Critical patent/CN113867810A/en
Application granted granted Critical
Publication of CN113867810B publication Critical patent/CN113867810B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/4401Bootstrapping
    • G06F9/4406Loading of operating system
    • G06F9/441Multiboot arrangements, i.e. selecting an operating system to be loaded
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/22Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing
    • G06F11/2205Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing using arrangements specific to the hardware being tested
    • G06F11/2221Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing using arrangements specific to the hardware being tested to test input/output devices or peripheral units
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/22Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing
    • G06F11/2289Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing by configuration test
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Computer Security & Cryptography (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention provides a method, a device, a terminal and a storage medium for checking the hard disk topology of a server, wherein the method comprises the following steps: s1, configuring a second operating system guiding module for a server, and guiding the server to enter a linux operating system through the second operating system guiding module; s2, collecting server hard disk information under a linux system, acquiring hard disk types and various types of hard disk information, and analyzing the collected server hard disk information; s3, judging a physical link where the hard disk is located according to the analysis result of the server hard disk information, generating a hard disk topological structure, and outputting the hard disk topological structure according to a preset mode. According to the method, the device, the terminal and the storage medium for checking the server hard disk topology, provided by the invention, the physical link of the server hard disk is acquired through the linux command, so that the server hard disk topology can be checked and output quickly, the result is clear, the readability is high, the hard disk fault problem can be analyzed, and the working efficiency is improved.

Description

Method, device, terminal and storage medium for checking server hard disk topology
Technical Field
The invention belongs to the technical field of server testing, and particularly relates to a method, a device, a terminal and a storage medium for checking server hard disk topology.
Background
With the development of server technology, the existing server is more and more complex, if we want to quickly acquire the hard disk topology of one server, we want to know how many hard disks are in the server, whether a raid card or an SAS card is used in the server, and whether an expansion card backboard is connected in the server. The existing methods for obtaining the hard disk topology of the server mainly comprise two modes:
firstly, look over cable and the integrated circuit board of hard disk connection through the mode of unpacking the server machine case, this kind of mode only professional technician can operate, looks over connecting cable and integrated circuit board moreover hard disk one by one, and inefficiency especially to large-scale server, adopts this kind of mode to need fairly big work load, and is difficult to realize.
Secondly, entering an operating system, and deducing the hard disk topology through a server hard disk initialization log and command output information for checking hard disk information. Taking a linux operating system as an example, a linux command is required to be used for checking the hard disk information and dmesg log information to search the hard disk gradually, but the physical link operation of using the linux command and dmesg log information to search the hard disk is complex, only one hard disk can be checked at a time, and the workload is still large and the time is long when the number of the hard disks on a server is large.
This is a deficiency of the prior art, and therefore, it is necessary to provide a method, apparatus, terminal and storage medium for viewing the topology of a server hard disk, in order to address the above-mentioned drawbacks of the prior art.
Disclosure of Invention
Aiming at the defects of large workload and long time consumption of the prior art for acquiring the server hard disk topology, the invention provides a method, a device, a terminal and a storage medium for checking the server hard disk topology, so as to solve the technical problems.
In a first aspect, the present invention provides a method for viewing a server hard disk topology, comprising the steps of:
s1, configuring a second operating system guiding module for a server, and guiding the server to enter a linux operating system through the second operating system guiding module;
s2, collecting server hard disk information under a linux system, acquiring hard disk types and various types of hard disk information, and analyzing the collected server hard disk information;
s3, judging a physical link where the hard disk is located according to the analysis result of the server hard disk information, generating a hard disk topological structure, and outputting the hard disk topological structure according to a preset mode.
Further, the specific steps of step S1 are as follows:
s11, a reserved space is arranged in the storage of the server, and a simplified linux operating system is installed in the reserved space;
s12, creating a guide interface for the simplified linux operating system, and generating a second operating system guide module;
s13, when the hard disk topology of the server needs to be acquired, the server is guided to enter a linux operating system through a second operating system guiding module. The simplified linux can ensure the basic function of checking the information of the hard disk, and save the storage space.
Further, in step S11, a thin linux operating system is installed in a removable storage medium, and the removable storage medium is inserted into a server. The movable storage medium can be provided with the linux operating system in advance, and is spliced with the server when in use, so that convenience and flexibility are realized, and portability is enhanced.
Further, the removable storage medium adopts a USB flash disk. Removable storage media are not limited to USB flash drives, but TF cards or removable hard disks may be used, and USB flash drives are generally selected for cost and capacity considerations.
Further, the specific steps of step S2 are as follows:
s21, listing all block devices and block device types in a tree shape through an lsblk command under a linux operating system;
s22, screening out hard disk equipment and corresponding hard disk types from the block equipment, and checking the information of the hard disk equipment according to the hard disk types through a udevidm command;
s23, querying all PCI devices of the server through the lspci command, and analyzing the hard disk device information acquired by the udevidm command. And (3) listing block equipment through a lsblk command, checking information of the hard disk block equipment through a udevidm command, listing PCI equipment through a lspci command, and analyzing the information of the hard disk equipment according to the information acquired by the three linux commands, so that a hard disk topology is obtained, and a specific analysis process is carried out in step S3.
Further, the specific steps of step S3 are as follows:
s31, searching physical link information of the hard disk and PCI device bus information connected with the hard disk in the hard disk device information through a udeveadm command;
s32, analyzing physical links of the hard disks according to PCI device bus information and all PCI device information acquired by the lspci command, and generating a hard disk topological structure;
s33, judging whether the server is matched with the expansion backboard;
if yes, go to step S34;
if not, go to step S35;
s34, acquiring a hard disk matched with the expansion backboard, adding the expansion backboard and a corresponding hard disk to a hard disk topological structure, and outputting expansion backboard information;
s35, outputting the hard disk topological structure according to a preset mode. And obtaining a physical link where the hard disk is located according to the PCI equipment and the PCI equipment bus information, and recording the expansion backboard and the hard disk on the expansion backboard for a server with the expansion backboard.
Further, the specific steps of step S35 are as follows:
s351, processing the hard disk topological structure corresponding to the awk command and the sed command to generate a hard disk topological structure to be output;
s352, printing and outputting the physical links of all the hard disks in the hard disk topological structure to be output. The awk command and the sed command realize the control of the line of the output information, and the readability of the result is enhanced.
In a second aspect, the present invention provides an apparatus for viewing a server hard disk topology, comprising:
the linux operating system guiding unit is used for configuring a second operating system guiding module for the server, and guiding the server to enter the linux operating system through the second operating system guiding module;
the server hard disk information collection unit is used for collecting server hard disk information under a linux system, obtaining hard disk types and various types of hard disk information, and analyzing the collected server hard disk information;
the server hard disk topological structure output unit is used for judging the physical link where the hard disk is located according to the server hard disk information analysis result, generating a hard disk topological structure and outputting the hard disk topological structure according to a preset mode.
Further, the linux operating system booting unit includes:
the linux operating system installation subunit is used for setting a reserved space in the storage of the server and installing a simplified linux operating system in the reserved space;
the operating system guide module generating subunit is used for creating a guide interface for the simplified linux operating system and generating a second operating system guide module;
and the linux operating system guiding subunit is used for guiding the server to enter the linux operating system through the second operating system guiding module when the hard disk topology of the server needs to be acquired.
Further, the server hard disk information collecting unit includes:
a block device query subunit, configured to list all block devices and block device types in a tree form through an lsblk command under a linux operating system;
the hard disk device query subunit is used for screening out hard disk devices and corresponding hard disk types from the block devices, and checking the information of the hard disk devices according to the hard disk types through a udevidm command;
and the hard disk device information analysis subunit is used for analyzing the hard disk device information acquired by the udevidm command through the lspci command to inquire all PCI devices of the server.
Further, the server hard disk topology output unit includes:
the PCI device bus information inquiry subunit is used for searching physical link information of the hard disk and PCI device bus information connected with the hard disk in the hard disk device information through a udevidm command;
the hard disk topological structure generation subunit is used for analyzing physical links where all the hard disks are located according to PCI device bus information and all PCI device information acquired by the lspci command to generate a hard disk topological structure;
the expansion backboard judging subunit is used for judging whether the server is matched with the expansion backboard or not;
the backboard information adding subunit is used for acquiring a hard disk matched with the expansion backboard when the server reaches the expansion backboard, adding the expansion backboard and a corresponding hard disk to a hard disk topological structure, and outputting expansion backboard information;
the topological structure output subunit is used for outputting the hard disk topological structure according to a preset mode.
Further, the topology output subunit includes:
the hard disk topology processing component is used for processing the hard disk topology corresponding to the awk command and the sed command to generate a hard disk topology to be output;
and the hard disk physical link output component is used for printing and outputting the physical links of all the hard disks in the hard disk topological structure to be output.
In a third aspect, a terminal is provided, including: a processor, a memory, and a memory,
wherein the memory is configured to store a computer program and the processor is configured to invoke and run the computer program from the memory, so that the terminal performs the method according to the first aspect.
In a fourth aspect, there is provided a computer storage medium having instructions stored therein which, when run on a computer, cause the computer to perform the method of the first aspect described above.
The invention has the advantages that,
according to the method, the device, the terminal and the storage medium for checking the server hard disk topology, provided by the invention, the physical link of the server hard disk is acquired through the linux command, so that the server hard disk topology can be checked and output quickly, the result is clear, the readability is high, the hard disk fault problem can be analyzed, and the working efficiency is improved.
In addition, the invention has reliable design principle, simple structure and very wide application prospect.
It can be seen that the present invention has outstanding substantial features and significant advances over the prior art, as well as the benefits of its implementation.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings that are required to be used in the description of the embodiments or the prior art will be briefly described below, and it will be obvious to those skilled in the art that other drawings can be obtained from these drawings without inventive effort.
Fig. 1 is a flow chart of a method of viewing a server hard disk topology according to the present invention.
Fig. 2 is a flow chart of a method for viewing a server hard disk topology according to the present invention.
Fig. 3 is a flowchart of a method for viewing a server hard disk topology according to the present invention.
Fig. 4 is a schematic diagram of an apparatus of the present invention for viewing a server hard disk topology.
In the figure, a 1-linux operating system guiding unit; 1.1-linux operating system installation subunits; 1.2-operating system boot module generation subunit; 1.3-linux operating system boot subunits; 2-a server hard disk information collection unit; 2.1-a block device query subunit; 2.2-a hard disk device query subunit; 2.3-a hard disk device information parsing subunit; 3-a server hard disk topology output unit; 3.1-PCI device bus information inquiry subunit; 3.2-a hard disk topology generation subunit; 3.3-an expansion backboard judging subunit; 3.4-a backplane information adding subunit; 3.5-topology output subunits.
Detailed Description
In order to make the technical solution of the present invention better understood by those skilled in the art, the technical solution 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 present invention without making any inventive effort, shall fall within the scope of the present invention.
Example 1:
as shown in fig. 1, the present invention provides a method for viewing a server hard disk topology, comprising the following steps:
s1, configuring a second operating system guiding module for a server, and guiding the server to enter a linux operating system through the second operating system guiding module;
s2, collecting server hard disk information under a linux system, acquiring hard disk types and various types of hard disk information, and analyzing the collected server hard disk information;
s3, judging a physical link where the hard disk is located according to the analysis result of the server hard disk information, generating a hard disk topological structure, and outputting the hard disk topological structure according to a preset mode.
According to the method for checking the server hard disk topology, provided by the invention, the physical link of the server hard disk is acquired through the linux command, so that the server hard disk topology can be checked and output quickly, the result is clear, the readability is high, the problem of hard disk faults can be analyzed, and the working efficiency is improved.
Example 2:
as shown in fig. 2, the present invention provides a method for viewing a server hard disk topology, comprising the following steps:
s1, configuring a second operating system guiding module for a server, and guiding the server to enter a linux operating system through the second operating system guiding module; the method comprises the following specific steps:
s11, a reserved space is arranged in the storage of the server, and a simplified linux operating system is installed in the reserved space;
s12, creating a guide interface for the simplified linux operating system, and generating a second operating system guide module;
s13, when the hard disk topology of the server needs to be acquired, the server is guided to enter a linux operating system through a second operating system guiding module;
s2, collecting server hard disk information under a linux system, acquiring hard disk types and various types of hard disk information, and analyzing the collected server hard disk information; the method comprises the following specific steps:
s21, listing all block devices and block device types in a tree shape through an lsblk command under a linux operating system;
s22, screening out hard disk equipment and corresponding hard disk types from the block equipment, and checking the information of the hard disk equipment according to the hard disk types through a udevidm command;
s23, inquiring all PCI devices of the server through the lspci command, and analyzing the hard disk device information acquired by the udevidm command;
s3, judging a physical link where the hard disk is located according to a server hard disk information analysis result, generating a hard disk topological structure, and outputting the hard disk topological structure according to a preset mode; the method comprises the following specific steps:
s31, searching physical link information of the hard disk and PCI device bus information connected with the hard disk in the hard disk device information through a udeveadm command;
s32, analyzing physical links of the hard disks according to PCI device bus information and all PCI device information acquired by the lspci command, and generating a hard disk topological structure;
s33, judging whether the server is matched with the expansion backboard;
if yes, go to step S34;
if not, go to step S35;
s34, acquiring a hard disk matched with the expansion backboard, adding the expansion backboard and a corresponding hard disk to a hard disk topological structure, and outputting expansion backboard information;
s35, outputting the hard disk topological structure according to a preset mode.
Example 3:
as shown in fig. 2, the present invention provides a method for viewing a server hard disk topology, comprising the following steps:
s1, configuring a second operating system guiding module for a server, and guiding the server to enter a linux operating system through the second operating system guiding module; the method comprises the following specific steps:
s11, installing a simplified linux operating system in a removable storage medium, and inserting the removable storage medium into a server; the movable storage medium can adopt a movable hard disk and a U disk; based on price and portability considerations, U disk is generally adopted;
s12, creating a guide interface for the simplified linux operating system, and generating a second operating system guide module;
s13, when the hard disk topology of the server needs to be acquired, the server is guided to enter a linux operating system through a second operating system guiding module;
s2, collecting server hard disk information under a linux system, acquiring hard disk types and various types of hard disk information, and analyzing the collected server hard disk information; the method comprises the following specific steps:
s21, listing all block devices and block device types in a tree shape through an lsblk command under a linux operating system;
s22, screening out hard disk equipment and corresponding hard disk types from the block equipment, and checking the information of the hard disk equipment according to the hard disk types through a udevidm command;
s23, inquiring all PCI devices of the server through the lspci command, and analyzing the hard disk device information acquired by the udevidm command;
s3, judging a physical link where the hard disk is located according to a server hard disk information analysis result, generating a hard disk topological structure, and outputting the hard disk topological structure according to a preset mode; the method comprises the following specific steps:
s31, searching physical link information of the hard disk and PCI device bus information connected with the hard disk in the hard disk device information through a udeveadm command;
s32, analyzing physical links of the hard disks according to PCI device bus information and all PCI device information acquired by the lspci command, and generating a hard disk topological structure;
s33, judging whether the server is matched with the expansion backboard;
if yes, go to step S34;
if not, go to step S35;
s34, acquiring a hard disk matched with the expansion backboard, adding the expansion backboard and a corresponding hard disk to a hard disk topological structure, and outputting expansion backboard information;
s35, outputting the hard disk topological structure according to a preset mode.
Example 4:
as shown in fig. 2 and 3, the present invention provides a method for viewing a server hard disk topology, comprising the steps of:
s1, configuring a second operating system guiding module for a server, and guiding the server to enter a linux operating system through the second operating system guiding module; the method comprises the following specific steps:
s11, a reserved space is arranged in the storage of the server, and a simplified linux operating system is installed in the reserved space;
s12, creating a guide interface for the simplified linux operating system, and generating a second operating system guide module;
s13, when the hard disk topology of the server needs to be acquired, the server is guided to enter a linux operating system through a second operating system guiding module;
s2, collecting server hard disk information under a linux system, acquiring hard disk types and various types of hard disk information, and analyzing the collected server hard disk information; the method comprises the following specific steps:
s21, listing all block devices and block device types in a tree shape through an lsblk command under a linux operating system;
s22, screening out hard disk equipment and corresponding hard disk types from the block equipment, and checking the information of the hard disk equipment according to the hard disk types through a udevidm command;
s23, inquiring all PCI devices of the server through the lspci command, and analyzing the hard disk device information acquired by the udevidm command;
s3, judging a physical link where the hard disk is located according to a server hard disk information analysis result, generating a hard disk topological structure, and outputting the hard disk topological structure according to a preset mode; the method comprises the following specific steps:
s31, searching physical link information of the hard disk and PCI device bus information connected with the hard disk in the hard disk device information through a udeveadm command;
s32, analyzing physical links of the hard disks according to PCI device bus information and all PCI device information acquired by the lspci command, and generating a hard disk topological structure;
s33, judging whether the server is matched with the expansion backboard;
if yes, go to step S34;
if not, go to step S35;
s34, acquiring a hard disk matched with the expansion backboard, adding the expansion backboard and a corresponding hard disk to a hard disk topological structure, and outputting expansion backboard information;
s35, outputting a hard disk topological structure according to a preset mode; the method comprises the following specific steps:
s351, processing the hard disk topological structure corresponding to the awk command and the sed command to generate to-be-input data
Outputting a hard disk topological structure;
s352, printing and outputting the physical links of all the hard disks in the hard disk topological structure to be output.
Example 5:
as shown in fig. 2 and 3, the present invention provides a method for viewing a server hard disk topology, comprising the steps of:
s1, configuring a second operating system guiding module for a server, and guiding the server to enter a linux operating system through the second operating system guiding module; the method comprises the following specific steps:
s11, a reserved space is arranged in the storage of the server, and a simplified linux operating system is installed in the reserved space;
s12, creating a guide interface for the simplified linux operating system, and generating a second operating system guide module;
s13, when the hard disk topology of the server needs to be acquired, the server is guided to enter a linux operating system through a second operating system guiding module;
s2, collecting server hard disk information under a linux system, acquiring hard disk types and various types of hard disk information, and analyzing the collected server hard disk information; the method comprises the following specific steps:
s21, listing all block devices and block device types in a tree shape through an lsblk command under a linux operating system; the lsblk command, without parameters, can be seen as all block devices on the server, and also can display the dependency between block devices, but it does not list the information of the RAM disk;
s22, screening out hard disk equipment and corresponding hard disk types from the block equipment, and checking the information of the hard disk equipment according to the hard disk types through a udevidm command; taking the sda hard disk type as an example, the implementation is realized by the following codes:
udevadm info/dev/sda
s23, inquiring all PCI devices of the server through the lspci command, and analyzing the hard disk device information acquired by the udevidm command; the lspci command is not added with parameters, all PCI device information of the server is displayed, PCI is a bus, devices connected through the PCI bus are PCI devices, and hard disks are usually connected through the PCI bus;
s3, judging a physical link where the hard disk is located according to a server hard disk information analysis result, generating a hard disk topological structure, and outputting the hard disk topological structure according to a preset mode; the method comprises the following specific steps:
s31, searching physical link information of the hard disk and PCI device bus information connected with the hard disk in the hard disk device information through a udeveadm command; the method is realized by the following codes:
udevadminfo/dev/sda|awk-F'/”NR==1{print$4}'
s32, analyzing physical links of the hard disks according to PCI device bus information and all PCI device information acquired by the lspci command, and generating a hard disk topological structure; the method is realized by the following codes:
lspci|grep`udevadminfo$i|awk-F'/”NR==1{print$4}'|sed-e's/0000://g'`
s33, judging whether the server is matched with the expansion backboard;
if yes, go to step S34;
if not, go to step S35;
step 33 is implemented by the following code:
Figure BDA0003236908090000131
s34, acquiring a hard disk matched with the expansion backboard, adding the expansion backboard and a corresponding hard disk to a hard disk topological structure, and outputting expansion backboard information;
s35, outputting a hard disk topological structure according to a preset mode; the method comprises the following specific steps:
s351, processing the hard disk topological structure corresponding to the awk command and the sed command to generate a hard disk topological structure to be output; the row outputs are controlled by the following code:
awk-F'/”NR==1{print$4}'|sed-e's/0000://g'
s352, printing out physical links of all hard disks in the hard disk topological structure to be output; the method is realized by the following codes:
foriin`ls/dev/sd[a-z]{1,2}`
do
echo$INFO$EXP$i|sort
done
the codes are in a form of for circulation, so that physical links of all hard disks are ensured to be printed out, and omission is prevented.
Example 6:
as shown in fig. 4, the present invention provides an apparatus for viewing a server hard disk topology, comprising:
the linux operating system guiding unit 1 is used for configuring a second operating system guiding module for the server, and guiding the server to enter the linux operating system through the second operating system guiding module;
the server hard disk information collection unit 2 is used for collecting server hard disk information under a linux system, obtaining hard disk types and various types of hard disk information, and analyzing the collected server hard disk information;
the server hard disk topology structure output unit 3 is configured to determine a physical link where the hard disk is located according to a server hard disk information analysis result, generate a hard disk topology structure, and output the hard disk topology structure according to a preset mode.
According to the device for checking the server hard disk topology, provided by the invention, the physical link of the server hard disk is acquired through the linux command, so that the server hard disk topology can be checked and output quickly, the result is clear, the readability is high, the problem of hard disk faults can be analyzed, and the working efficiency is improved.
Example 7:
as shown in fig. 4, the present invention provides an apparatus for viewing a server hard disk topology, comprising:
the linux operating system guiding unit 1 is used for configuring a second operating system guiding module for the server, and guiding the server to enter the linux operating system through the second operating system guiding module; the linux operating system booting unit 1 includes:
the linux operating system is provided with a subunit 1.1 which is used for setting a reserved space in the storage of the server and installing a simplified linux operating system in the reserved space;
the operating system guiding module generating subunit 1.2 is used for creating a guiding interface for the simplified linux operating system and generating a second operating system guiding module;
the linux operating system guiding subunit 1.3 is used for guiding the server to enter the linux operating system through the second operating system guiding module when the hard disk topology of the server needs to be acquired;
the server hard disk information collection unit 2 is used for collecting server hard disk information under a linux system, obtaining hard disk types and various types of hard disk information, and analyzing the collected server hard disk information; the server hard disk information collection unit 2 includes:
a block device query subunit 2.1, configured to list all block devices and block device types in a tree form through an lsblk command under a linux operating system;
the hard disk device query subunit 2.2 is used for screening out hard disk devices and corresponding hard disk types from the block devices, and checking the hard disk device information according to the hard disk types through a udevidm command;
the hard disk device information analysis subunit 2.3 is used for querying all PCI devices of the server through the lspci command and analyzing the hard disk device information acquired by the udevidm command;
the server hard disk topological structure output unit 3 is used for judging the physical link where the hard disk is located according to the analysis result of the server hard disk information, generating a hard disk topological structure and outputting the hard disk topological structure according to a preset mode; the server hard disk topology output unit 3 includes:
the PCI device bus information inquiry subunit 3.1 is used for searching physical link information of the hard disk and PCI device bus information connected with the hard disk in the hard disk device information through a udevidm command;
the hard disk topology structure generating subunit 3.2 is configured to analyze physical links where each hard disk is located according to the PCI device bus information and all PCI device information acquired by the lspci command, and generate a hard disk topology structure;
an expansion backboard judging subunit 3.3, configured to judge whether the server is collocated with the expansion backboard;
the backboard information adding subunit 3.4 is used for acquiring a hard disk matched with the expansion backboard when the server reaches the expansion backboard, adding the expansion backboard and a corresponding hard disk to a hard disk topological structure, and outputting expansion backboard information;
and the topology structure output subunit 3.5 is used for outputting the hard disk topology structure according to a preset mode.
Example 8:
as shown in fig. 4, the present invention provides an apparatus for viewing a server hard disk topology, comprising:
the linux operating system guiding unit 1 is used for configuring a second operating system guiding module for the server, and guiding the server to enter the linux operating system through the second operating system guiding module; the linux operating system booting unit 1 includes:
the linux operating system is provided with a subunit 1.1 which is used for setting a reserved space in the storage of the server and installing a simplified linux operating system in the reserved space;
the operating system guiding module generating subunit 1.2 is used for creating a guiding interface for the simplified linux operating system and generating a second operating system guiding module;
the linux operating system guiding subunit 1.3 is used for guiding the server to enter the linux operating system through the second operating system guiding module when the hard disk topology of the server needs to be acquired;
the server hard disk information collection unit 2 is used for collecting server hard disk information under a linux system, obtaining hard disk types and various types of hard disk information, and analyzing the collected server hard disk information; the server hard disk information collection unit 2 includes:
a block device query subunit 2.1, configured to list all block devices and block device types in a tree form through an lsblk command under a linux operating system;
the hard disk device query subunit 2.2 is used for screening out hard disk devices and corresponding hard disk types from the block devices, and checking the hard disk device information according to the hard disk types through a udevidm command;
the hard disk device information analysis subunit 2.3 is used for querying all PCI devices of the server through the lspci command and analyzing the hard disk device information acquired by the udevidm command;
the server hard disk topological structure output unit 3 is used for judging the physical link where the hard disk is located according to the analysis result of the server hard disk information, generating a hard disk topological structure and outputting the hard disk topological structure according to a preset mode; the server hard disk topology output unit 3 includes:
the PCI device bus information inquiry subunit 3.1 is used for searching physical link information of the hard disk and PCI device bus information connected with the hard disk in the hard disk device information through a udevidm command;
the hard disk topology structure generating subunit 3.2 is configured to analyze physical links where each hard disk is located according to the PCI device bus information and all PCI device information acquired by the lspci command, and generate a hard disk topology structure;
an expansion backboard judging subunit 3.3, configured to judge whether the server is collocated with the expansion backboard;
the backboard information adding subunit 3.4 is used for acquiring a hard disk matched with the expansion backboard when the server reaches the expansion backboard, adding the expansion backboard and a corresponding hard disk to a hard disk topological structure, and outputting expansion backboard information;
the topology structure output subunit 3.5 is used for outputting the hard disk topology structure according to a preset mode; the topology output subunit 3.5 comprises:
the hard disk topology processing component is used for processing the hard disk topology corresponding to the awk command and the sed command to generate a hard disk topology to be output;
and the hard disk physical link output component is used for printing and outputting the physical links of all the hard disks in the hard disk topological structure to be output.
Example 9:
the invention provides a terminal, comprising: a processor, a memory, and a memory,
wherein the memory is used for storing a computer program, and the processor is used for calling and running the computer program from the memory, so that the terminal executes the method described in the above embodiment 1 or embodiment 2 or embodiment 3 or embodiment 4 or embodiment 5.
Example 10:
the present invention provides a computer storage medium having instructions stored therein which, when run on a computer, cause the computer to perform the method described in embodiment 1 or embodiment 2 or embodiment 3 or embodiment 4 or embodiment 5 above.
Although the present invention has been described in detail by way of preferred embodiments with reference to the accompanying drawings, the present invention is not limited thereto. Various equivalent modifications and substitutions may be made in the embodiments of the present invention by those skilled in the art without departing from the spirit and scope of the present invention, and it is intended that all such modifications and substitutions be within the scope of the present invention/be within the scope of the present invention as defined by the appended claims. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (8)

1. A method for viewing a server hard disk topology, comprising the steps of:
s1, configuring a second operating system guiding module for a server, and guiding the server to enter a linux operating system through the second operating system guiding module;
s2, collecting server hard disk information under a linux system, acquiring hard disk types and various types of hard disk information, and analyzing the collected server hard disk information; the specific steps of the step S2 are as follows:
s21, listing all block devices and block device types in a tree shape through an lsblk command under a linux operating system;
s22, screening out hard disk equipment and corresponding hard disk types from the block equipment, and checking the information of the hard disk equipment according to the hard disk types through a udevidm command;
s23, inquiring all PCI devices of the server through the lspci command, and analyzing the hard disk device information acquired by the udevidm command;
s3, judging a physical link where the hard disk is located according to a server hard disk information analysis result, generating a hard disk topological structure, and outputting the hard disk topological structure according to a preset mode; the specific steps of the step S3 are as follows:
s31, searching physical link information of the hard disk and PCI device bus information connected with the hard disk in the hard disk device information through a udeveadm command;
s32, analyzing physical links of the hard disks according to PCI device bus information and all PCI device information acquired by the lspci command, and generating a hard disk topological structure;
s33, judging whether the server is matched with the expansion backboard;
if yes, go to step S34;
if not, go to step S35;
s34, acquiring a hard disk matched with the expansion backboard, adding the expansion backboard and a corresponding hard disk to a hard disk topological structure, and outputting expansion backboard information;
s35, outputting the hard disk topological structure according to a preset mode.
2. The method for viewing a server hard disk topology as recited in claim 1, wherein step S1 comprises the specific steps of:
s11, a reserved space is arranged in the storage of the server, and a simplified linux operating system is installed in the reserved space;
s12, creating a guide interface for the simplified linux operating system, and generating a second operating system guide module;
s13, when the hard disk topology of the server needs to be acquired, the server is guided to enter a linux operating system through a second operating system guiding module.
3. The method of viewing a server hard disk topology according to claim 2, wherein in step S11, a thin linux operating system is installed in a removable storage medium, and the removable storage medium is inserted into the server.
4. A method of viewing a server hard disk topology as recited in claim 3, wherein the removable storage medium employs a usb disk.
5. The method for viewing a server hard disk topology as recited in claim 1, wherein step S35 comprises the specific steps of:
s351, processing the hard disk topological structure through an awk command and a sed command to generate a hard disk topological structure to be output;
s352, printing and outputting the physical links of all the hard disks in the hard disk topological structure to be output.
6. An apparatus for viewing a server hard disk topology, comprising:
the linux operating system guiding unit (1) is used for configuring a second operating system guiding module for the server, and guiding the server to enter the linux operating system through the second operating system guiding module;
the server hard disk information collection unit (2) is used for collecting server hard disk information under a linux system, obtaining hard disk types and various types of hard disk information, and analyzing the collected server hard disk information; the server hard disk information collection unit (2) includes:
a block device query subunit, configured to list all block devices and block device types in a tree form through an lsblk command under a linux operating system;
the hard disk device query subunit is used for screening out hard disk devices and corresponding hard disk types from the block devices, and checking the information of the hard disk devices according to the hard disk types through a udevidm command;
the hard disk device information analysis subunit is used for inquiring all PCI devices of the server through the lspci command and analyzing the hard disk device information acquired by the udevidm command;
the server hard disk topological structure output unit (3) is used for judging a physical link where the hard disk is located according to the analysis result of the server hard disk information, generating a hard disk topological structure and outputting the hard disk topological structure according to a preset mode; the server hard disk topology output unit (3) includes:
the PCI device bus information inquiry subunit is used for searching physical link information of the hard disk and PCI device bus information connected with the hard disk in the hard disk device information through a udevidm command;
the hard disk topological structure generation subunit is used for analyzing physical links where all the hard disks are located according to PCI device bus information and all PCI device information acquired by the lspci command to generate a hard disk topological structure;
the expansion backboard judging subunit is used for judging whether the server is matched with the expansion backboard or not;
the backboard information adding subunit is used for acquiring a hard disk matched with the expansion backboard when the server reaches the expansion backboard, adding the expansion backboard and a corresponding hard disk to a hard disk topological structure, and outputting expansion backboard information;
the topological structure output subunit is used for outputting the hard disk topological structure according to a preset mode.
7. A terminal comprising a processor and a memory;
wherein the memory is adapted to store a computer program and the processor is adapted to call and run the computer program from the memory to cause the terminal to perform the method according to any of the preceding claims 1-5.
8. A computer readable storage medium having instructions stored therein which, when run on a computer, cause the computer to perform the method of any of the preceding claims 1-5.
CN202111005446.XA 2021-08-30 2021-08-30 Method, device, terminal and storage medium for checking server hard disk topology Active CN113867810B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111005446.XA CN113867810B (en) 2021-08-30 2021-08-30 Method, device, terminal and storage medium for checking server hard disk topology

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111005446.XA CN113867810B (en) 2021-08-30 2021-08-30 Method, device, terminal and storage medium for checking server hard disk topology

Publications (2)

Publication Number Publication Date
CN113867810A CN113867810A (en) 2021-12-31
CN113867810B true CN113867810B (en) 2023-07-14

Family

ID=78988899

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111005446.XA Active CN113867810B (en) 2021-08-30 2021-08-30 Method, device, terminal and storage medium for checking server hard disk topology

Country Status (1)

Country Link
CN (1) CN113867810B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117472289B (en) * 2023-12-27 2024-03-15 苏州元脑智能科技有限公司 Storage configuration adjustment method, device, system, equipment and medium of server

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106502861A (en) * 2016-10-20 2017-03-15 郑州云海信息技术有限公司 A kind of method for penetrating RAID card reading hard disk SMART information
CN108829619A (en) * 2018-05-23 2018-11-16 郑州云海信息技术有限公司 A kind of continuous topological structure of hard disk ID and hard disk ID localization method
CN109683820A (en) * 2018-12-18 2019-04-26 山东超越数控电子股份有限公司 A kind of storage device tree implementation method based on Linux
CN110175146A (en) * 2019-04-13 2019-08-27 深圳市同泰怡信息技术有限公司 Hard disk information acquisition methods and the device for obtaining hard disk information
CN110515540A (en) * 2019-07-26 2019-11-29 苏州浪潮智能科技有限公司 A kind of method and device of topology hard disk
CN112328440A (en) * 2020-11-13 2021-02-05 苏州浪潮智能科技有限公司 Hard disk physical position determining method and device

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7506051B2 (en) * 2003-09-30 2009-03-17 International Business Machines Corporation Method and apparatus for automatically conducting hardware inventories of computers in a network

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106502861A (en) * 2016-10-20 2017-03-15 郑州云海信息技术有限公司 A kind of method for penetrating RAID card reading hard disk SMART information
CN108829619A (en) * 2018-05-23 2018-11-16 郑州云海信息技术有限公司 A kind of continuous topological structure of hard disk ID and hard disk ID localization method
CN109683820A (en) * 2018-12-18 2019-04-26 山东超越数控电子股份有限公司 A kind of storage device tree implementation method based on Linux
CN110175146A (en) * 2019-04-13 2019-08-27 深圳市同泰怡信息技术有限公司 Hard disk information acquisition methods and the device for obtaining hard disk information
CN110515540A (en) * 2019-07-26 2019-11-29 苏州浪潮智能科技有限公司 A kind of method and device of topology hard disk
CN112328440A (en) * 2020-11-13 2021-02-05 苏州浪潮智能科技有限公司 Hard disk physical position determining method and device

Also Published As

Publication number Publication date
CN113867810A (en) 2021-12-31

Similar Documents

Publication Publication Date Title
CN112181833A (en) Intelligent fuzzy test method, device and system
CN111209151A (en) Linux-based NVME SSD hot plug test method, system, terminal and storage medium
CN113867810B (en) Method, device, terminal and storage medium for checking server hard disk topology
CN110287123A (en) A kind of method and device around IOS system debug detection
CN112286750A (en) GPIO (general purpose input/output) verification method and device, electronic equipment and medium
CN117421217A (en) Automatic software function test method, system, terminal and medium
CN107818032A (en) A kind of mainboard, information Method of printing, system, device and storage medium
CN113138937A (en) Test method and device
CN110297735B (en) Universal re-judging test system based on solid state disk
CN109407655B (en) Method and device for debugging chip
CN109344083B (en) Program debugging method, device and equipment and readable storage medium
CN112416746A (en) Test case generation method, device, equipment and medium
CN116303200A (en) PCIE equipment positioning management method, system, terminal and storage medium
CN111008113B (en) SAS-Expander test method and tool
CN112286802B (en) Method and device for testing program performance and electronic equipment
CN114661586A (en) Embedded computer software testing method
CN109783031B (en) Method, device, terminal and storage medium for checking drive letter and slot number of RAID card
CN110795338B (en) Front-end and back-end interaction-based automatic testing method and device and electronic equipment
CN113448786A (en) PCIe equipment testing method, device, equipment and readable storage medium
CN113805861A (en) Code generation method based on machine learning, code editing system and storage medium
CN112181853A (en) Program debugging method, device and system
CN112380116A (en) Browser comparison test method and device and browser data forwarding method
CN111475107A (en) Method and device for formatting hard disk and storage medium
CN111682991B (en) Bus error message processing method and device
CN108845889A (en) A kind of test method and system checked BIOS option and whether meet Intel demand

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant