Movatterモバイル変換


[0]ホーム

URL:


CN106886471A - A kind of read-write fault detection method and system based on disk in linux - Google Patents

A kind of read-write fault detection method and system based on disk in linux
Download PDF

Info

Publication number
CN106886471A
CN106886471ACN201710096582.1ACN201710096582ACN106886471ACN 106886471 ACN106886471 ACN 106886471ACN 201710096582 ACN201710096582 ACN 201710096582ACN 106886471 ACN106886471 ACN 106886471A
Authority
CN
China
Prior art keywords
read
write
disk
information
failure
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.)
Pending
Application number
CN201710096582.1A
Other languages
Chinese (zh)
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.)
Zhengzhou Yunhai Information Technology Co Ltd
Original Assignee
Zhengzhou Yunhai Information 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 Zhengzhou Yunhai Information Technology Co LtdfiledCriticalZhengzhou Yunhai Information Technology Co Ltd
Priority to CN201710096582.1ApriorityCriticalpatent/CN106886471A/en
Publication of CN106886471ApublicationCriticalpatent/CN106886471A/en
Pendinglegal-statusCriticalCurrent

Links

Classifications

Landscapes

Abstract

Translated fromChinese

本发明公开了一种基于linux中磁盘的读写故障检测方法及系统,包括执行磁盘故障检测程序,生成检测结果;分别依据预设关键字read和预设关键字write从检测结果中将磁盘的读信息和写信息提取出来;分别依据读信息和写信息判断磁盘是否存在读故障和写故障。本发明通过故障检测程序得到检测结构,并提取磁盘的读信息和写信息,再依据磁盘的读信息和写信息判断磁盘是否存在读故障和写故障,该方式能够有效判断磁盘是否存在读故障和/或写故障,达到预检测的目的,从而方便运维人员及时发现磁盘的故障,避免出现磁盘不能使用的情况,提高了用户体验。

The invention discloses a method and system for detecting read and write failures of disks based on linux, including executing a disk failure detection program to generate detection results; Extract the read information and write information; judge whether the disk has a read failure or a write failure based on the read information and write information respectively. The invention obtains the detection structure through the fault detection program, extracts the read information and write information of the disk, and then judges whether the disk has a read fault and a write fault according to the read information and write information of the disk. This method can effectively judge whether the disk has a read fault and a write fault. /or write faults to achieve the purpose of pre-detection, so that the operation and maintenance personnel can find disk faults in time, avoid the situation that the disk cannot be used, and improve the user experience.

Description

Translated fromChinese
一种基于linux中磁盘的读写故障检测方法及系统A method and system for detecting read and write faults based on disk in Linux

技术领域technical field

本发明涉及磁盘故障检测领域,特别是涉及一种基于linux中磁盘的读写故障检测方法及系统。The invention relates to the field of disk fault detection, in particular to a method and system for detecting read and write faults of disks in Linux.

背景技术Background technique

在互联网时代,计算机在人们的日常生活中占据着不可或缺的地位。计算机使用方便简单,给人们的生活、工作及学习带来了便利。计算机可以存储人们日常所需的重要数据及计算机系统所需的数据以方便人们的工作和学习。计算机中的数据一般存储在磁盘中,即使计算机断电,数据也不会丢失。因此,磁盘是计算机中很重要的组成部分,用户在使用磁盘时通常需要对磁盘进行数据读取和写入,如果磁盘出现读故障和/或写故障,可能会造成磁盘不能正常使用。现有技术中通常是在磁盘出现读故障和/或写故障导致磁盘不能正常工作后才进行相应的故障处理,用户体验差。In the Internet age, computers play an indispensable role in people's daily life. Computers are easy to use and bring convenience to people's life, work and study. Computers can store important data that people need daily and data needed by computer systems to facilitate people's work and study. The data in the computer is generally stored in the disk, even if the computer is powered off, the data will not be lost. Therefore, the disk is a very important part of the computer. Users usually need to read and write data to the disk when using the disk. If the disk has a read failure and/or write failure, the disk may not be used normally. In the prior art, the corresponding fault handling is usually performed only after the disk fails to work normally due to a read failure and/or write failure on the disk, and the user experience is poor.

因此,如何提供一种解决上述技术问题的方案是本领域技术人员目前需要解决的问题。Therefore, how to provide a solution to the above technical problems is a problem that those skilled in the art need to solve at present.

发明内容Contents of the invention

本发明的目的是提供一种基于linux中磁盘的读写故障检测方法,能够有效判断磁盘是否存在读故障和/或写故障,达到预检测的目的,从而方便运维人员及时发现磁盘的故障,避免出现磁盘不能使用的情况,提高了用户体验;本发明的另一目的是提供一种基于linux中磁盘的读写故障检测系统。The purpose of the present invention is to provide a method for detecting read and write failures based on disks in linux, which can effectively determine whether there are read failures and/or write failures in the disks, so as to achieve the purpose of pre-detection, thereby facilitating operation and maintenance personnel to find disk failures in time, The situation that the disk cannot be used is avoided, and the user experience is improved; another object of the present invention is to provide a disk read and write failure detection system based on linux.

