Comment 1 for bug 1900842

Revision history for this message
Dimitri John Ledkov (xnox) wrote :

$ basename $(readlink /dev/block/$(cat /sys/block/$(basename $(readlink /dev/block/`grep /run/mnt/data /proc/self/mountinfo | tail -n1 | cut -d\ -f3`))/slaves/*/../dev))
sda

so this interates mountinfo; finds /run/mnt/data mountpoint; finds it major:minor; finds it's dm name; checks the slaves of said dm; to find underlying device; to find the parent of that device; to find major:minor of it; and map it back to it's name.

Doing this should reliably map "mountpoint -> parent device name" based on kernel information.