Hello,
Am Donnerstag, 10. April 2025, 00:13:10 CEST schrieb Andy Smith:
> Hi,
>
> On Wed, Apr 09, 2025 at 05:46:32PM +0200, Petric Frank wrote:
> > In this case i have to manually create a mapping from pci-id (of the
> > controller) together with the "ata-x" to the sata connection number
> > printed on the motherboard. Based on the mapping udev rules are to be
> > created to get device entries driven by the cable ids.
> >
> > Due i am not firm with udev rules - any hint on these ?
>
> You have yet to explain why block device serial numbers
> (/dev/disk/by-id/) and filesystem UUIDs (/dev/disk/by-uuid/) are not
> sufficient for your use case.
Ok. Lets take an example - a NAS using screwless hdd hotplug trays.
Each hdd has a slot to be accessed external (bay 1...6). If a hdd fails how do you know in which bay you find the hdd which failed ?
Due the dynamic mapping of sata cable to device name is not fixed you can't. You have (for example) to evaluate the other drives serial number and match them with the ones on the hdds itself. The one which is missing will be the one to be replaced.
I had the same problem. Here is what worked for me:
First, during scheduled down-time, I pulled each HDD one at a time and noted its serial number and position (slot number) on a chart. Now I can use smartctl to view the relation of /dev/sdx - to - serial number. Another thing I sometimes do is label the front of the HDD caddy with HDD serial number, if it is possible to do so without blocking airflow with the labels.
You can list the drives:
me@srv1:~$ smartctl --scan
/dev/sda -d scsi # /dev/sda, SCSI device
/dev/sdb -d scsi # /dev/sdb, SCSI device
/dev/sdc -d scsi # /dev/sdc, SCSI device
/dev/sdd -d scsi # /dev/sdd, SCSI device
/dev/sde -d scsi # /dev/sde, SCSI device
/dev/sdf -d scsi # /dev/sdf, SCSI device
/dev/sdg -d scsi # /dev/sdg, SCSI device
/dev/sdh -d scsi # /dev/sdh, SCSI device
/dev/sdi -d scsi # /dev/sdi, SCSI device
/dev/sdj -d scsi # /dev/sdj, SCSI device
/dev/sdk -d scsi # /dev/sdk, SCSI device
/dev/sdl -d scsi # /dev/sdl, SCSI device
/dev/sdm -d scsi # /dev/sdm, SCSI device
If your RAID monitoring notices disc /dev/sda is broken, run the following command to view among other things, serial number of sda. Then I can confidently pull the HDD I previously marked with the same s.n. In my case sda is currently this server's only boot disc...
Also check out man smartctl, you can get a wealth of info from drives.
me@srv1:~$ sudo smartctl -i /dev/sda
smartctl 7.2 2020-12-30 r5155 [x86_64-linux-6.2.0-31-generic]
(local build)
Copyright (C) 2002-20, Bruce Allen, Christian Franke,
www.smartmontools.org
=== START OF INFORMATION SECTION ===
Device Model: LK0200GEYMR
Serial Number: BTHC549304ZT200TGN
LU WWN Device Id: 5 5cd2e4 04c1623ca
Firmware Version: 4IWTHPG1
User Capacity: 200,049,647,616 bytes [200 GB]
Sector Sizes: 512 bytes logical, 4096 bytes physical
Rotation Rate: Solid State Device
Form Factor: 2.5 inches
TRIM Command: Available, deterministic, zeroed
Device is: Not in smartctl database [for details use: -P
showall]
ATA Version is: ACS-2 T13/2015-D revision 3
SATA Version is: SATA 2.6, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is: Wed Apr 9 23:12:12 2025 CDT
SMART support is: Available - device has SMART capability.
SMART support is: Enabled
A SAS disk in my pool....
me@srv1:~$ sudo smartctl -i /dev/sdb
smartctl 7.2 2020-12-30 r5155 [x86_64-linux-6.2.0-31-generic]
(local build)
Copyright (C) 2002-20, Bruce Allen, Christian Franke,
www.smartmontools.org
=== START OF INFORMATION SECTION ===
Vendor: SEAGATE
Product: ST4000NM0023
Revision: GS15
Compliance: SPC-4
User Capacity: 4,000,787,030,016 bytes [4.00 TB]
Logical block size: 512 bytes
LU is fully provisioned
Rotation Rate: 7200 rpm
Form Factor: 3.5 inches
Logical Unit id: 0x5000c500842f46db
Serial number: Z1Z9KGRF
Device type: disk
Transport protocol: SAS (SPL-3)
Local Time is: Wed Apr 9 23:12:18 2025 CDT
SMART support is: Available - device has SMART capability.
SMART support is: Enabled
Temperature Warning: Disabled or Not Supported
Umm... just now thought of it, this server is still on Ubuntu, I hardly ever look at it it and tend to forget it didn't get Debian at the same time everything else around here did., however I just now checked, smartctl will work with the same commands on Debian Bookworm.
If you don't have smartctl, install the smartmontools package.
But if you have a fixed relationship from /dev/sd[x] to the connector on the mainboard (and as result on the hdd tray) this will be an easy task.
regards
Petric
-- Titus Newswanger Curtiss WI