为解决上述技术问题,本发明提供了一种基于linux中磁盘的读写故障检测方法,包括:In order to solve the above-mentioned technical problems, the invention provides a kind of reading and writing fault detection method based on disk in linux, comprising:

执行磁盘故障检测程序,生成检测结果;Execute the disk failure detection program and generate detection results;

分别依据预设关键字read和预设关键字write从所述检测结果中将所述磁盘的读信息和写信息提取出来;Extracting the read information and write information of the disk from the detection result according to the preset keyword read and the preset keyword write respectively;

分别依据所述读信息和所述写信息判断所述磁盘是否存在读故障和写故障。and judging whether there is a read fault or a write fault in the disk according to the read information and the write information respectively.

优选地,所述分别依据预设关键字read和预设关键字write从所述检测结果中将所述磁盘的读信息和写信息提取出来前,该方法还包括:Preferably, before extracting the read information and write information of the disk from the detection result according to the preset keyword read and the preset keyword write respectively, the method further includes:

将所述检测结果按照日志的格式保存为检测日志;Save the detection result as a detection log in the format of a log;

则所述分别依据预设关键字read和预设关键字write从所述检测结果中将所述磁盘的读信息和写信息提取出来的过程具体为:Then the process of extracting the read information and write information of the disk from the detection result according to the preset keyword read and the preset keyword write respectively is as follows:

分别依据预设关键字read和预设关键字write从所述检测日志中将所述磁盘的读信息和写信息提取出来。The read information and write information of the disk are extracted from the detection log according to the preset keyword read and the preset keyword write respectively.

优选地,所述分别依据预设关键字read和预设关键字write从所述检测日志中将所述磁盘的读信息和写信息提取出来的过程具体为:Preferably, the process of extracting the read information and write information of the disk from the detection log according to the preset keyword read and the preset keyword write respectively is as follows:

分别依据预设关键字read和预设关键字write采用grep命令将包括读信息的日志行和包括写信息的日志行提取出来;Use the grep command to extract the log lines including the read information and the log lines including the write information according to the preset keyword read and the preset keyword write respectively;

采用cut命令将所述包括读信息的日志行中的读错误数量和所述包括写信息的日志行中的写错误数量提取出来。The number of read errors in the log line including read information and the number of write errors in the log line including write information are extracted by using the cut command.

优选地,所述分别依据所述读信息和所述写信息判断所述磁盘是否存在读故障和写故障的过程具体为:Preferably, the process of judging whether there is a read fault or a write fault in the disk according to the read information and the write information is specifically:

判断所述读错误数量是否为零,如果是,则所述磁盘存在读故障,否则,所述磁盘不存在读故障;Judging whether the number of read errors is zero, if yes, there is a read fault in the disk, otherwise, there is no read fault in the disk;

判断所述写错误数量是否为另,如果是,则所述磁盘存在写故障,否则,所述磁盘不存在写故障。It is judged whether the number of write errors is equal, if yes, there is a write fault on the disk, otherwise, there is no write fault on the disk.

优选地,该方法还包括:Preferably, the method also includes:

当所述磁盘存在读故障和/或写故障时,相应地将所述磁盘的读故障信息和/或写故障进行上报。When the disk has a read failure and/or a write failure, correspondingly report the read failure information and/or the write failure of the disk.

为解决上述技术问题,本发明还提供了一种基于linux中磁盘的读写故障检测系统,包括:In order to solve the problems of the technologies described above, the present invention also provides a read-write fault detection system based on disk in linux, comprising:

磁盘检测记录模块,用于执行磁盘故障检测程序,生成检测结果;The disk detection and recording module is used to execute the disk failure detection program and generate detection results;

磁盘信息提取模块,用于分别依据预设关键字read和预设关键字write从所述检测结果中将所述磁盘的读信息和写信息提取出来;The disk information extraction module is used to extract the read information and write information of the disk from the detection results according to the preset keyword read and the preset keyword write respectively;

磁盘故障判断模块,用于分别依据所述读信息和所述写信息判断所述磁盘是否存在读故障和写故障。A disk failure judging module, configured to judge whether the disk has a read failure or a write failure according to the read information and the write information respectively.

优选地,所述分别依据预设关键字read和预设关键字write从所述检测结果中将所述磁盘的读信息和写信息提取出来前,该系统还包括:Preferably, before extracting the read information and write information of the disk from the detection result according to the preset keyword read and the preset keyword write respectively, the system further includes:

日志保存模块,用于将所述检测结果按照日志的格式保存为检测日志;A log saving module, configured to save the detection result as a detection log in a log format;

则所述磁盘信息提取模块具体用于分别依据预设关键字read和预设关键字write从所述检测日志中将所述磁盘的读信息和写信息提取出来。The disk information extraction module is specifically configured to extract the read information and write information of the disk from the detection log according to the preset keyword read and the preset keyword write respectively.

