I have been playing around with LVM on a virtual machine. Until now I have found only advantages on it and I'm thinking about using it on my real machine the next time I do a fresh install.

I have never used it on a "real life" scenario, so are there any shortcomings that I must be aware of, like performance penalties or harder management (e.g.: backup and recovery)?


There is quite a bit of literature out there:



The upshot is this: In almost all scenarios LVM will offer you more flexibility and easy of maintenance. Even in the case of recovery the oft-cited problem of oh-my-god-when-one-disk-goes-all-is-lost problem is mostly easier to deal with than many RAID setups. Provided you leave some slack in your disk space you can swap a broken disk for a new one with the system running. Quite nice.

The second worry cited: performance hits due to an additional virtual layer is also not a problem for most scenarios: The throughput is as good as good-old direct partitions.

However, all of these are rather vague statements given the unclear specifics of your setup. So to find out you need to provide a lot more information on usage scenarios etc. And even then, your best bet is some benchmarking (e.g. bonnie++). Btw, doing those with your virtual machine will not be helpful. It is however a good way to practice the setup which initially seems a little cumbersome.

Edit: How to deal with backups: If you are used to backing up your system hard disks using dd, you can continue this with logical volumes (LV). Keep in mind that LVs are also block devices to which dd can be applied. The underlaying organization for a block device is hidden from the recipient of a dd (one reason you can dump a partition into a file: dd if=/dev/hda1 of=/tmp/part_a1

However, using dd on a running system is dicey due to the potential changes in your disk while you are doing the backup (one protection would be to mount read-only). With LVM, however, none of that is necessary since you now have access to the fantastic new feature: snapshots!

Previously, you would have backed up the 'partition' directly and that is still valid:

dd if=/dev/mapper/VolGroup00-LogVol00 of=...

Now you can make a snapshot of a running system (provided there is some space, you might have to add disks and extend volume groups. All very easy ...)

lvcreate -s -L 64M -n mysnapshot /dev/VolGroup00/LogVol00

You can dd this to image it safe in the knowledge that it won't change.

So in summary, with a bit more work (in needing to understand the tools) you have more flexibility to get done what you are trying to achieve under many scenarios (including the backup issue)

  • When I need to backup my system I use dd (dd if=/dev/sda1 of=mybackup.raw). If I use LVM I am able to still make backups like this (replacing /dev/partition by /dev/mapper/lv_root_partition) and mount the resulting backup?
    – Salem
    Mar 26 '13 at 20:40
  • @Salem See my edits. The short answer is, yes, almost, but now there might be even better ways.
    – DrSAR
    Mar 26 '13 at 21:25

On virtual machine, everything is stored into files on your system, so there is no real performance reason to divide virtual disk to parts (swap etc).

It can have sense if you can place swap disk to different drive (ssd) via symlink, but then you rather use separate virtual disk.

  • The OP is probably not using LVM on a virtual machine for the benefits of LVM on a VM. Instead, it appears the OP is using LVM on a VM to test it and to learn how it works ("playing around"). Furthermore, performance is not the only or even, often, the primary benefit of LVM. The ability to span filesystems across multiple virtual machine disk files (which might not be dynamically adjusting virtual disks and/or might not be stored on the same physical device themselves) is handy. Finally, a VM can use a physical disk (this has been supported by most virtualization software for years). Mar 26 '13 at 22:12

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.