2

I configured my box to boot from an alternative disk through modifying the existing os. However, some partitions are still being mounted from the internal storage.

In the case of the /home partition, I’ve /dev/dm-0 which is used to decrypt the underlying block device. But since it’s an exact copy (because I dumped in raw /dev/sda to /dev/sdb), how to know if the device behind /dev/dm-0 is /dev/sda47 or /dev/sdc47?

user2284570
  • 2,020

1 Answers1

3

Run lsblk, optionally with -o +KNAME to add the "kernel name" column (by default it shows mapper symlink names):

$ lsblk -o +kname
NAME      MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT KNAME
sdc         8:32   0   3.7T  0 disk             sdc
└─sdc1      8:33   0   3.7T  0 part             sdc1
  └─vol5  253:1    0   3.7T  0 crypt /mnt/vol5  dm-1

In this example /dev/mapper/vol5 = /dev/dm-1 which consists of a single /dev/sdc1 device.

If you happen to have multi-device maps (e.g. dm-raid), the lsblk -M option will be useful.

Alternatively:

ls -l /sys/class/block/dm-0/slaves

ls -l /sys/class/block/sd*/holders

The dmsetup mappings can also be shown using dmsetup table, although then you'll have to manually look up the maj:min number from either lsblk or /dev anyway.

grawity
  • 501,077