Capturing the motherboard's serial number (SN) using Dmidecode

Source: Internet
Author: User

The serial number (SN) that the vendor burns into the motherboard is unique and can be used as a unique index for a single server. The serial number of the server can be easily crawled by the Dmidecode command under Linux.
However, because of the various manufacturers of SMBIOS brush write specifications are not the same, we need to do some compatible operation.
A brief summary, see the table below

Manufacturers General Crawl Method
Dell Dmidecode-s System-serial-number
Hp Dmidecode-s System-serial-number
Ibm Dmidecode-s System-serial-number
Huawei Dmidecode-s System-serial-number (Huawei Rack Server) or Dmidecode-s Baseboard-serial-number (Huawei Blades)


Use a shell to cover all models, as follows:

GET_SN () {        local mysn= ' dmidecode -s  system-serial-number | grep -v  ' # '         if  echo  "${MYSN}"  | grep -qiE  "^notspecified|^none|^tobefilledbyo.e.m.| O.E.M. "  ; then                     mysn= ' Dmidecode -s baseboard-serial-number '          fi         #对于RHEL4和CentOS4, Dmidecode does not support the-s parameter, Different SN acquisition methods are required         if grep -q  ' release 4 '    /etc/redhat-release ; then             mysn= ' dmidecode | grep -a5  ' system information '  | grep  ' Serial  number '  | awk  ' {PRINT&NBsp;$3} '  | sed  ' s/^[ \t]*//g '  | sed  ' s/[ \t]$//g '          fi            echo   $mySN         }

Want to help with server operations.

The original url:http://www.opstool.com/article/195 OPS Maintenance tool is worth reference!!!

Capturing the motherboard's serial number (SN) using Dmidecode

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.