Rename DEVICE and PARTITION variable to more meaningful DEVICEPATH and PARTITIONPATH.
Change the way "top-level" block device name is obtained from the
partitioned bit.

Assuming minor of zero leads to incorrect results, e.g. sdc2 (8:34)
being "reduced" to sda (8:0). Reduce trailing digits from root-device
instead.