Linux – Find out what device /dev/root represents in Linux

deviceslinuxproc

On linux, there is a /dev/root device node. This will be the same block device as another device node, like /dev/sdaX. How can I resolve /dev/root to the 'real' device node in this situation, so that I can show a user a sensible device name?

For example, I might encounter this situation when parsing /proc/mounts.

I'm looking for solutions that would work from a shell/python script but not C.

Best Answer

Parse the root= parameter from /proc/cmdline.