As a Linux/Ubuntu newbie, what is LVM and what is it used for?
In terms of a web server installation, what benefits does it provide?
Would you recommend using it?
You can think of LVM as “dynamic partitions”, meaning that you can create/resize/delete LVM “partitions” (they’re called “Logical Volumes” in LVM-speak) from the command line while your Linux system is running: no need to reboot the system to make the kernel aware of the newly-created or resized partitions.
Other nice features that LVM “Logical Volumes” provide are:
- If you have more than one hard-disk, Logical Volumes can extend over more than one disk: i.e., they are not limited by the size of one single disk, rather by the total aggregate size.
- You can set up “striped” LVs, so that I/O can be distributed to all disks hosting the LV in parallel. (Similar to RAID-0, but a bit easier to set-up.)
- You can create a (read-only) snapshot of any LV. You can revert the original LV to the snapshot at a later time, or delete the snapshot if you no longer need it. This is handy for server backups for instance (you cannot stop all your applications from writing, so you create a snapshot and backup the snapshot LV), but can also be used to provide a “safety net” before a critical system upgrade (clone the root partition, upgrade, revert if something went wrong).
While being most useful on server systems, I think that features 1. and 3., combined with LVM’s ability to create/resize/delete LVs on the fly, are quite handy on desktop systems as well. (Especially if you experiment a lot with the system.)
Of course, all of this comes at a price: the initial setup of LVM is more complex than just partitioning a disk, and you will definitely need to understand the LVM terminology and model (Logical Volumes, Physical Volumes, Volume Groups) before you can start using it. (Once it is set up, using it is much easier, though.)
Also, if you use LVM across hard drives, you may lose all your data when only one drive fails.
This Question and Answer are collected from stackExchange and tested by JTuto community, is licensed under the terms of
|CC BY-SA 2.5|