AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 1146922
Accepted
Алексей Пашнин
Алексей Пашнин
Asked: 2023-10-31 18:46:41 +0800 CST2023-10-31 18:46:41 +0800 CST 2023-10-31 18:46:41 +0800 CST

为什么 smartctl 不显示重新分配的扇区数?

  • 772

我有我的同事之前准备的 smartctl 查询。

smartctl -d ata -a {disk_name} | awk '/Reallocated_Sector_Ct/{print $10}'

我正在尝试使用该查询,但它什么也没打印。查询smartctl -d ata -a {disk_name}输出没有Reallocated_Sector_Ct字段。如何知道该字段是否不存在,因为磁盘不应该有该字段,或者我做了错误的查询?

linux
  • 2 2 个回答
  • 75 Views

2 个回答

  • Voted
  1. HBruijn
    2023-10-31T19:44:58+08:002023-10-31T19:44:58+08:00

    如何知道该字段是否不存在,因为磁盘不应该有该字段,或者我做了错误的查询?

    如果不知道您正在尝试监视哪种“磁盘”,就很难知道您是否进行了错误的查询。

    有几种常见的场景:

    • 该磁盘根本不支持SMART 。
      在这种情况下,我希望smartctl给您提供适当的警告和/或错误消息。
      “磁盘”不支持 SMART 的几个常见原因:

      1. 您的主机是虚拟机,“磁盘”是虚拟机管理程序提供的虚拟磁盘,并且虚拟驱动程序不模拟(不相关的)SMART数据

      2. 该磁盘不是真实磁盘,而是由(适当硬件)RAID 控制器管理的逻辑驱动器(这需要使用供应商特定的方法来监视构成虚拟驱动器的底层真实磁盘的运行状况)

    • 该磁盘确实支持SMART:

      1. 但Reallocated_Sector_Ct磁盘固件根本不提供此信息。
        例如,NVME 驱动器具有用于跟踪备用容量的特定 SMART 属性,这相当于但又不同于 Reallated_Sector_Ct

      2. smartctl未正确检测设备类型,您需要提示它使用带有标志的正确“驱动程序” -d TYPE, --device=TYPE。

    可能还有其他人。


    根据您正在使用的评论smartctl -d cciss,0 /dev/sda:

    看一下smartctl说明书

    cciss,N - [FreeBSD and Linux only] the device consists of one or more 
              SCSI/SAS or SATA disks connected to a cciss RAID controller. 
              The non-negative integer N (in the range from 0 to 15 
              inclusive) denotes which disk on the controller is monitored.
    
    To look at disks behind HP Smart Array controllers, use syntax such as:
    
    smartctl -a -d cciss,0 /dev/cciss/c0d0    (cciss driver under Linux)
    
              This will give the smart information about the first physical 
              disk drive (0) connect to the controller at /dev/cciss/c0d0 . 
              (Disk drive numbering is 0 based)
    
    smartctl -a -d cciss,1 /dev/sg2    (hpsa or hpahcisr drivers under Linux)
              This will give the SMART information about the second physical
              disk drive (1) connected to the controller at /dev/sg0
    

    如果这不起作用,我认为您可能混合了两件事:您正在寻址/dev/sda可能是逻辑驱动器,而不是连接到 HP 智能阵列控制器的特定磁盘。寻址特定驱动器的正确语法取决于您的系统使用的驱动程序:cciss或hpsa

    • 1
  2. Best Answer
    Алексей Пашнин
    2023-10-31T19:15:59+08:002023-10-31T19:15:59+08:00

    我得到的正确查询是 smartctl -a /dev/sda -d cciss,0

    仍在尝试了解它是如何工作的,但确实如此。

    所以最终版本是

    smartctl -a /dev/sda -d cciss,0 | awk '/Reallocated_Sector_Ct/{print $10}'

    • 0

相关问题

  • Linux 主机到主机迁移

  • 如何在 Linux 机器上找到有关硬件的详细信息?

  • 如何在 Linux 下监控每个进程的网络 I/O 使用情况?

  • 在 RHEL4 上修改 CUPS 中的现有打印机设置

  • 为本地网络中的名称解析添加自定义 dns 条目

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve