Search This Blog


LVM dm device mapping

When trying to find out where swap is in relation to LVM it is useful to know how "dm" devices map to LV's

swapon -s
Filename                                Type            Size    Used    Priority
/dev/dm-1                               partition       11304952        0       -1

We can see that it's mapped to dm-1 which I'm unsure which logical volume that is. Running the following script will shed some light:
lvdisplay|awk  '/LV Name/{n=$3} /Block device/{d=$3; sub(".*:","dm-",d); print d,n;}'
dm-0 Vol1
dm-1 Vol2
dm-2 Vol3

Alternatively, just look at the second column of Block device in lvdisplay

Block device 253:1

Or an even better way is using dmsetup
dmsetup ls
Log-LogVol00    (253:2)
OS-LogVol01     (253:3)
OS-LogVol00     (253:0)
Data-LogVol00   (253:1)

The number after the colon is the dm-#

No comments:

Post a Comment