I've read through many threads on this and still don't get consistent results.
I would like to understand how to reliably get the serial number off of drives that I attach to the system so that I can print a label for them and use that information when things go south later for a drive.
I noticed that if the drive is attached via sata cable:
Is accurate. The ident field is correct.
However, if I try it on a USB connection:
The ident field is ridiculous (seems to refer to the USB adapter).
Smartctl seems to be the best bet, even with the drive attached to USB.
My question is what's canonical - what should "always" work?
I would like to understand how to reliably get the serial number off of drives that I attach to the system so that I can print a label for them and use that information when things go south later for a drive.
I noticed that if the drive is attached via sata cable:
Code:
geom disk list
Geom name: ada0
Providers:
1. Name: ada0
Mediasize: 1000204886016 (932G)
Sectorsize: 512
Mode: r1w1e2
descr: Samsung SSD 870 EVO 1TB
lunid: 5002538f3344dfe6
ident: S75BNS0W426986P
rotationrate: 0
fwsectors: 63
fwheads: 16
Is accurate. The ident field is correct.
However, if I try it on a USB connection:
Code:
Geom name: da0
Providers:
1. Name: da0
Mediasize: 1000204886016 (932G)
Sectorsize: 512
Mode: r0w0e0
descr: ASMT USB 3.0 Destop H
lunid: 5000000000000001
ident: 0000000007FC
rotationrate: unknown
fwsectors: 63
fwheads: 255
The ident field is ridiculous (seems to refer to the USB adapter).
Smartctl seems to be the best bet, even with the drive attached to USB.
Code:
sudo smartctl -ax /dev/da0
smartctl 7.4 2023-08-01 r5530 [FreeBSD 14.0-RELEASE-p5 amd64] (local build)
Copyright (C) 2002-23, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF INFORMATION SECTION ===
Model Family: Samsung based SSDs
Device Model: Samsung SSD 870 EVO 1TB
Serial Number: S75BNS0W428794Z
LU WWN Device Id: 5 002538 f3344e810
Firmware Version: SVT03B6Q
My question is what's canonical - what should "always" work?