优选地,所述磁盘信息提取模块包括:Preferably, the disk information extraction module includes:

日志行提取模块,用于分别依据预设关键字read和预设关键字write采用grep命令将包括读信息的日志行和包括写信息的日志行提取出来;The log line extraction module is used to extract the log line including the read information and the log line including the write information by using the grep command according to the preset keyword read and the preset keyword write respectively;

错误数量提取模块,用于采用cut命令将所述包括读信息的日志行中的读错误数量和所述包括写信息的日志行中的写错误数量提取出来。The error number extraction module is used to extract the number of read errors in the log line including read information and the number of write errors in the log line including write information by using the cut command.

优选地,所述磁盘故障判断模块具体用于判断所述读错误数量是否为零,如果是,则所述磁盘存在读故障,否则,所述磁盘不存在读故障;判断所述写错误数量是否为另,如果是,则所述磁盘存在写故障,否则,所述磁盘不存在写故障。Preferably, the disk fault judging module is specifically used to judge whether the number of read errors is zero, if yes, there is a read fault in the disk, otherwise, there is no read fault in the disk; judge whether the number of write errors is In addition, if yes, there is a write failure in the disk, otherwise, there is no write failure in the disk.

优选地,该系统还包括:Preferably, the system also includes:

故障上报模块,用于当所述磁盘存在读故障和/或写故障时,相应地将所述磁盘的读故障信息和/或写故障进行上报。The failure reporting module is configured to report the read failure information and/or write failure information of the disk accordingly when the disk has a read failure and/or write failure.

本发明提供了一种基于linux中磁盘的读写故障检测方法及系统,包括执行磁盘故障检测程序,生成检测结果;分别依据预设关键字read和预设关键字write从检测结果中将磁盘的读信息和写信息提取出来;分别依据读信息和写信息判断磁盘是否存在读故障和写故障。本发明通过故障检测程序得到检测结构,并提取磁盘的读信息和写信息,再依据磁盘的读信息和写信息判断磁盘是否存在读故障和写故障,该方式能够有效判断磁盘是否存在读故障和/或写故障,达到预检测的目的,从而方便运维人员及时发现磁盘的故障,避免出现磁盘不能使用的情况,提高了用户体验。The present invention provides a method and system for detecting read and write failures of disks based on linux, including executing a disk failure detection program to generate detection results; Extract the read information and write information; judge whether there is a read failure or a write failure on the disk according to the read information and write information respectively. The invention obtains the detection structure through the fault detection program, extracts the read information and write information of the disk, and then judges whether the disk has a read fault and a write fault according to the read information and write information of the disk. This method can effectively judge whether the disk has a read fault and a write fault. /or write faults to achieve the purpose of pre-detection, so that the operation and maintenance personnel can find disk faults in time, avoid the situation that the disk cannot be used, and improve the user experience.

附图说明Description of drawings

为了更清楚地说明本发明实施例中的技术方案,下面将对现有技术和实施例中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following will briefly introduce the prior art and the accompanying drawings that need to be used in the embodiments. Obviously, the accompanying drawings in the following description are only some of the present invention. Embodiments, for those of ordinary skill in the art, other drawings can also be obtained based on these drawings without any creative effort.

图1为本发明提供的一种基于linux中磁盘的读写故障检测方法的过程的流程图;Fig. 1 is a kind of flow chart of the process based on the reading and writing fault detection method of disk in linux provided by the present invention;

图2为本发明提供的一种基于linux中磁盘的读写故障检测系统的结构示意图。FIG. 2 is a schematic structural diagram of a disk-based read-write failure detection system in linux provided by the present invention.

具体实施方式detailed description

本发明的核心是提供一种基于linux中磁盘的读写故障检测方法,能够有效判断磁盘是否存在读故障和/或写故障,达到预检测的目的,从而方便运维人员及时发现磁盘的故障,避免出现磁盘不能使用的情况,提高了用户体验;本发明的另一核心是提供一种基于linux中磁盘的读写故障检测系统。The core of the present invention is to provide a method for detecting read and write failures based on disks in linux, which can effectively determine whether there are read failures and/or write failures in the disk, so as to achieve the purpose of pre-detection, thereby facilitating operation and maintenance personnel to find disk failures in time, The situation that the disk cannot be used is avoided, and the user experience is improved; another core of the present invention is to provide a disk reading and writing failure detection system based on linux.

为使本发明实施例的目的、技术方案和优点更加清楚,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments It is a part of embodiments of the present invention, but not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the protection scope of the present invention.

请参照图1,图1为本发明提供的一种基于linux中磁盘的读写故障检测方法的过程的流程图,该方法包括:Please refer to Fig. 1, Fig. 1 is a kind of flow chart of the process based on the reading and writing failure detection method of disk in linux provided by the present invention, and this method comprises:

步骤S11:执行磁盘故障检测程序,生成检测结果;Step S11: Execute the disk failure detection program to generate a detection result;

