linux磁盘故障_如何在Linux中找出发生故障的磁盘的SATA端口

本文介绍了一种在Linux系统中定位故障磁盘的方法,通过使用唯一且稳定的序列号而非易变的设备名称来识别磁盘。文章详细解释了如何利用hdparm命令获取磁盘序列号,并通过序列号在服务器中找到故障磁盘。此外,还提出了使用UUID替代设备名称进行磁盘分区挂载的建议,以避免因设备名称变化导致的问题。
摘要由CSDN通过智能技术生成

linux磁盘故障

The Linux disk names (e.g. sda1, hdb3, etc.) are not reliable—they may be changed if there are hardware changes, such an adding or removing a disk. Additionally, the order for the Linux device names is not always the same as the order of SATA poets. For example, the disk connected to SATA port 0 (first port) is not always sda.

Linux磁盘名称(例如sda1,hdb3等)不可靠-如果发生硬件更改(例如添加或删除磁盘),则可能会更改它们。 此外,Linux设备名称的顺序并不总是与SATA诗人的顺序相同。 例如,连接到SATA端口0(第一个端口)的磁盘并不总是sda。

It is possibly that you are in a situation like this:

您可能处于以下情况:

I find one disk failed on my server which have several ones installed. I know the disk’s name in Linux (e.g. sda, sdb). However, the Linux disk name to SATA port mapping does not follow the same order. Now, I want to find out the failed disks. How to quickly find out them and which SATA port are these failed disks connected to?

我发现服务器上安装了多个磁盘的磁盘出现故障。 我知道Linux中磁盘的名称(例如sda,sdb)。 但是,Linux磁盘名称到SATA端口的映射不遵循相同的顺序。 现在,我想找出发生故障的磁盘。 如何快速找出它们以及这些故障磁盘连接到了哪个SATA端口?

将Linux磁盘名称映射到序列号 (Map the Linux disk names to serial numbers )

Fortunately, there are other names/IDs that we can make use of to identify a failed disk in Linux. The device serial ID is unique for all disks and we can find out the failed disks by their serial numbers.

幸运的是,还有其他名称/ ID可用于识别Linux中出现故障的磁盘。 设备序列号对于所有磁盘都是唯一的,我们可以通过故障序列号找到故障磁盘。

On Linux, to find a disk’s serial number, we can run this command.

在Linux上,要查找磁盘的序列号,我们可以运行此命令。

# hdparm -i /dev/sdb | grep Serial

Here, we use sdb as the example.

在这里,我们以sdb为例。

One example output is like this:

一个示例输出如下所示:

Model=ST31000528AS, FwRev=CC38, SerialNo=5VP5DYYY

(the last 3 digits are anonymized).

(后3位数字是匿名的)。

If hdparm is not installed, you need to first install it:

如果未安装hdparm则需要先安装它:

# yum install hdparm

By this method, we can easily map the Linux disk names to serial numbers.

通过这种方法,我们可以轻松地将Linux磁盘名称映射为序列号。

通过序列号找到故障磁盘 (Find the failed disks by their serial numbers )

After opening the server box, we can easily find out the failed disks according to their serial numbers. The manufacturers usually print the disks’ serial numbers on the disk label.

打开服务器包装盒后,我们可以根据序列号轻松找到发生故障的磁盘。 制造商通常在磁盘标签上打印磁盘的序列号。

奖励:挂载磁盘分区不是按设备名称 (Bonus: mounting disk partitions NOT by its device name )

For the similar reason, it is a good idea to identify disk or disk partitions by their UUIDs instead of Linux device names to avoid situations that Linux can not find the disks. Two examples are the configuration in grub’s config file and the /etc/fstab for automatic disk partition mounting. The format as follow can be understood by most of the tools in Linux:

出于类似的原因,最好通过UUID而不是Linux设备名称来标识磁盘或磁盘分区,以避免Linux无法找到磁盘的情况。 两个示例是grub的配置文件中的配置和/etc/ fstab用于自动磁盘分区安装的配置。 Linux中的大多数工具都可以理解以下格式:

UUID=YYYYY

YYYYY is the UUID for the disk.

YYYYY是磁盘的UUID。

All disks’ UUIDs can be listed by:

所有磁盘的UUID可以通过以下方式列出:

# blkid

翻译自: https://www.systutorials.com/how-to-find-out-failed-disks-sata-ports-in-linux/

linux磁盘故障

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值