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: Alex Hornung <ahornung@xxxxxxxxx>
Date: Fri, 06 Aug 2010 22:17:37 +0100

For whatever it's worth it would also be possible to use libdevattr,
which offers a fairly easy way to query for all disk devices and get
additional information such as serial number, device path, disk type
(optical, floppy, raid, ...). This approach might require that the
serial number is added to the udev device dictionary in subr_disk.c as
soon as the serno becomes available, but it is a more flexible approach
and definitely better than adding another ioctl.

Cheers,
Alex Hornung

On 06/08/10 21:27, 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>




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