Hi guys. Okay so this is new twist on an old problem. I just found out.
I was using "df" to find the device of a mount, but found a flaw as a long device name can split the result into two lines. Or it could be mounted as a label so doesn't point directly to a device. In my case both of these together corrupted my script which was grabbing the device from the output.
So I have a device mounted at a point. But it isn't always a straight block device. It could be a UUID or label mount.
/dev/disk/by-label/boot on /target/boot
Let's say that "/dev/disk/by-label/boot" actually points to "/dev/sda1". So how to I take "/dev/disk/by-label/boot" and determine if it is an actual block device? And if not how do I find that actual device it points to?
From experimenting I've noticed that the label points are links that go back to the actual device. Not exactly directly but through a "../../". So it seems obvious I need to see if its a link and follow it through.
But before I muck around like that. Is there a better way? Some mash of mount, df or blkid or anything to tell me what I need to know?