可以理解的是,很多计算机系统上都安装有磁盘检测工具,例如smartctl工具,通过对smartctl工具进行设置,通过其对磁盘进行故障检测。例如,基于smartctl工具,调用“smartstl-a磁盘名”程序,执行磁盘的故障检测程序,并自动生成检测结果,这里的检测结果将会包括很多磁盘的信息。当然,这里的磁盘检测工具还可以为其他检测工具,本发明在此不做特别的限定,能得到磁盘的故障检测结果即可。It can be understood that many computer systems are installed with disk detection tools, such as smartctl tool, by setting the smartctl tool, the fault detection of the disk is performed through it. For example, based on the smartctl tool, call the "smartstl-a disk name" program to execute the disk fault detection program and automatically generate detection results, which will include a lot of disk information. Of course, the disk detection tool here can also be other detection tools, and the present invention does not make any special limitation here, as long as the fault detection result of the disk can be obtained.

步骤S12:分别依据预设关键字read和预设关键字write从检测结果中将磁盘的读信息和写信息提取出来;Step S12: Extract the read information and write information of the disk from the detection results according to the preset keyword read and the preset keyword write respectively;

为了对磁盘的读写故障进行检测,这里通过预设关键字read(读)来从检测结果中将磁盘的读信息提取出来,通过预设关键字write(写)从检测结果中将磁盘的写信息提取出来。In order to detect the read and write failure of the disk, the read information of the disk is extracted from the detection result by the preset keyword read (read), and the write information of the disk is extracted from the detection result by the preset keyword write (write). information extracted.

作为优选地,分别依据预设关键字read和预设关键字write从检测结果中将磁盘的读信息和写信息提取出来前,该方法还包括:As preferably, before extracting the read information and write information of the disk from the detection result according to the preset keyword read and the preset keyword write respectively, the method also includes:

将检测结果按照日志的格式保存为检测日志;Save the test results as a test log in the format of the log;

则分别依据预设关键字read和预设关键字write从检测结果中将磁盘的读信息和写信息提取出来的过程具体为:The process of extracting the read information and write information of the disk from the detection results according to the preset keyword read and the preset keyword write respectively is as follows:

分别依据预设关键字read和预设关键字write从检测日志中将磁盘的读信息和写信息提取出来。The read information and write information of the disk are extracted from the detection log according to the preset keyword read and the preset keyword write respectively.

可以理解的是,日志文件具有记录信息清晰、方便用户使用的优点,为便于磁盘故障检测的后续操作,这里可以将检测结果按照日志的格式保存为检测日志。It can be understood that the log file has the advantages of clear record information and convenient use by users. In order to facilitate the subsequent operation of disk failure detection, the detection results can be saved as detection logs in the log format.

当然,这里也可以将检测结果保存为其他类型的文件,例如保存为字符串,本发明在此不做特别的限定,根据实际情况来定。Of course, the detection result can also be saved as other types of files, for example, as a character string, which is not limited in the present invention and is determined according to actual conditions.

作为优选地,分别依据预设关键字read和预设关键字write从检测日志中将磁盘的读信息和写信息提取出来的过程具体为:As preferably, the process of extracting the read information and write information of the disk from the detection log according to the preset keyword read and the preset keyword write is specifically as follows:

分别依据预设关键字read和预设关键字write采用grep命令将包括读信息的日志行和包括写信息的日志行提取出来;Use the grep command to extract the log lines including the read information and the log lines including the write information according to the preset keyword read and the preset keyword write respectively;

采用cut命令将包括读信息的日志行中的读错误数量和包括写信息的日志行中的写错误数量提取出来。Use the cut command to extract the number of read errors in the log line including read information and the number of write errors in the log line including write information.

为了后续判断磁盘是否存在读故障和/或写故障,这里需要从包括读信息的日志行中提取出能够判断磁盘是否存在读故障的信息,例如故障检测过程中得到的读错误数量,同理,也需要得到写错误数量。In order to subsequently determine whether the disk has a read failure and/or write failure, it is necessary to extract information that can determine whether the disk has a read failure from the log line including the read information, such as the number of read errors obtained during the fault detection process. Similarly, Also need to get the number of write errors.

本申请中,grep命令用来提取日志行,cut命令用来提取用户所需的日志行中的信息。In this application, the grep command is used to extract the log lines, and the cut command is used to extract the information in the log lines required by the user.

步骤S13:分别依据读信息和写信息判断磁盘是否存在读故障和写故障。Step S13: Determine whether there is a read fault or a write fault on the disk according to the read information and the write information respectively.

作为优选地,分别依据读信息和写信息判断磁盘是否存在读故障和写故障的过程具体为:As preferably, the process of judging whether the disk has a read failure and a write failure based on the read information and the write information respectively is as follows:

判断读错误数量是否为零,如果是,则磁盘存在读故障,否则,磁盘不存在读故障;Determine whether the number of read errors is zero, if yes, there is a read failure on the disk, otherwise, there is no read failure on the disk;

