A kind of conversion method for realizing server physical disks position Yu system drive

文档序号:1755008 发布日期:2019-11-29 浏览:7次 中文

阅读说明:本技术 一种实现服务器物理盘位与系统盘符的转换方法 (A kind of conversion method for realizing server physical disks position Yu system drive ) 是由 李元骅 朱云 樊笑冰 于 2018-05-22 设计创作,主要内容包括:本发明公开了一种实现服务器物理盘位与系统盘符的转换方法,通过读取系统物理磁盘控制器的相关文件,得到物理控制器接口的相信息,从而通过这些信息得到系统的物理位置与系统盘符的对应关系,最终通过程序将磁盘的物理位转换为磁盘的盘符。本发明解决了Linux系统中磁盘盘符与物理位置不相符、造成的磁盘盘符混乱从而无法准确的获取到某物理位置的磁盘的盘符或某盘符对应的物理位置的问题。尤其似乎对于没有相关root权限、对系统核心文件不熟悉或不方便修改相关配置文件、不方便重启服务器人员或程序无法实时准确的获取某物理位置的磁盘的盘符,或某盘符所对应的物理位置的问题。(The invention discloses a kind of conversion methods for realizing server physical disks position Yu system drive, by the associated documents for reading system physical Magnetic Disk Controler, obtain the phase information of physical controller interface, to obtain the physical location of system and the corresponding relationship of system drive by these information, the physical bit of disk is converted to the drive of disk eventually by program.The present invention solve the problems, such as disk drive is not consistent with physical location in linux system, caused by disk drive confusion to can not accurately get the drive or the corresponding physical location of certain drive of the disk of certain physical location.Especially seem for no related root authority, be unfamiliar with or be inconvenient to modify associated profile to system core file, be inconvenient to restart server personnel or the drive or certain drive of disk that program can not accurately obtain certain physical location in real time corresponding to physical location the problem of.)

1. a kind of conversion method for realizing server physical disks position Yu system drive, which is characterized in that by reading system physical The associated documents of Magnetic Disk Controler obtain the phase information of physical controller interface, to obtain the object of system by these information The physical bit of disk, the drive of disk is converted to eventually by program by the corresponding relationship for managing position and system drive.

2. the conversion method according to claim 1 for realizing server physical disks position and system drive, which is characterized in that adopt With data obtaining module, relevant system file is read, by calling relevant function and system resource, reads necessity of system The file at position, to obtain relevant necessary information.

3. the conversion method according to claim 1 for realizing server physical disks position and system drive, which is characterized in that adopt With data processing module, the information that data obtaining module obtains is handled, provides the information processing of both direction: (1) from physical bit It sets and is converted into system drive, (2) are converted into physical location from system drive, and data processing module judges according to the information got The type of Magnetic Disk Controler out, to obtain the relationship of controller Yu disk physical location and drive.

4. the conversion method according to claim 1 for realizing server physical disks position and system drive, which is characterized in that adopt With output module, the information handled is formatted and is packed, makes it have unified output format, while can also be right Module carries out relevant configuration, generates different formats.

Technical field

The present invention relates to a kind of conversion method, specifically a kind of conversion side for realizing server physical disks position and system drive Method.

Background technique

With the rapid development of information technology, big data, cloud, the use scope of server is increasingly wider, throughout each A field.In many business relevant to server and program, it is much directed to relevant operation related with disk, also The drive that can be related to period of service disk obtains but the disk of Linux server easily drifts about, and causes program or business chaotic Error.The disk drive of Linux is determined according to disk electric sequence, but since the complexity of disk answers environment, different magnetic Disk may be the system bus for having different controller accesses, due to the difference and different operating system kernel of the producer of controller Difference, the distribution for causing system drive is chaotic.And due to the function that present disk all supports hot drawing heat slotting, make disk Drive becomes more unordered.Be likely to that system drive in the positive slot of server sorts not in accordance with physical location/ Dev/sda ,/dev/sdb ,/dev/sdc ,/dev/sdd, but/dev/sdf ,/dev/sdc ,/dev/sdn/ ,/dev/ Sda ..., the sequence unrelated with physics physical location thus find it is a kind of can stabilization obtain the disk positioned at certain physical location (slot position) Drive the relevant technologies, become a kind of urgent need.

Traditional solution be by udev hyperdisk, configure relevant udev rule by the physical location of disk with Disk is bound, to fix the drive of disk, the drive of disk is made not drift about.But such method is necessarily required to pair System core key position file is modified, and it is this modification and it is non real-time come into force, need to carry out the side of restarting to server This configuration rule can be made to come into force.If mistake occurs when configuring core part file, possible guiding systems collapse.And correlation is repaired Change and need very high system permission that can just carry out, but this permission can not be got in actual operation, it also just can not be into The related change of row.And this configuration needs just come into force after restarting, but for much can not be for the business of terminal, Server Restart It is to need very high cost or at all unacceptable.

Summary of the invention

The purpose of the present invention is to provide a kind of conversion methods for realizing server physical disks position Yu system drive, to solve The problems mentioned above in the background art.

