0

I need an algorithm, that can determine the possible children, parents and siblings for any given block device (virtual or physical). In the past I have solved that problem for multipath devices and LVM Logical Volumes, but I'd like to have a complete algorithm.

For example a multipath device is given. That device could have four paths (disks), and the device could be partitioned. One partition could be part of an MD-RAID, the RAID could be partitioned, too, and one such partition could be used as LVM Physical Volume (PV) to build a Volume Group (VG) with several Logical Volumes (LV).

  • 2
    so, in short - what lsblk does? – frostschutz Nov 20 '18 at 12:59
  • @frostschutz: Did you try? In my case when staring at an LV (/dev/sys/home), I get the PV only, but not the parent of the PV (for example). And it outputs cr_home, which in turn cannot be used as parameter for further inspection (/dev/cr_home does not exist; it's a device-mapper device (dm-8)). So in short: Why did you think this would be the solution? – U. Windl Nov 20 '18 at 13:07
  • Does this get you most of the way there? – number9 Nov 20 '18 at 13:30
  • @U.Windl it resolves PV parent fine for me (disk->partition->raid->luks->lvm) and that's usually considered good enough™. It stops at loop devices though. There are other kinds of virtual block devices (like NBD), those could be anything really (up to userspace to decide), no sane way to cover everything – frostschutz Nov 20 '18 at 14:15
  • @number9: I did read that question before asking my own. lsblk -as helps a bit, but it skips virtual devices (cr_home for example). – U. Windl Nov 21 '18 at 9:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.