Given a block device, how can I get its "parent"?

A example would be a LUKS virtual decrypted device (/dev/mapper/decrypted), whose parent would be the encrypted block device (/dev/sdb)

1 Answer 1


For non-interactive work, this can be done using dmsetup deps, which lists the block device's dependencies. By default, it'll return the major:minor device numbers, but you can provide additional options to output a name:

dmsetup deps -o devname /dev/mapper/decrypted

For doing this interactively, the best way is just to use lsblk, which outputs a nicely formatted graph:

└─sda8                     8:8    0  43.9G  0 part  
  └─sda8_crypt           253:2    0  43.9G  0 crypt 
    ├─vgpersonal-home    253:3    0    83G  0 lvm   
  • I think the output of dmsetup deps is not very complete: For example when I specify a logical volume, I just get the name of the disk partition (like sda8). Is there a command to get all parents, children, and siblings? Re-using dmsetup does not work: For example dmsetup deps -o devname /dev/sda8 falsely claims Device sda8 not found. Of course it exists!
    – U. Windl
    Commented Nov 20, 2018 at 12:36
  • @U.Windl /dev/sda8 is very likely representing hardware, not a devicemapper blockdevice, so dmsetup can't possibly work there (as it states, the device doesn't exist, as far as devicemapper is concerned). Did you try using lsblk, which I mentioned in the answer? Commented Nov 25, 2018 at 20:33
  • In my view sda8 is not actual hardware, but sda would be: Without an sda, there would not be an sda8, so sda8 is a child of sda, and sda is a parent of sda8.
    – U. Windl
    Commented Nov 27, 2018 at 7:47
  • @U.Windl And that's exactly what you get with lsblk :) Commented Nov 28, 2018 at 0:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .