Difference between revisions of "Diagnosing a faulty Linux disk"

From EN Ikoula wiki
⧼vector-jumptonavigation⧽ ⧼vector-jumptosearch⧽
Line 1: Line 1:
 +
<span data-link_translate_zh_title="诊断一个有问题的Linux磁盘"  data-link_translate_zh_url="诊断一个有问题的Linux磁盘"></span>[[:zh:诊断一个有问题的Linux磁盘]][[zh:诊断一个有问题的Linux磁盘]]
 
<span data-link_translate_de_title="Diagnose einer defekten Linux-Festplatte"  data-link_translate_de_url="Diagnose einer defekten Linux-Festplatte"></span>[[:de:Diagnose einer defekten Linux-Festplatte]][[de:Diagnose einer defekten Linux-Festplatte]]
 
<span data-link_translate_de_title="Diagnose einer defekten Linux-Festplatte"  data-link_translate_de_url="Diagnose einer defekten Linux-Festplatte"></span>[[:de:Diagnose einer defekten Linux-Festplatte]][[de:Diagnose einer defekten Linux-Festplatte]]
 
<span data-link_translate_nl_title="Diagnose van een defecte Linux-schijf"  data-link_translate_nl_url="Diagnose van een defecte Linux-schijf"></span>[[:nl:Diagnose van een defecte Linux-schijf]][[nl:Diagnose van een defecte Linux-schijf]]
 
<span data-link_translate_nl_title="Diagnose van een defecte Linux-schijf"  data-link_translate_nl_url="Diagnose van een defecte Linux-schijf"></span>[[:nl:Diagnose van een defecte Linux-schijf]][[nl:Diagnose van een defecte Linux-schijf]]

Revision as of 17:06, 29 July 2021

zh:诊断一个有问题的Linux磁盘 de:Diagnose einer defekten Linux-Festplatte nl:Diagnose van een defecte Linux-schijf it:Diagnosticare un disco Linux difettoso pt:Diagnosticar um disco Linux defeituoso es:Diagnóstico de un disco Linux defectuoso fr:Diagnostic d'un disque défectueux Linux
This article has been created by an automatic translation software. You can view the article source here.

Introduction

This article aims to diagnose and identify a faulty disk on a Linux server.

The following actions can be performed from a Linux terminal or a Netboot.

The orders

=== If your operating system has RAID == =

As a first step you can do the following commands:

cat /proc/mdstat

You will then get a result similar to the following:

 
[root@localhost ~]# cat /proc/mdstat

Personalities : [raid1]
read_ahead 1024 sectors
md2 : active raid1 sda3[1] sdb3[0]
262016 blocks [2/2] [UU]

md1 : active raid1 sda2[1] sdb2[0]
119684160 blocks [2/2] [UU]

md0 : active raid1 sda1[1] sdb1[0]
102208 blocks [2/2] [UU]

unused devices: <none>

Here you can see [UU] at the end of each logical drive. A U means that a drive is correctly integrated in the RAID. Therefore, as soon as you can see a sequence like [_U] we will deduce that a drive is defective.

You can also get a result like this:


[root@localhost ~]# cat /proc/mdstat

Personalities : [raid1]
md3 : active raid1 sda3[0] sdb3[2](F)
      439553856 blocks super 1.0 [2/1] [U_]
      bitmap: 1/4 pages [4KB], 65536KB chunk

md1 : active raid1 sdb1[2](F) sda1[0]
      19529600 blocks super 1.0 [2/1] [U_]

unused devices: <none>

In this case the (F) tells us that the partition is defective. In our example the partitions sdb3 and sdb1 are faulty.

=== Diagnosis == =

To diagnose which disk is bad, we will use SMART.

To do this, you will need to install it: Depending on your Linux distribution, the command may change:

For Centos :

yum install smartmontools

For Ubuntu / Debian :

apt-get install smartmontools

You can then do the following command which will list the disks present:

smartctl --scan

To get more information about a disk, use the following command:

smartctl -iHAl error [NOM DU DISQUE]

A report of the disk will then be generated and will show you all the anomalies present. This report consists of four parts. The first part is the disk information, its serial number, model, capacity, ... The second part is the return of the SMART test, if the result is other than PASSED, the replacement of the disk is necessary. The third part is all the values generated by the test related to the disk. And finally the last part is the disk error logs.