How can I get parent, children, siblings of a block device in Linux?
up vote
0
down vote
favorite
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).
linux dependencies block-device
|
show 1 more comment
up vote
0
down vote
favorite
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).
linux dependencies block-device
2
so, in short - whatlsblkdoes?
– frostschutz
2 days ago
@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 outputscr_home, which in turn cannot be used as parameter for further inspection (/dev/cr_homedoes not exist; it's a device-mapper device (dm-8)). So in short: Why did you think this would be the solution?
– U. Windl
2 days ago
Does this get you most of the way there?
– number9
2 days ago
@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
2 days ago
@number9: I did read that question before asking my own.lsblk -ashelps a bit, but it skips virtual devices (cr_homefor example).
– U. Windl
yesterday
|
show 1 more comment
up vote
0
down vote
favorite
up vote
0
down vote
favorite
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).
linux dependencies block-device
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).
linux dependencies block-device
linux dependencies block-device
edited 2 days ago
Rui F Ribeiro
38.2k1475123
38.2k1475123
asked 2 days ago
U. Windl
1314
1314
2
so, in short - whatlsblkdoes?
– frostschutz
2 days ago
@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 outputscr_home, which in turn cannot be used as parameter for further inspection (/dev/cr_homedoes not exist; it's a device-mapper device (dm-8)). So in short: Why did you think this would be the solution?
– U. Windl
2 days ago
Does this get you most of the way there?
– number9
2 days ago
@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
2 days ago
@number9: I did read that question before asking my own.lsblk -ashelps a bit, but it skips virtual devices (cr_homefor example).
– U. Windl
yesterday
|
show 1 more comment
2
so, in short - whatlsblkdoes?
– frostschutz
2 days ago
@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 outputscr_home, which in turn cannot be used as parameter for further inspection (/dev/cr_homedoes not exist; it's a device-mapper device (dm-8)). So in short: Why did you think this would be the solution?
– U. Windl
2 days ago
Does this get you most of the way there?
– number9
2 days ago
@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
2 days ago
@number9: I did read that question before asking my own.lsblk -ashelps a bit, but it skips virtual devices (cr_homefor example).
– U. Windl
yesterday
2
2
so, in short - what
lsblk does?– frostschutz
2 days ago
so, in short - what
lsblk does?– frostschutz
2 days ago
@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
2 days ago
@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
2 days ago
Does this get you most of the way there?
– number9
2 days ago
Does this get you most of the way there?
– number9
2 days ago
@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
2 days ago
@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
2 days ago
@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
yesterday
@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
yesterday
|
show 1 more comment
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f482967%2fhow-can-i-get-parent-children-siblings-of-a-block-device-in-linux%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
so, in short - what
lsblkdoes?– frostschutz
2 days ago
@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 outputscr_home, which in turn cannot be used as parameter for further inspection (/dev/cr_homedoes not exist; it's a device-mapper device (dm-8)). So in short: Why did you think this would be the solution?– U. Windl
2 days ago
Does this get you most of the way there?
– number9
2 days ago
@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
2 days ago
@number9: I did read that question before asking my own.
lsblk -ashelps a bit, but it skips virtual devices (cr_homefor example).– U. Windl
yesterday