[ipxe-devel] Add HDD serial and model to cfg setting
Melkor Lord
melkor.lord at gmail.com
Wed Oct 25 14:20:56 UTC 2017
On 24/10/2017 23:33, Sebastian Roth wrote:
> So I went ahead and looked at HDD serial number which seems to be more
> reliable than the other ones - at least in my case. Here is a short
> piece of code (tested on Debian Jessie) showing how to retrieve HDD
> information using one simple ioctl call:
>
> https://gist.github.com/Sebastian-Roth/026b977b0006bce8f81acec5bc3425a4
Looking at the code, I see that it returns HDD model and serial number.
While this works for uniqueness, you might easily get in trouble because
sometimes manufacturers use really weird chars in the "HDD model" field!
Most of the time, they put UTF-8 chars using ANSI/Windows1252 charset
which mix badly. I've seen really awful cases in my career.
I would suggest, if it's not too difficult, to fetch the WWN number
which is guaranteed to be unique while avoiding any kind of weird
characters.
As you are using Debian, check /dev/disk/by-id/wwn-*
I (quickly) found a pointer on how to obtain this information :
https://stackoverflow.com/questions/21977311/obtaining-wwn-of-sata-disks/21987269#21987269
Hope it helps.
--
Unix _IS_ user friendly, it's just selective about who its friends are.
More information about the ipxe-devel
mailing list