判断写错误数量是否为另,如果是,则磁盘存在写故障,否则,磁盘不存在写故障。It is judged whether the number of write errors is another, if yes, there is a write fault on the disk, otherwise, there is no write fault on the disk.

在得到读错误数量和写错误数量后,分别依据这两个信息来判断磁盘是否存在故障。After obtaining the number of read errors and the number of write errors, it is judged whether there is a disk failure based on these two pieces of information respectively.

作为优选地,该方法还包括:Preferably, the method also includes:

当磁盘存在读故障和/或写故障时,相应地将磁盘的读故障信息和/或写故障进行上报。When the disk has a read failure and/or a write failure, correspondingly report the read failure information and/or the write failure of the disk.

为了方便运维人员及时知道磁盘的故障状态,在磁盘存在读故障和/或写故障时,还将磁盘的故障信息及时上报,以便运维人员及时进行磁盘的故障处理。In order to facilitate the operation and maintenance personnel to know the fault status of the disk in time, when the disk has a read failure and/or write failure, the failure information of the disk will be reported in time, so that the operation and maintenance personnel can handle the disk failure in time.

本发明提供了一种基于linux中磁盘的读写故障检测方法,包括执行磁盘故障检测程序,生成检测结果;分别依据预设关键字read和预设关键字write从检测结果中将磁盘的读信息和写信息提取出来;分别依据读信息和写信息判断磁盘是否存在读故障和写故障。本发明通过故障检测程序得到检测结构,并提取磁盘的读信息和写信息,再依据磁盘的读信息和写信息判断磁盘是否存在读故障和写故障,该方式能够有效判断磁盘是否存在读故障和/或写故障,达到预检测的目的,从而方便运维人员及时发现磁盘的故障,避免出现磁盘不能使用的情况,提高了用户体验。The invention provides a method for detecting read and write failures of disks based on linux, which includes executing a disk failure detection program and generating detection results; and reading information of the disks from the detection results according to the preset keyword read and the preset keyword write respectively Extract and write information; judge whether the disk has a read failure or a write failure based on the read information and write information respectively. The invention obtains the detection structure through the fault detection program, extracts the read information and write information of the disk, and then judges whether the disk has a read fault and a write fault according to the read information and write information of the disk. This method can effectively judge whether the disk has a read fault and a write fault. /or write faults to achieve the purpose of pre-detection, so that the operation and maintenance personnel can find disk faults in time, avoid the situation that the disk cannot be used, and improve the user experience.

请参照图2,图2为本发明提供的一种基于linux中磁盘的读写故障检测系统的结构示意图,该系统包括:Please refer to Fig. 2, Fig. 2 is a kind of structural representation based on the reading and writing fault detection system of disk in linux provided by the present invention, and this system comprises:

磁盘检测记录模块1,用于执行磁盘故障检测程序,生成检测结果;The disk detection and recording module 1 is used to execute the disk failure detection program and generate detection results;

磁盘信息提取模块2,用于分别依据预设关键字read和预设关键字write从检测结果中将磁盘的读信息和写信息提取出来;The disk information extraction module 2 is used to extract the read information and write information of the disk from the detection results according to the preset keyword read and the preset keyword write respectively;

磁盘故障判断模块3,用于分别依据读信息和写信息判断磁盘是否存在读故障和写故障。The disk failure judging module 3 is configured to judge whether there is a read failure or a write failure in the disk according to the read information and the write information respectively.

作为优选地,分别依据预设关键字read和预设关键字write从检测结果中将磁盘的读信息和写信息提取出来前,该系统还包括:As preferably, before extracting the reading information and writing information of the disk from the detection result according to the preset keyword read and the preset keyword write respectively, the system also includes:

日志保存模块,用于将检测结果按照日志的格式保存为检测日志;The log preservation module is used to save the detection result as a detection log according to the format of the log;

则磁盘信息提取模块2具体用于分别依据预设关键字read和预设关键字write从检测日志中将磁盘的读信息和写信息提取出来。The disk information extraction module 2 is specifically configured to extract the read information and write information of the disk from the detection log according to the preset keyword read and the preset keyword write respectively.

作为优选地,磁盘信息提取模块2包括:As preferably, the disk information extraction module 2 includes:

日志行提取模块,用于分别依据预设关键字read和预设关键字write采用grep命令将包括读信息的日志行和包括写信息的日志行提取出来;The log line extraction module is used to extract the log line including the read information and the log line including the write information by using the grep command according to the preset keyword read and the preset keyword write respectively;

错误数量提取模块,用于采用cut命令将包括读信息的日志行中的读错误数量和包括写信息的日志行中的写错误数量提取出来。The error number extraction module is used to extract the number of read errors in the log line including read information and the number of write errors in the log line including write information by using the cut command.

作为优选地,磁盘故障判断模块3具体用于判断读错误数量是否为零,如果是,则磁盘存在读故障,否则,磁盘不存在读故障;判断写错误数量是否为另,如果是,则磁盘存在写故障,否则,磁盘不存在写故障。As preferably, the disk failure judging module 3 is specifically used to judge whether the number of read errors is zero, if yes, there is a read failure in the disk, otherwise, there is no read failure in the disk; whether the number of write errors is judged to be another, if yes, then the disk There is a write failure, otherwise, the disk does not have a write failure.

