1

Currently I am using this laborious command

lvdisplay | awk '/LV Path/ {p=$3} /LV Name/ {n=$3} /VG Name/ {v=$3}  /Block device/ {d=$3; sub(".*:", "/dev/dm-", d); printf "%s\t%s\t%s\n", p, "/dev/mapper/"v"-"n, d}'

Would like to know if there is any shorter method to get this mapping of combined output (lvpath, /dev/mapper/ and /dev/dm/* ), possibly a single command.

  • 1
    lvs -o may be an option – Raman Sailopal Nov 21 '17 at 14:34
  • Note that /dev/mapper/vgname-lvname is not correct for vg or lv names that contain dashes. – Stéphane Chazelas Nov 21 '17 at 14:52
3

From the man pages for lvdisplay.

Aside from the path to the block device the data can be reported directly from

lvdisplay -C -o "lv_path,lv_dm_path,lv_kernel_minor"

If you execute

lvdisplay -C -o " "

Then lvdisplay will list all of the available fields.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.