System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

How to get deveice name in kernel

 
mark.wang
Occasional Visitor

How to get deveice name in kernel

I using vfs struct -> vfs_name to get the device name, but when I tests at root device,I get the "/dev/root" ,not really logic device name like "/dev/vg00/lvol7".
7 REPLIES
avizen9
Esteemed Contributor

Re: How to get deveice name in kernel

what is your bdf output?
if you will get /dev/root mean its not in vg and when you are getting /dev/vg00/lvol7 mean it configure as volume group, thanks,
mark.wang
Occasional Visitor

Re: How to get deveice name in kernel

Thanks!
Using the "bdf" command can get correct result, it show that the root "/" was mounted on "/dev/vg00/lvo17".

Any idea? , How to using vfs struct at code to get device name? is it need to translate ?

other issue: I used vfs struct at my code can get device name correctly except the root "/" device.
mark.wang
Occasional Visitor

Re: How to get deveice name in kernel

bash-3.2# bdf
Filesystem kbytes used avail %used Mounted on
/dev/vg00/lvol3 2097152 1335824 761328 64% /
/dev/vg00/lvol1 298928 61008 208024 23% /stand
/dev/vg00/lvol7 8388608 2121872 6217800 25% /var
/dev/vg00/lvol6 10485760 1788024 8629840 17% /usr
/dev/vg00/lvol5 5242880 825520 4383280 16% /tmp
/dev/vg00/lvol8 8912896 2622408 6242024 30% /opt
/dev/vg00/lvol4 32030720 28569496 3461224 89% /home

mark.wang
Occasional Visitor

Re: How to get deveice name in kernel

can somebody can help me? or please move this thread to other Categories?

Re: How to get deveice name in kernel

Mark,

I think some context would help here - what are you trying to acheive? Is the only way to acheive this by fishing around in memory or a kernel dump?

Generally I'd always tell people to avoid digging into the kernel if there's a user space method of doing whyat you are attempting - a lot of stuff thats supposed to be purely internal to the kernel can change without warning and with no backwards compatibility, so its best avoided.

Anyway IIRC /dev/root is a special case thats used before the LVM device drivers are stood up to get at the root filesystem, so it should always relate to the device on which / is mounted. It's not surprising that this is what the kernel sees, as its started before LVM starts.

HTH

Duncan

HTH

Duncan
mark.wang
Occasional Visitor

Re: How to get deveice name in kernel

Thank you very much to Duncan ï¼ ï¼

My point is : we need to get some information ( device name, process name...) of a spacial "file" we care when catching some system call. then We can logging this information for backup.
So , it is seem that getting these information in kernel directly for reasons of efficiency.

maybe , it can do some translation while doing the logs. let "/dev/root" to really logic device.

Re: How to get deveice name in kernel

>we need to get some information (device name, process name...) of a special "file" we care when catching some system call.

I assume you are writing a device driver? You might want to be explicit about it.

Have you looked at the DDK? What OS version?
http://www.hp.com/go/hpux_ddk