作为优选地,该系统还包括:Preferably, the system also includes:

故障上报模块,用于当磁盘存在读故障和/或写故障时,相应地将磁盘的读故障信息和/或写故障进行上报。The fault reporting module is configured to report the read fault information and/or write fault information of the disk accordingly when there is a read fault and/or write fault in the disk.

对于本发明提供的基于linux中磁盘的读写故障检测系统的介绍请参照上述方法实施例,本发明在此不再赘述。For the introduction of the Linux-based disk read and write failure detection system provided by the present invention, please refer to the above method embodiment, and the present invention will not repeat it here.

本发明提供了一种基于linux中磁盘的读写故障检测系统,包括执行磁盘故障检测程序,生成检测结果;分别依据预设关键字read和预设关键字write从检测结果中将磁盘的读信息和写信息提取出来;分别依据读信息和写信息判断磁盘是否存在读故障和写故障。本发明通过故障检测程序得到检测结构,并提取磁盘的读信息和写信息,再依据磁盘的读信息和写信息判断磁盘是否存在读故障和写故障,该方式能够有效判断磁盘是否存在读故障和/或写故障,达到预检测的目的,从而方便运维人员及时发现磁盘的故障,避免出现磁盘不能使用的情况,提高了用户体验。The present invention provides a kind of reading and writing fault detection system based on the disk in linux, including executing the disk fault detection program, generating the detection result; according to the preset keyword read and the preset keyword write respectively from the disk read information from the detection result Extract and write information; judge whether the disk has a read failure or a write failure based on the read information and write information respectively. The invention obtains the detection structure through the fault detection program, extracts the read information and write information of the disk, and then judges whether the disk has a read fault and a write fault according to the read information and write information of the disk. This method can effectively judge whether the disk has a read fault and a write fault. /or write faults to achieve the purpose of pre-detection, so that the operation and maintenance personnel can find disk faults in time, avoid the situation that the disk cannot be used, and improve the user experience.

需要说明的是,在本说明书中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。It should be noted that in this specification, the term "comprises", "comprises" or any other variation thereof is intended to cover a non-exclusive inclusion such that a process, method, article or device comprising a set of elements includes not only those elements , but also includes other elements not expressly listed, or also includes elements inherent in such process, method, article or equipment. Without further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article or apparatus comprising said element.

对所公开的实施例的上述说明,使本领域专业技术人员能够实现或使用本发明。对这些实施例的多种修改对本领域的专业技术人员来说将是显而易见的,本文中所定义的一般原理可以在不脱离本发明的精神或范围的情况下,在其他实施例中实现。因此,本发明将不会被限制于本文所示的这些实施例,而是要符合与本文所公开的原理和新颖特点相一致的最宽的范围。The above description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the present invention will not be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (10)

