Linux Hotplug development
 help / color / mirror / Atom feed
From: "Brad Tilley" <brad@16systems.com>
To: linux-hotplug@vger.kernel.org
Subject: udev to obtain hard drive serial number
Date: Thu, 10 Nov 2011 15:06:58 +0000	[thread overview]
Message-ID: <44057.128.173.192.90.1320937618.squirrel@webmail.tuffmail.net> (raw)

What's the most stable way in which to obtain a hard drive serial number
using recent Linux kernels and udev. Normal users may call udevadm like
this to get the serial number:

/sbin/udevadm info --query=property --name /dev/sda | grep ID_SERIAL_SHORT
| tr = " " | awk '{print $2}'

output looks like this:

E3834563JPSNTN

How stable/reliable is this approach compared to other tools such as
hdparm, etc. Is there a better way to do this with udev?

Thanks for any advice,

Brad






                 reply	other threads:[~2011-11-10 15:06 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=44057.128.173.192.90.1320937618.squirrel@webmail.tuffmail.net \
    --to=brad@16systems.com \
    --cc=linux-hotplug@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox