How To Find Hard Disk SATA Link Speed On FreeBSD

last updated in Categories , , ,

I know how to find out my SATA link speed such as 3.0 or 6.0 Gbps on Linux operating system. How do I find out my SATA link speed on FreeBSD Unix operating system? How do I make sure my sata hard disk is working at 6Gbps speed and how do I verify this on a FreeBSD server hardware?

Most common SATA speed revision are as follows:

  1. SATA revision 2.0 : 3 Gbit/s, 300 MB/s
  2. SATA revision 3.0 : 6 Gbit/s, 600 MB/s

You need to use the dmesg command to displays the contents of the FreeBSD system or view/search /var/run/dmesg.boot. It is a snapshot of the buffer contents taken soon after file systems are mounted at startup time.

dmesg command examples

Open the terminal application or login to the remote FreeBSD box using ssh client and type the following command:
# dmesg | grep -i SATA
OR
# dmesg | grep -i transfers
Sample outputs:

Fig.01: dmesg command in action
Fig.01: dmesg command in action

Or, you can directly query the log file:
# grep -i --color transfers /var/log/dmesg.today
OR
# grep -i --color transfers /var/run/dmesg.boot
Sample outputs:

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 command example

You can use the camcontrol command as follows:
# camcontrol identify {diskNameHere}
# camcontrol identify ada0 | more
# camcontrol identify ada0 | grep -i sata

Sample outputs:

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

Here is a shell loop to generate list of all disks and their sata speed on FreeBSD based system:

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

Sample outputs:

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
---
pass2: <SanDisk SD6SB1M064G1022I X231600> ATA-8 SATA 3.x device
pass2: 600.000MB/s transfers (SATA 3.x, UDMA6, PIO 512bytes)
protocol              ATA/ATAPI-8 SATA 3.x
---
pass1: <WDC WD60EFRX-68MYMN1 82.00A82> ATA-9 SATA 3.x device
pass1: 600.000MB/s transfers (SATA 3.x, UDMA6, PIO 8192bytes)
protocol              ATA/ATAPI-9 SATA 3.x
---
pass0: <WDC WD60EFRX-68MYMN1 82.00A82> ATA-9 SATA 3.x device
pass0: 600.000MB/s transfers (SATA 3.x, UDMA6, PIO 8192bytes)
protocol              ATA/ATAPI-9 SATA 3.x
---

smartctl command examples

Type the following command:
# 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.

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.

2 comment

  1. That won’t work on a server that’s been up for more than a few days or weeks, because the dmesg buffer is finite and boot messages will eventually fall off the end. Fortunately, the contents of the dmesg buffer are saved to `/var/run/dmesg.boot` at boot time. On modern server-grade hardware with a large number of devices (PCI and USB hubs, network interfaces, disks etc), you may need to increase the `kern.msgbufsize` tunable in `/boot/loader.conf` to prevent the dmesg buffer from overflowing during boot.

    BTW, `smartctl` is not part of the base system. You have to install the `smartmontools` package.

    But the easiest way

    Have a question? Post it on our forum!