如何在FreeBSD上找到硬盘SATA链接速度

时间:2020-01-09 10:38:29  来源:igfitidea点击:

如何找出我的SATA链接速度,例如Linux操作系统上的3.0或6.0 Gbps。
如何在FreeBSD Unix操作系统上找到SATA链接速度?
如何确定SATA硬盘的工作速度为6Gbps,如何在FreeBSD服务器硬件上进行验证? 最常见的SATA速度修订如下:

  • SATA 2.0版:3 Gbit/s,300 MB/s
  • SATA 3.0版:6 Gbit/s,600 MB/s

您需要使用dmesg命令显示FreeBSD系统的内容或查看/搜索/var/run/dmesg.boot
它是在启动时挂载文件系统后立即获取的缓冲区内容的快照。

dmesg命令示例

使用ssh客户端打开终端应用程序或登录到远程FreeBSD框,然后执行以下命令:

# dmesg | grep -i SATA

或者

# dmesg | grep -i transfers

输出示例:
dmesg命令正在运行

或者,您可以直接查询日志文件:

# grep -i --color transfers /var/log/dmesg.today

或者

# grep -i --color transfers /var/run/dmesg.boot

输出示例:

ada0: 600.000MB/s transfers (SATA 3.x, UDMA6, PIO 8192bytes)
ada1: 600.000MB/s transfers (SATA 3.x, UDMA6, PIO 8192bytes)
ada2: 600.000MB/s transfers (SATA 3.x, UDMA6, PIO 512bytes)
ada3: 600.000MB/s transfers (SATA 3.x, UDMA5, PIO 512bytes)
ada4: 600.000MB/s transfers (SATA 3.x, UDMA6, PIO 512bytes)
ada5: 600.000MB/s transfers (SATA 3.x, UDMA6, PIO 8192bytes)
ada6: 600.000MB/s transfers (SATA 3.x, UDMA6, PIO 8192bytes)

camcontrol命令示例

您可以按以下方式使用camcontrol命令:

# camcontrol identify {diskNameHere}
# camcontrol identify ada0 | more
# camcontrol identify ada0 | grep -i sata

输出示例:

pass0:  ATA-9 SATA 3.x device
pass0: 600.000MB/s transfers (SATA 3.x, UDMA6, PIO 8192bytes)
protocol              ATA/ATAPI-9 SATA 3.x

这是一个Shell循环,用于在基于FreeBSD的系统上生成所有磁盘及其sata速度的列表:

for i in $(sysctl -n kern.disks)
do 
   camcontrol identify "$i" | grep -i sata; echo "---"
done

输出示例:

pass7: <WDC WD60EFRX-68MYMN1 82.00A82> ATA-9 SATA 3.x device
pass7: 600.000MB/s transfers (SATA 3.x, UDMA6, PIO 8192bytes)
protocol              ATA/ATAPI-9 SATA 3.x
--
pass6: <WDC WD60EFRX-68MYMN1 82.00A82> ATA-9 SATA 3.x device
pass6: 600.000MB/s transfers (SATA 3.x, UDMA6, PIO 8192bytes)
protocol              ATA/ATAPI-9 SATA 3.x
--
pass4: <SanDisk SDSSDHII120G X31200RL> ATA-9 SATA 3.x device
pass4: 600.000MB/s transfers (SATA 3.x, UDMA6, PIO 512bytes)
protocol              ATA/ATAPI-9 SATA 3.x
--
pass3: <16GB SATA Flash Drive SFDE001A> ATA-9 SATA 3.x device
pass3: 600.000MB/s transfers (SATA 3.x, UDMA5, PIO 512bytes)
protocol              ATA/ATAPI-9 SATA 3.x
device model          16GB SATA Flash Drive
--

smartctl命令示例

执行以下命令:

# smartctl -a /dev/ada0 | more
# smartctl -a /dev/ada0 | grep '^SATA'
# smartctl -a /dev/ada0
smartctl 6.3 2014-07-26 r3976 [FreeBSD 9.3-RELEASE-p26 amd64] (local build)
Copyright (C) 2002-14, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Family:     Western Digital Red
Device Model:     WDC WD60EFRX-68MYMN1
Serial Number:    WD-WX31D55A4CLC
LU WWN Device Id: 5 0014ee 26195240d
Firmware Version: 82.00A82
User Capacity:    6,001,175,126,016 bytes [6.00 TB]
Sector Sizes:     512 bytes logical, 4096 bytes physical
Rotation Rate:    5700 rpm
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   ACS-2, ACS-3 T13/2161-D revision 3b
SATA Version is:  SATA 3.1, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is:    Tue Oct 13 22:43:51 2015 IST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

General SMART Values:
Offline data collection status:  (0x00) Offline data collection activity
                                        was never started.
                                        Auto Offline Data Collection: Disabled.
Self-test execution status:      (   0) The previous self-test routine completed
                                        without error or no self-test has ever 
                                        been run.
Total time to complete Offline 
data collection:                ( 3824) seconds.
Offline data collection
capabilities:                    (0x7b) SMART execute Offline immediate.
                                        Auto Offline data collection on/off support.
                                        Suspend Offline collection upon new
                                        command.
                                        Offline surface scan supported.
                                        Self-test supported.
                                        Conveyance Self-test supported.
                                        Selective Self-test supported.