0

I want to do some testing involving LVM. Specifically, creating, destroying merging and splitting LVM Volume Groups.

But I don't have any spare physical volumes. I could create some, but that would be messy.

I imagine it's possible to create some kind of "virtual" physical volumes to use with LVMs. But I'm not sure of a clean way to do this. Suggestions appreciated. A detailed outline would be even more appreciated.

3
  1. Install VirtualBox, VMware Player. Of course any other type 2 hypervisor can do the work)
  2. Create virtual machine with bunch of disks (not need to be huge, 2-3-4GB will be fine)
  3. Install Linux (or OS you want to play)
  4. Create PVs, create VG(s), create LVs and start playing with LVM

P.S. You can try also to create files and use them as PVs to play with LVM. But if on your system you have already LVM in use I will not recommend play there.

The way to use files instead of disks or partitions in LVM is this:

  1. Create files:

dd if=/dev/zero of=lvmtest0.img bs=1024 count=1M dd if=/dev/zero of=lvmtest1.img bs=1024 count=1M ...

  1. Link them to loop interfaces:

losetup /dev/loop0 lvmtest0.img losetup /dev/loop1 lvmtest1.img

  1. Create them as PVs

pvcreate /dev/loop0 /dev/loop1

And then start with creating VG, LVs and so on You can check this site for more information

The reason I do not recommend play with LVM on your machine if you already have LVM there is there is always possibility to execute wrong command and to mess with LVM volumes where your OS is installed/your files reside

  • "You can try also to create files and use them as PVs to play with LVM." I'm not sure exactly what you have in mind. Can you elaborate? "But if on your system you have already LVM in use I will not recommend play there." Why not? – Faheem Mitha Jun 30 '17 at 8:50
  • @FaheemMitha, my idea is to create files and use them as PVs. Will add this in my answer – Romeo Ninov Jun 30 '17 at 9:06

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.