Getting hard disk drive serial number at the terminal - not the WWN
Solution 1
Assuming the disk supports SMART, you should be able to retrieve the disk serial number using smartctl -i /dev/sdX
Solution 2
You can get the serial number through :
1) hdparm
:
hdparm -I /dev/sda | grep Serial
2) sginfo
is a part of sg3-utils
package:
sginfo -a /dev/sda | grep Serial
3) sdparm
command :
sdparm -i /dev/sda | grep 'vendor specific'
4) lshw
:
lshw -class disk -class storage | grep serial
Solution 3
I only have WD drives to check on now, but udevadm info --query=all
shows
both ID_SERIAL
/ID_SERIAL_SHORT
(something like WD-WMATV6212345
and ID_WWN
(0x50014ee051234567
). Isn't the first what you are looking for?
smartctl -i
also shows both, hdparm -i
just the serial.
Solution 4
The lshw program shows it, at least with html output
sudo lshw -C disk -html > /some/place/hw.html
The relevant section on my hardware for one of my disks -
id: disk
description: ATA Disk
product: ST32000542AS
vendor: Seagate
physical id: 0.0.0
bus info: scsi@0:0.0.0
logical name: /dev/sda
version: CC34
serial: 5XW2PB56
size: 1863GiB (2TB)
capabilities: partitioned partitioned:dos
configuration:
ansiversion = 5
logicalsectorsize = 512
sectorsize = 512
signature = d46cf327
Related videos on Youtube
![Roberto](https://i.stack.imgur.com/0K8wZ.jpg?s=256&g=1)
Roberto
Updated on September 18, 2022Comments
-
Roberto almost 2 years
following the angular documentation
I write that part of code:
<select ng-model="model" ng-options="item.CODE as item.NAME disable when item.DISABLE for item in list" id="foo" name="foo" ng-change="change()">
but return me back this error:
Syntax Error: Token 'disable' is an unexpected token at column 11 of the expression [{3}] starting at [{4}].
What I'm doing wrong?
-
robbat2 about 7 yearsThere is a problem not mentioned here: Does the drive report a serial that matches what's physically printed on the label? There are definitely some drives in my experience where this is NOT true.
-
-
Victor Benetatos about 8 yearsWell, he is having an object data source, i thing, not an array!
-
Jenish Rabadiya about 8 years@VictorBenetatos the name(
list
) gave me hint it is the array. -
ste2425 about 8 yearsAre you saying
item.one as item.two
cannot be used when using disable? -
Jenish Rabadiya about 8 years@ste2425 ummm, Yes it is as per the document.
-
Jenish Rabadiya about 8 yearsWell, I think Whole ngOption directive was not there in earlier version.
-
ste2425 about 8 years@JenishRabadiya ahh didn't see the version of the docs, as mentioned this is perfectly valid syntax in newer version which confused me.
-
Roberto about 8 yearsI'm using version 1.4.4
-
Roberto about 8 yearsSo you think the problem is that I'm using an array with that format: [{CODE: "", NAME: "", DISABLE: true}, ..]
-
Jenish Rabadiya about 8 years@Roberto Yes. or use this syntex
select as label disable when disable for (key, value) in object
-
Roberto about 8 yearsI try as you write in your first answer but still didn't work. Now I'm going to try with new syntax you write now.
-
Jenish Rabadiya about 8 years@Roberto it works look at my plunk here.
-
Roberto about 8 years@Jenish yes but doing like that on the select appear the CODE string and not the NAME string
-
Roberto about 8 yearsI need that the select show the tiem.NAME but to the MODEL go the item.CODE
-
ron about 7 yearsso
hdparm -i /dev/sdc
which is my one operating system drive results inHDIO_DRIVE_CMD(identify) failed: Invalid exchange
andHDIO_GET_IDENTITY failed: Invalid argument
. I have been completely unable to get hdparm to work at all, this is on SLES 11.4. -
ron about 7 yearsThat was on an HGST drive where
ID_MODEL
is also reported correctly asHUC109060CSS600
. -
ron about 7 yearsfor a Seagate ST9300603SS,
ID_SCSI_SERIAL
reports a 20 character serial number, with the first 8 characters matching to the serial number on the label. -
cat about 7 years@ron
not a mounted volume or any kind of storage unit
would logically follow given that/dev/sda
is a physical device but/dev/sda1
is a partition and/
is a mount point -
Peter Mortensen about 7 years
-
RonJohn about 5 yearsThe
-html
option is not needed. -
Benyamin Jafari almost 5 yearsHow to retrieve hard disk serial when I use a VM ubuntu? The above commands return nothing on this situation
-
Ishara Samintha over 4 yearswhen i change to code.angularjs.org/1.4.5/angular.js (v1.4.5) this version disable things worked fro me earlier i had v1.3.0