It is sometimes very time consuming to go down to the Data-Center and pull out a device for getting the serial number of the device, or even the service tag. It is however quite easy to extract that information from a running system (In case the Manufacturer has inserted that information into the BIOS.
This blog entry will show you how to extract that information on the Linux side.
Under Windows, almost every hardware manufacturer will provide its own tool for extracting the information (Dell, HP) will need to download the Bios Diagnosis tool etc. to extract that information. So - go to the manufacturer site, and check for the tool.
On a Linux system, the magic tool to use is dmidecode (on all older distributions). There are geeks out there telling that using lshw is better - but keep in mind that lshw will provide details on the hardware type, and amount and where it is placed on the system, but not on the serial numbers.
The advantage of dmidecode is that one can provide a string to extract only the serial number, one can provide the wanted information to extract:
For example when using dmidecode with a missing argument, one will see the list of specific data one can extract.
Provide the argument, and if it exists, it will be dumped to the shell. This comes in very handy when using a shell-script to automate the data extraction.
root@titan:~# dmidecode -s dmidecode: option requires an argument -- 's' String keyword expected Valid string keywords are: bios-vendor bios-version bios-release-date system-manufacturer system-product-name system-version system-serial-number system-uuid baseboard-manufacturer baseboard-product-name baseboard-version baseboard-serial-number baseboard-asset-tag chassis-manufacturer chassis-type chassis-version chassis-serial-number chassis-asset-tag processor-family processor-manufacturer processor-version processor-frequency root@titan:~# dmidecode -s system-product-name Latitude E7440 root@titan:~# dmidecode -s system-serial-number 5QY**** root@titan:~# dmidecode -s baseboard-asset-tag D20001*** root@titan:~# dmidecode -s chassis-manufacturer Dell Inc. |
Some devices on the lose do not have these information implanted. In that case, the admin will have to use the old long way to gather that information (manually). On systems where the Manufacturer has not entered the data, one can see either:
Missing data |
---|
[merjr01@apm nextcloud_prod]$ sudo dmidecode -s system-serial-number 1234567890 |
Note that sometimes, on String-data, one tends to find: To be filled by O.E.M. or N/A
dmidecode has also the possibility to list all information based on hardware type. When looking for specific hardware (for example to increase the amount of Memory for a device), one can start dmidecode -t memory to extract all details on the installed memory.
In the below example, one can see that the maximum capacity of 16GB of Ram is already installed. The below slot information show each an amount of 8GB Ram. One can also see the Manufacturer of the RAM, and more important the part number if one needs to be replaced!
Search for memory |
---|
jmertin@titan:~$ sudo dmidecode -t memory # dmidecode 3.1 Getting SMBIOS data from sysfs. SMBIOS 2.7 present.
Handle 0x0046, DMI type 16, 23 bytes Physical Memory Array Location: System Board Or Motherboard Use: System Memory Error Correction Type: None Maximum Capacity: 16 GB Error Information Handle: Not Provided Number Of Devices: 2
Handle 0x0047, DMI type 17, 34 bytes Memory Device Array Handle: 0x0046 Error Information Handle: Not Provided Total Width: 64 bits Data Width: 64 bits Size: 8192 MB Form Factor: SODIMM Set: None Locator: DIMM A Bank Locator: Not Specified Type: DDR3 Type Detail: Synchronous Speed: 1600 MT/s Manufacturer: Samsung Serial Number: 83C0**** Asset Tag: 02143900 Part Number: M471B1G73DB0-YK0 Rank: 2 Configured Clock Speed: 1600 MT/s
Handle 0x0049, DMI type 17, 34 bytes Memory Device Array Handle: 0x0046 Error Information Handle: Not Provided Total Width: 64 bits Data Width: 64 bits Size: 8192 MB Form Factor: SODIMM Set: None Locator: DIMM B Bank Locator: Not Specified Type: DDR3 Type Detail: Synchronous Speed: 1600 MT/s Manufacturer: Samsung Serial Number: CCF6**** Asset Tag: 03151900 Part Number: M471B1G73QH0-YK0 Rank: 2 Configured Clock Speed: 1600 MT/s |
On a rare occasion, one can also find serial numbers for specific addon-cards due to the loaded driver (binary blob).
Many intel based WiFi Mini-PCI cards for example do that. Using lspci as seen below.
Device serial |
---|
02:00.0 Network controller: Intel Corporation Wireless 7260 (rev 73) Subsystem: Intel Corporation Dual Band Wireless-AC 7260 Flags: bus master, fast devsel, latency 0, IRQ 47 Memory at f7d00000 (64-bit, non-prefetchable) [size=8K] Capabilities: [c8] Power Management version 3 Capabilities: [d0] MSI: Enable+ Count=1/1 Maskable- 64bit+ Capabilities: [40] Express Endpoint, MSI 00 Capabilities: [100] Advanced Error Reporting Capabilities: [140] Device Serial Number 80-19-34-ff-ff-a1-cb-33 Capabilities: [14c] Latency Tolerance Reporting Capabilities: [154] Vendor Specific Information: ID=cafe Rev=1 Len=014 <?> Kernel driver in use: iwlwifi Kernel modules: iwlwifi |
For add-on hardware which registers itself as another PCIx or USB compatible device, extracting the information will be more complex. Usually that will only work using the manufacturer provided software or drivers which can query the hardware for these details. The OS itself will only see the published API which usually does not provider any such details.
Using the storage manager for Adaptec controllers for example, one can see the following details including the Serial number.
Storage Manager details |
---|
=== Configuration controller 1 ! ============================================= Controllers found: 2 ---------------------------------------------------------------------- Controller information ---------------------------------------------------------------------- Controller Status : Optimal Channel description : SAS/SATA Controller Model : Adaptec 5405 Controller Serial Number : 2D3512**** Physical Slot : 1 Temperature : 77 C/ 170 F (Normal) Installed memory : 256 MB Copyback : Disabled Background consistency check : Disabled Automatic Failover : Enabled Global task priority : High Performance Mode : Default/Dynamic Defunct disk drive count : 0 Logical devices/Failed/Degraded : 1/0/0 |