DragonFly BSD
DragonFly users List (threaded) for 2010-08
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: Utility to list /dev/nodes & serno's


From: Antonio Huete Jimenez <ahuete.devel@xxxxxxxxx>
Date: Thu, 19 Aug 2010 13:10:40 +0200

Hi

Here you have the approach. I'll commit today if it's okay.

http://gitweb.dragonflybsd.org/~tuxillo/dragonfly.git/shortlog/refs/heads/dev2serno

Cheers,
Antonio Huete

2010/8/12 Aggelos Economopoulos <aoiko@cc.ece.ntua.gr>:
> On 08/12/2010 10:30 AM, Dylan Reinhold wrote:
>> On 08/06/2010 01:27 PM, Matthew Dillon wrote:
>>> :Hi people,
>>> :
>>> :is there a way to easily list all disks and their associated serno's ?
>>> :Something like 'blkid' utility of Linux, if you happen to know it.
>>> :I could happily hack something like that, if we lack it.
>>> :
>>> :
>>> :Cheers,
>>> :Stathis
>>>
>>>     There isn't, and that would be cool.  It is fairly easy to match
>>>     up device numbers from devfs.
>>>
>>>     You can use sysctl kern.disks output to get a list of disk devices,
>>>     then you can scan /dev and pick those base names out and stat them,
>>>     and you can scan /dev/serno and stat those babies and match up
>>>     the st_rdev's with the ones from /dev to getting related serial
>>>     numbers.
>>>
>>>     If we wanted to get more involved we could add an ioctl() to retrieve
>>>     the serial number (if available), but it can definitely be scripted
>>>     right now without that.
>>>
>>>                     -Matt
>>>                     Matthew Dillon
>>>                     <dillon@backplane.com>
>>
>> I started a utility a while back going down a different path, I have now
>> changed it to use the sysctl call like Matt pointed out.
>
> That is a suboptimal approach. It should be trivial to export serno via
> udev as Alex suggested and just as trivial to parse that (and more) info
> from a userspace utility using libdevattr. It is generic and extendable.
> Just try it :)
>
> Aggelos
>



-- 
Cheers,
Antonio Huete




[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]