Translated fromChinese
1.一种基于linux中磁盘的读写故障检测方法,其特征在于,包括:1. A read-write fault detection method based on disk in linux, is characterized in that, comprises:执行磁盘故障检测程序,生成检测结果;Execute the disk failure detection program and generate detection results;分别依据预设关键字read和预设关键字write从所述检测结果中将所述磁盘的读信息和写信息提取出来;Extracting the read information and write information of the disk from the detection result according to the preset keyword read and the preset keyword write respectively;分别依据所述读信息和所述写信息判断所述磁盘是否存在读故障和写故障。and judging whether there is a read fault or a write fault in the disk according to the read information and the write information respectively.2.如权利要求1所述的读写故障检测方法,其特征在于,所述分别依据预设关键字read和预设关键字write从所述检测结果中将所述磁盘的读信息和写信息提取出来前,该方法还包括:2. The read-write failure detection method according to claim 1, wherein the read information and write information of the disk are read from the detection results according to the preset keyword read and the preset keyword write respectively. Before extracting, the method also includes:将所述检测结果按照日志的格式保存为检测日志;Save the detection result as a detection log in the format of a log;则所述分别依据预设关键字read和预设关键字write从所述检测结果中将所述磁盘的读信息和写信息提取出来的过程具体为:Then the process of extracting the read information and write information of the disk from the detection result according to the preset keyword read and the preset keyword write respectively is as follows:分别依据预设关键字read和预设关键字write从所述检测日志中将所述磁盘的读信息和写信息提取出来。The read information and write information of the disk are extracted from the detection log according to the preset keyword read and the preset keyword write respectively.3.如权利要求2所述的读写故障检测方法,其特征在于,所述分别依据预设关键字read和预设关键字write从所述检测日志中将所述磁盘的读信息和写信息提取出来的过程具体为:3. The read-write fault detection method as claimed in claim 2, characterized in that, the read information and write information of the disk are read from the detection log according to the preset keyword read and the preset keyword write respectively. The extraction process is as follows:分别依据预设关键字read和预设关键字write采用grep命令将包括读信息的日志行和包括写信息的日志行提取出来;Use the grep command to extract the log lines including the read information and the log lines including the write information according to the preset keyword read and the preset keyword write respectively;采用cut命令将所述包括读信息的日志行中的读错误数量和所述包括写信息的日志行中的写错误数量提取出来。The number of read errors in the log line including read information and the number of write errors in the log line including write information are extracted by using the cut command.4.如权利要求3所述的读写故障检测方法,其特征在于,所述分别依据所述读信息和所述写信息判断所述磁盘是否存在读故障和写故障的过程具体为:4. The read-write fault detection method according to claim 3, wherein the process of judging whether there is a read fault or a write fault in the disk according to the read information and the write information is specifically:判断所述读错误数量是否为零,如果是,则所述磁盘存在读故障,否则,所述磁盘不存在读故障;Judging whether the number of read errors is zero, if yes, there is a read fault in the disk, otherwise, there is no read fault in the disk;判断所述写错误数量是否为另,如果是,则所述磁盘存在写故障,否则,所述磁盘不存在写故障。It is judged whether the number of write errors is equal, if yes, there is a write fault on the disk, otherwise, there is no write fault on the disk.5.如权利要求1-4任一项所述的读写故障检测方法,其特征在于,该方法还包括:5. The read-write fault detection method according to any one of claims 1-4, characterized in that the method further comprises:当所述磁盘存在读故障和/或写故障时,相应地将所述磁盘的读故障信息和/或写故障进行上报。When the disk has a read failure and/or a write failure, correspondingly report the read failure information and/or the write failure of the disk.6.一种基于linux中磁盘的读写故障检测系统,其特征在于,包括:6. A read-write fault detection system based on disk in linux, is characterized in that, comprises:磁盘检测记录模块,用于执行磁盘故障检测程序,生成检测结果;The disk detection and recording module is used to execute the disk failure detection program and generate detection results;磁盘信息提取模块,用于分别依据预设关键字read和预设关键字write从所述检测结果中将所述磁盘的读信息和写信息提取出来;The disk information extraction module is used to extract the read information and write information of the disk from the detection results according to the preset keyword read and the preset keyword write respectively;磁盘故障判断模块,用于分别依据所述读信息和所述写信息判断所述磁盘是否存在读故障和写故障。A disk failure judging module, configured to judge whether the disk has a read failure or a write failure according to the read information and the write information respectively.7.如权利要求6所述的读写故障检测系统,其特征在于,所述分别依据预设关键字read和预设关键字write从所述检测结果中将所述磁盘的读信息和写信息提取出来前,该系统还包括:7. The read-write failure detection system as claimed in claim 6, wherein the read information and write information of the disk are read and written from the detection results according to the preset keyword read and the preset keyword write respectively. Before extraction, the system also includes:日志保存模块,用于将所述检测结果按照日志的格式保存为检测日志;A log saving module, configured to save the detection result as a detection log in a log format;则所述磁盘信息提取模块具体用于分别依据预设关键字read和预设关键字write从所述检测日志中将所述磁盘的读信息和写信息提取出来。The disk information extraction module is specifically configured to extract the read information and write information of the disk from the detection log according to the preset keyword read and the preset keyword write respectively.8.如权利要求7所述的读写故障检测系统,其特征在于,所述磁盘信息提取模块包括:8. read-write failure detection system as claimed in claim 7, is characterized in that, described disk information extracting module comprises:日志行提取模块,用于分别依据预设关键字read和预设关键字write采用grep命令将包括读信息的日志行和包括写信息的日志行提取出来;The log line extraction module is used to extract the log line including the read information and the log line including the write information by using the grep command according to the preset keyword read and the preset keyword write respectively;错误数量提取模块,用于采用cut命令将所述包括读信息的日志行中的读错误数量和所述包括写信息的日志行中的写错误数量提取出来。The error number extraction module is used to extract the number of read errors in the log line including read information and the number of write errors in the log line including write information by using the cut command.9.如权利要求8所述的读写故障检测系统,其特征在于,所述磁盘故障判断模块具体用于判断所述读错误数量是否为零,如果是,则所述磁盘存在读故障,否则,所述磁盘不存在读故障;判断所述写错误数量是否为另,如果是,则所述磁盘存在写故障,否则,所述磁盘不存在写故障。9. The read-write failure detection system as claimed in claim 8, wherein the disk failure judging module is specifically used to judge whether the number of read errors is zero, if yes, there is a read failure in the disk, otherwise , the disk does not have a read fault; determine whether the number of write errors is equal to another, if yes, the disk has a write fault, otherwise, the disk does not have a write fault.10.如权利要求6-9任一项所述的读写故障检测系统,其特征在于,该系统还包括:10. The read-write failure detection system according to any one of claims 6-9, wherein the system further comprises:故障上报模块,用于当所述磁盘存在读故障和/或写故障时,相应地将所述磁盘的读故障信息和/或写故障进行上报。The failure reporting module is configured to report the read failure information and/or write failure information of the disk accordingly when the disk has a read failure and/or write failure.
CN201710096582.1A2017-02-222017-02-22A kind of read-write fault detection method and system based on disk in linuxPendingCN106886471A (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN201710096582.1ACN106886471A (en)2017-02-222017-02-22A kind of read-write fault detection method and system based on disk in linux

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN201710096582.1ACN106886471A (en)2017-02-222017-02-22A kind of read-write fault detection method and system based on disk in linux

Publications (1)

Publication NumberPublication Date
CN106886471Atrue CN106886471A (en)2017-06-23

Family

ID=59179035

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN201710096582.1APendingCN106886471A (en)2017-02-222017-02-22A kind of read-write fault detection method and system based on disk in linux

Country Status (1)

CountryLink
CN (1)CN106886471A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN109408270A (en)*2018-10-182019-03-01郑州云海信息技术有限公司A kind of processing method and processing device of read-write operation
CN110795261A (en)*2019-09-262020-02-14北京浪潮数据技术有限公司Virtual disk fault detection method and device
CN110825542A (en)*2018-08-072020-02-21网宿科技股份有限公司Method, device and system for detecting fault disk in distributed system

Citations (4)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN103809915A (en)*2012-11-052014-05-21阿里巴巴集团控股有限公司Read-write method and device of magnetic disk files
CN105159604A (en)*2015-08-202015-12-16浪潮(北京)电子信息产业有限公司Disk data read-write method and system
CN105183597A (en)*2015-08-272015-12-23浪潮电子信息产业股份有限公司Method for rapidly and effectively analyzing and repairing system hard disk failure
CN106250258A (en)*2016-07-292016-12-21北京云集智造科技有限公司A kind of disk failure localization method and device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN103809915A (en)*2012-11-052014-05-21阿里巴巴集团控股有限公司Read-write method and device of magnetic disk files
CN105159604A (en)*2015-08-202015-12-16浪潮(北京)电子信息产业有限公司Disk data read-write method and system
CN105183597A (en)*2015-08-272015-12-23浪潮电子信息产业股份有限公司Method for rapidly and effectively analyzing and repairing system hard disk failure
CN106250258A (en)*2016-07-292016-12-21北京云集智造科技有限公司A kind of disk failure localization method and device

Cited By (5)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN110825542A (en)*2018-08-072020-02-21网宿科技股份有限公司Method, device and system for detecting fault disk in distributed system
CN109408270A (en)*2018-10-182019-03-01郑州云海信息技术有限公司A kind of processing method and processing device of read-write operation
CN109408270B (en)*2018-10-182021-12-03郑州云海信息技术有限公司Read-write operation processing method and device
CN110795261A (en)*2019-09-262020-02-14北京浪潮数据技术有限公司Virtual disk fault detection method and device
CN110795261B (en)*2019-09-262022-06-17北京浪潮数据技术有限公司Virtual disk fault detection method and device

Similar Documents

PublicationPublication DateTitle
CN110727597B (en) A method for troubleshooting invalid code completion use cases based on logs
CN106502895A (en)A kind of automatic test information generation device and method
CN104424094A (en)Method and device for obtaining abnormal information and intelligent terminal device
CN106598796A (en)Method for testing hardware information stability in reboot
CN107818029B (en)Automatic test method for cloud hard disk data recovery consistency
WO2015196981A1 (en)Method and device for recognizing picture junk files
CN104966021A (en)Creating and analytic methods and device for security baseline data files
CN107341077A (en)A kind of method and its system for hard disk screening
CN106886471A (en)A kind of read-write fault detection method and system based on disk in linux
CN107608813A (en)A kind of method that failure is automatically analyzed based on linux operation system informations
CN108009067A (en)A kind of method and system that RAID card details are checked under server
CN103092718A (en)Test data backup system and method
CN107562593A (en)A kind of automated testing method and system for verifying internal memory ECC functions
US8341538B1 (en)Systems and methods for reducing redundancies in quality-assurance reviews of graphical user interfaces
US8448134B1 (en)Systems and methods for reliably identifying controls invoked during quality-assurance reviews of user interfaces
CN106598799A (en)Fault injection simulation system and fault management system
CN110413463A (en) A method for checking SMART information of hard disk
CN102866964B (en)Method and device for protecting data on storage equipment
CN106598797B (en)Multi-path IO fault injection method and system and fault management system
CN114138575A (en) A test method, device, equipment and medium for garbage collection of hard disk data
JP2016076071A (en) Log management device, log management program, and log management method
CN108038031A (en)A kind of method and device for monitoring hard disk presence in real time
CN106886470A (en)A kind of fault detection method and system based on disk in linux
CN111459886A (en) A method, device, device and storage medium for matching and retrieving log content
CN109977423B (en)Method and device for processing word, electronic equipment and readable storage medium

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination
RJ01Rejection of invention patent application after publication

Application publication date:20170623

RJ01Rejection of invention patent application after publication

[8]ページ先頭

©2009-2025 Movatter.jp