I can create a lvm volume group with a loop device. But if I use dmsetup to map the loop device into several devices, then I can't create a lvm group with /dev/dm-. Why is it not possible to create group with dm-?

migrated from stackoverflow.com Jul 28 '13 at 9:39

This question came from our site for professional and enthusiast programmers.

  • It's possible, even normal (LUKS encrypted devices are dm- as well, and LVM on LUKS is entirely ordinary). You should state in your question which commands you were using and which errors you were getting. – frostschutz Jul 28 '13 at 10:17

Works for me:

# truncate -s10G a
# losetup /dev/loop1 ./a
# echo 0 $(blockdev --getsize /dev/loop1) linear /dev/loop1 0 | dmsetup create test
# pvcreate /dev/mapper/test
  Writing physical volume data to disk "/dev/mapper/test"
  Physical volume "/dev/mapper/test" successfully created
# vgcreate test /dev/mapper/test
  Volume group "test" successfully created
# lvcreate -n test -L1G test
  Logical volume "test" created
# dmsetup table test test-test
test: 0 20971520 linear 7:32 0
test-test: 0 2097152 linear 253:21 2048
# ls -l /dev/mapper/test /dev/mapper/test-test
lrwxrwxrwx 1 root root 8 Jul 24 14:05 /dev/mapper/test -> ../dm-21
lrwxrwxrwx 1 root root 8 Jul 24 14:05 /dev/mapper/test-test -> ../dm-22

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.