How to get actual device mounted at / (/dev/root)

Hi all,

Is there a tool/command that will show me which physical device is mapped at /dev/root? I'm developing some automation around A/B upgrades using multiple partitions on x86 and the script needs to know which partition it is currently running as the root filesystem (so it doesn't accidently overwrite the active version).
df- k or mount doesn't help as it just shows /dev/root mounted on / rather than the actual device.

Thanks!

Nevermind - found the answer, it can be parsed from /proc/cmdline

1 Like

Supersebbo,

Could you also set this topic on Solved? Thanks in advance.

DG.

I got actual root device from /proc/self/mountinfo on NAS device (mvebu):

  1. get <major>:<minor> of /dev/root from /proc/self/mountinfo

  2. resolve actual device from <major>:<minor>

    basename $(readlink /sys/dev/block/<major>:<minor>)

2 Likes

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.