How can I get UUID of a volume that contains the / filesystem?
The best thing for that I've found to date is blkid -o list. But this output is human readable and hard to parse. Maybe there is a better way?
I need that to parameterize configuration management with system-specific templates.
NOTE about blkid gotcha for those who may reuse outcomes of my question in future: blkid caches results of previous runs at /etc/blkid.tab . That means that running blkid as non-root user first time will not return any data. Also, running blkid as non-root user after root run will return stale (possibly incorrect) data.
/dev/disk/by-label... This also works for partitions which are not mounted. It has the advantage of being able to write scripts which do things like rsync from root to root-bak which is far less error prone than using 2 UUIDS that don't "mean" anything. – Joe Oct 05 '17 at 22:05