comp.unix.programmer

[GNU/Linux] reading FS' UUID from an unprivileged process?


	How do I read the UUID of the filesystem covering a specific
directory from an unprivileged (non-root) process in GNU/Linux?
Currently, I have the two algorithms at hand:
??? Find the device holding the filesystem corresponding to the
directory specified, by scanning /proc/mounts (or mtab(5)),
from the last entry to the first match. Read blkid(8)'s
output (or /etc/blkid.tab), in the hope that the device's UUID
has been cached.
??? Use stat(2) to find the device number corresponding to the
directory specified. Read /etc/blkid.tab (for blkid(8), as of
1.0.0, seemingly cannot search by DEVNO), in the hope that the
device's UUID has been cached.
I guess that the latter is better, but wouldn't I be hit with
any underspecified details?
--
FSF associate member #7257




Written by Ivan Shmakov 04/10/2011 18.24.05
Check some pics on this site!
23/05/2012 22.26.47