To achieve the above object, the invention provides the following technical scheme:

A kind of conversion method for realizing server physical disks position Yu system drive, by reading system physical Magnetic Disk Controler Associated documents, the phase information of physical controller interface is obtained, to obtain the physical location of system by these information and be The physical bit of disk is converted to the drive of disk eventually by program by the corresponding relationship of overall symbol.

As a further solution of the present invention: using data obtaining module, read relevant system file, by calling phase The function and system resource of pass, read the file at the necessary position of system, to obtain relevant necessary information.

As a further solution of the present invention: using data processing module, the information that processing data obtaining module obtains mentions For the information processing of both direction: (1) from physical location it is converted into system drive, (2) are converted into physical location from system drive, Data processing module judges the type of Magnetic Disk Controler according to the information got, to obtain controller and disk physical bit Set the relationship with drive.

As further scheme of the invention: output module is used, the information handled is formatted and is packed, Unified output format is made it have, while relevant configuration can also be carried out to module, generates different formats.

Compared with prior art, the beneficial effects of the present invention are: the present invention solves disk drive and object in linux system Reason position be not consistent, caused by disk drive confusion to can not accurately get certain physical location disk drive or certain The problem of drive corresponding physical location.Especially seem for no related root authority, system core file is unfamiliar with or Be inconvenient to modify associated profile, be inconvenient to restart server personnel or program and can not accurately obtain certain physical location in real time Disk drive or certain drive corresponding to physical location the problem of.

Specific embodiment

The technical scheme in the embodiments of the invention will be clearly and completely described below, it is clear that described implementation Example is only a part of the embodiment of the present invention, instead of all the embodiments.Based on the embodiments of the present invention, this field is common Technical staff's every other embodiment obtained without making creative work belongs to the model that the present invention protects It encloses.

In the embodiment of the present invention, a kind of conversion method for realizing server physical disks position Yu system drive is by reading The associated documents of system physical disk controller, obtain the phase information of physical controller interface, to obtain by these information The physical bit of disk, the disk of disk is converted to eventually by program by the physical location of system and the corresponding relationship of system drive Symbol, due to the physical location of disk be it is fixed, occur drive drift descendant can accurately obtain disk by this mapping relations Drive can obtain the drive of some disk in real time.

The present invention does not need during mutually convert by physical location and disk drive to system core position File modified in advance.It can obtain in real time simultaneously, not be related to restarting for server, thus will not interrupt the server Related service.And it runs relative program only to need to have read-only authority to system correlation map file, this is one very easy The permission got.

The present invention is divided into three modules:

1, acquisition of information

The module, by calling relevant function and system resource, reads system for reading relevant system file The file at necessary position, to obtain relevant necessary information, for different operating system, the module may need to attempt from Different file acquisition relevant informations.

2, data processing module

The information that the module obtains mainly for the treatment of data obtaining module, it is main that the information processing one of both direction is provided It is system drive to be converted into from physical location, first is that being converted into physical location from system drive, module meeting basis is got Information judges the type of Magnetic Disk Controler, so as to obtain the relationship of controller Yu disk physical location and drive.

3, output module

The information that the module is used to have handled carries out necessary formatting and packaging, makes it have unified output lattice Formula can also carry out relevant configuration to module, generate different formats, so that subsequent program be facilitated to use.

Workflow:

The map information of data obtaining module acquisition associative disk controller and disk drive, which is read in linux system, to be stored Catalogue/the sys/class/block or/sys/block (in older operating system) of the information of all block devices having found, Get the information of all disks in system.

Data processing module handles the letter got, and according to the particular content of information, the disk of system can be obtained The type of controller, different Magnetic Disk Controlers have different information.

If desired the physical location of disk is converted into the drive of disk, then need to find the Magnetic Disk Controler of physical location Information, the drive of disk obtained by the information.

If desired the drive of disk is converted into the physical location of disk, then firstly the need of input disk drive, to The relevant information for obtaining controlling the controller of the drive accurately gets the object of disk by the relevant information of controller Manage the information of position.

The data that output module will acquire carry out unified processing, and information is exported so that subsequent personnel or program make With.

It is obvious to a person skilled in the art that invention is not limited to the details of the above exemplary embodiments, Er Qie In the case where without departing substantially from spirit or essential attributes of the invention, the present invention can be realized in other specific forms.Therefore, no matter From the point of view of which point, the present embodiments are to be considered as illustrative and not restrictive, and the scope of the present invention is by appended power Benefit requires rather than above description limits, it is intended that all by what is fallen within the meaning and scope of the equivalent elements of the claims Variation is included within the present invention.In addition, it should be understood that although this specification is described in terms of embodiments, but it is not each Embodiment only contains an independent technical solution, and this description of the specification is merely for the sake of clarity, this field Technical staff should consider the specification as a whole, and the technical solutions in the various embodiments may also be suitably combined, form this The other embodiments that field technical staff is understood that.

5页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:硬盘读写控制方法、装置、电子设备及存储介质

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类