View previous topic :: View next topic |
Author |
Message |
Vieri l33t
Joined: 18 Dec 2005 Posts: 882
|
Posted: Thu Dec 01, 2022 9:53 am Post subject: identifying hard disks by their serial numbers |
|
|
Hi,
For years now I've always used just /dev/sd{a,b} to create simple RAID1 sets, so I didn't really care to properly identify the disks except when having to replace with a spare and rebuild the RAID (but then again most of the time I'd just move the services to a backup system and rebuild the failing one from scratch).
However, I now need to properly and easily identify the disks because I'd like to create 2 different RAID1 sets on the same machine for 2 different purposes.
If I look at the 4 SSD disks I have I can see the following serial numbers printed out on their labels:
Code: | OCZ serial number A1218011234001934 part number AGT3-25SAT3-240G
OCZ serial number 026731204003631
OCZ serial number A1218011234001597
OCZ serial number A1218011234001615 |
Now, if I boot the system with these 4 disks I see the following (yes, I previously created partitions on them and the booted system has root as LVM):
Code: | # ls /dev/sd*
/dev/sda /dev/sda3 /dev/sdb /dev/sdb3 /dev/sdc /dev/sdc3 /dev/sdd /dev/sdd3
/dev/sda1 /dev/sda4 /dev/sdb1 /dev/sdb4 /dev/sdc1 /dev/sdc4 /dev/sdd1 /dev/sdd4
/dev/sda2 /dev/sda5 /dev/sdb2 /dev/sdb5 /dev/sdc2 /dev/sdc5 /dev/sdd2 /dev/sdd5 |
Code: | # ls /dev/disk/by-id/
ata-OCZ-AGILITY3_OCZ-A5D40NV42726448U
ata-OCZ-AGILITY3_OCZ-A5D40NV42726448U-part1
ata-OCZ-AGILITY3_OCZ-A5D40NV42726448U-part2
ata-OCZ-AGILITY3_OCZ-A5D40NV42726448U-part3
ata-OCZ-AGILITY3_OCZ-A5D40NV42726448U-part4
ata-OCZ-AGILITY3_OCZ-A5D40NV42726448U-part5
ata-OCZ-AGILITY3_OCZ-IW5DVD8EX3V06EHN
ata-OCZ-AGILITY3_OCZ-IW5DVD8EX3V06EHN-part1
ata-OCZ-AGILITY3_OCZ-IW5DVD8EX3V06EHN-part2
ata-OCZ-AGILITY3_OCZ-IW5DVD8EX3V06EHN-part3
ata-OCZ-AGILITY3_OCZ-IW5DVD8EX3V06EHN-part4
ata-OCZ-AGILITY3_OCZ-IW5DVD8EX3V06EHN-part5
ata-OCZ-AGILITY3_OCZ-L2M0OYX7NJJSU680
ata-OCZ-AGILITY3_OCZ-L2M0OYX7NJJSU680-part1
ata-OCZ-AGILITY3_OCZ-L2M0OYX7NJJSU680-part2
ata-OCZ-AGILITY3_OCZ-L2M0OYX7NJJSU680-part3
ata-OCZ-AGILITY3_OCZ-L2M0OYX7NJJSU680-part4
ata-OCZ-AGILITY3_OCZ-L2M0OYX7NJJSU680-part5
ata-OCZ-AGILITY3_OCZ-V8B5ER0E98Z45972
ata-OCZ-AGILITY3_OCZ-V8B5ER0E98Z45972-part1
ata-OCZ-AGILITY3_OCZ-V8B5ER0E98Z45972-part2
ata-OCZ-AGILITY3_OCZ-V8B5ER0E98Z45972-part3
ata-OCZ-AGILITY3_OCZ-V8B5ER0E98Z45972-part4
ata-OCZ-AGILITY3_OCZ-V8B5ER0E98Z45972-part5
dm-name-vgroot-root
dm-uuid-LVM-kBTak6Bp3ttg15yJu4kmfvVIIH0dVm7kk9McJlXX5hYk4kld1s3k4XenR479cq8m
lvm-pv-uuid-SBMcAC-7dd8-AQ2m-XqS1-qoJt-aAW8-3HKsxP
lvm-pv-uuid-vPKVKO-KnVY-Pzd4-USEL-piI7-XuZP-rAWbfM
md-uuid-5b453376:0193356d:cb201669:f728008a
md-uuid-5e1a89ea:6fdaadcd:cb201669:f728008a
md-uuid-5e4f0e1b:46f04ae7:c44c77eb:7ee19756
md-uuid-616e31cb:19518c12:c44c77eb:7ee19756
md-uuid-6451c3dd:925d47ad:c44c77eb:7ee19756
md-uuid-f7e25831:ddbfd198:c44c77eb:7ee19756
md-uuid-f7eeab6f:250039dd:cb201669:f728008a
wwn-0x5e83a97e51935e6f
wwn-0x5e83a97e51935e6f-part1
wwn-0x5e83a97e51935e6f-part2
wwn-0x5e83a97e51935e6f-part3
wwn-0x5e83a97e51935e6f-part4
wwn-0x5e83a97e51935e6f-part5
wwn-0x5e83a97e92e60d9a
wwn-0x5e83a97e92e60d9a-part1
wwn-0x5e83a97e92e60d9a-part2
wwn-0x5e83a97e92e60d9a-part3
wwn-0x5e83a97e92e60d9a-part4
wwn-0x5e83a97e92e60d9a-part5
wwn-0x5e83a97ea1ce5f22
wwn-0x5e83a97ea1ce5f22-part1
wwn-0x5e83a97ea1ce5f22-part2
wwn-0x5e83a97ea1ce5f22-part3
wwn-0x5e83a97ea1ce5f22-part4
wwn-0x5e83a97ea1ce5f22-part5
wwn-0x5e83a97eee5a5e03
wwn-0x5e83a97eee5a5e03-part1
wwn-0x5e83a97eee5a5e03-part2
wwn-0x5e83a97eee5a5e03-part3
wwn-0x5e83a97eee5a5e03-part4
wwn-0x5e83a97eee5a5e03-part5 |
Code: | # ls /dev/disk/by-uuid/
08F9-1EEA 7d9a2a89-7714-45ff-88c4-a843497c52c8
08F9-75CF 85c04561-6b37-421c-915f-642eaeeb920d
331b65d6-6868-4d30-8658-4b0d5ee9b0e1 99efc72a-866d-4101-b55d-11cabb7968c8
5638-04F8 dee6572e-d17a-43da-863b-9a729fe6d2ab
5638-6760 eceead72-a80c-4aa4-a60a-83950b793b23 |
Code: | # ls /dev/disk/by-path/
pci-0000:00:11.0-ata-1 pci-0000:00:11.0-ata-2-part4 pci-0000:00:11.0-ata-3.0-part2
pci-0000:00:11.0-ata-1-part1 pci-0000:00:11.0-ata-2-part5 pci-0000:00:11.0-ata-3.0-part3
pci-0000:00:11.0-ata-1-part2 pci-0000:00:11.0-ata-2.0 pci-0000:00:11.0-ata-3.0-part4
pci-0000:00:11.0-ata-1-part3 pci-0000:00:11.0-ata-2.0-part1 pci-0000:00:11.0-ata-3.0-part5
pci-0000:00:11.0-ata-1-part4 pci-0000:00:11.0-ata-2.0-part2 pci-0000:00:11.0-ata-4
pci-0000:00:11.0-ata-1-part5 pci-0000:00:11.0-ata-2.0-part3 pci-0000:00:11.0-ata-4-part1
pci-0000:00:11.0-ata-1.0 pci-0000:00:11.0-ata-2.0-part4 pci-0000:00:11.0-ata-4-part2
pci-0000:00:11.0-ata-1.0-part1 pci-0000:00:11.0-ata-2.0-part5 pci-0000:00:11.0-ata-4-part3
pci-0000:00:11.0-ata-1.0-part2 pci-0000:00:11.0-ata-3 pci-0000:00:11.0-ata-4-part4
pci-0000:00:11.0-ata-1.0-part3 pci-0000:00:11.0-ata-3-part1 pci-0000:00:11.0-ata-4-part5
pci-0000:00:11.0-ata-1.0-part4 pci-0000:00:11.0-ata-3-part2 pci-0000:00:11.0-ata-4.0
pci-0000:00:11.0-ata-1.0-part5 pci-0000:00:11.0-ata-3-part3 pci-0000:00:11.0-ata-4.0-part1
pci-0000:00:11.0-ata-2 pci-0000:00:11.0-ata-3-part4 pci-0000:00:11.0-ata-4.0-part2
pci-0000:00:11.0-ata-2-part1 pci-0000:00:11.0-ata-3-part5 pci-0000:00:11.0-ata-4.0-part3
pci-0000:00:11.0-ata-2-part2 pci-0000:00:11.0-ata-3.0 pci-0000:00:11.0-ata-4.0-part4
pci-0000:00:11.0-ata-2-part3 pci-0000:00:11.0-ata-3.0-part1 pci-0000:00:11.0-ata-4.0-part5 |
Code: | # hdparm -i /dev/disk/by-id/ata-OCZ-AGILITY3_OCZ-V8B5ER0E98Z45972
/dev/disk/by-id/ata-OCZ-AGILITY3_OCZ-V8B5ER0E98Z45972:
Model=OCZ-AGILITY3, FwRev=2.22, SerialNo=OCZ-V8B5ER0E98Z45972
Config={ HardSect NotMFM HdSw>15uSec Fixed DTR>10Mbs RotSpdTol>.5% }
RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=4
BuffType=unknown, BuffSize=unknown, MaxMultSect=16, MultSect=16
CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=468862128
IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}
PIO modes: pio0 pio1 pio2 pio3 pio4
DMA modes: mdma0 mdma1 mdma2
UDMA modes: udma0 udma1 udma2 udma3 udma4 udma5 *udma6
AdvancedPM=yes: unknown setting WriteCache=enabled
Drive conforms to: unknown: ATA/ATAPI-2,3,4,5,6,7
* signifies the current active mode |
Code: | # udevadm info --query=all --name=/dev/disk/by-id/ata-OCZ-AGILITY3_OCZ-V8B5ER0E98Z45972 | grep ID_SERIAL
E: ID_SERIAL=OCZ-AGILITY3_OCZ-V8B5ER0E98Z45972
E: ID_SERIAL_SHORT=OCZ-V8B5ER0E98Z45972 |
Code: | # smartctl -i /dev/disk/by-id/ata-OCZ-AGILITY3_OCZ-V8B5ER0E98Z45972
smartctl 7.3 2022-02-28 r5338 [x86_64-linux-5.15.74-gentoo-x86_64] (local build)
Copyright (C) 2002-22, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF INFORMATION SECTION ===
Model Family: SandForce Driven SSDs
Device Model: OCZ-AGILITY3
Serial Number: OCZ-V8B5ER0E98Z45972
LU WWN Device Id: 5 e83a97 e92e60d9a
Firmware Version: 2.22
User Capacity: 240,057,409,536 bytes [240 GB]
Sector Size: 512 bytes logical/physical
Rotation Rate: Solid State Device
TRIM Command: Available, deterministic
Device is: In smartctl database 7.3/5319
ATA Version is: ATA8-ACS, ACS-2 T13/2015-D revision 3
SATA Version is: SATA 3.0, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is: Thu Dec 1 10:45:13 2022 CET
SMART support is: Available - device has SMART capability.
SMART support is: Enabled |
I can't find the serial numbers I read on the disk labels anywhere in the Gentoo Linux system.
How can I determine which is which without having to connect/disconnect each disk one by one and figure that out by hand (also because I'm hoping to do so for a large set of disks)? |
|
Back to top |
|
|
szatox Advocate
Joined: 27 Aug 2013 Posts: 3137
|
Posted: Thu Dec 01, 2022 3:52 pm Post subject: |
|
|
/dev/disk/by-path/ shows the physical connection, right? So it might be a decent workaround. You can translate it to a more human-friendly form with readlink -f
I used to read serial numbers with hdparm, 1 disk at a time, using /dev/sd? paths as the device to query.
Finally, if you want to do that for "a large set of disks", this suggests a raid controller, or a shelf or something like that. Those things tend to come with LED indicators and hardware-specific commands providing "beacon" or "identify" functions by flashing a LED next to your device of choice.
Really useful when dealing with a raid of 120 devices in a single rack via remote hands. |
|
Back to top |
|
|
steve_v Guru
Joined: 20 Jun 2004 Posts: 388 Location: New Zealand
|
Posted: Fri Dec 02, 2022 4:12 am Post subject: |
|
|
I'd be inclined to ask OCZ why the serial numbers on the physical labels don't match the serial numbers reported to the OS...
I checked my stack of various drives, and only the OCZ SSDs (an agility and a vertex) have this mismatch. Everything else - Seagate, WD, Hitachi, Samsung, Crucial, Intel, Kingston - /dev/disk/by-id and the S/N reported by SMART aligns with the physical label on the drive.
The serial the device reports to software is what it is, and that's what you'll see in gentoo. Personally I'd either label the drive properly or use by-path, if it makes sense in the setup. _________________ Once is happenstance. Twice is coincidence. Three times is enemy action. Four times is Official GNOME Policy. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|