LVM is a logical volume manager for the Linux kernel; it manages disk drives and similar mass-storage devices
LVM is suitable for:
Managing large hard disk farms by letting you add disks, replace disks, copy and share contents from one disk to another without disrupting service (hot swapping)
On small systems (like a desktop at home), instead of having to estimate at installation time how big a partition might need to be in the future, LVM allows you to resize your disk partitions easily as needed.
Making backups by taking "snapshots".
Creating single logical volumes of multiple physical volumes or entire hard disks (somewhat similar to RAID 0, but more similar to JBOD), allowing for dynamic volume resizing.
http://en.wikipedia.org/wiki/Logical_Volume_Manager_%28Linux%29
It might be acceptible to think of this as a sort of virtual disk that you can partition up
You might notice that above the volume group, we have created logical volumes, which might be thought of as virtual partitions, and it is upon these that we build our file systems.
http://serverfault.com/questions/272846/what-are-the-benefits-of-the-logical-volume-manager
- we know the physical devices we want to use, we can mark them as physical volumes within LVM using the pvcreate command:
verify that LVM has registered the physical volumes by typing
~# pvs
PV VG Fmt Attr PSize PFree
/dev/sda1 cinder-volumes lvm2 a-- 4.36t 2.03t
/dev/sdb1 cinder-volumes lvm2 a-- 5.45t 5.45t
To create the volume group and add both of our physical volumes to it in a single command, type:
sudo vgcreate LVMVolGroup /dev/sda /dev/sdb
The logical devices are available within the /dev directory just like other storage devices. You can access them in two places:
/dev/volume_group_name/logical_volume_name
/dev/mapper/volume_group_name-logical_volume_name
https://www.digitalocean.com/community/tutorials/an-introduction-to-lvm-concepts-terminology-and-operations
- What LVM Is
If you've ever used a SAN (Storage Area Network) in your server environment, you know it abstracts the idea of individual hard drives and allows you to carve out "chunks" of space to use as drives.
Rather than worrying about how big your hard drives might be, a SAN lets you throw all your hard drives into a big chassis and then allocate space to individual clients without being concerned about how many or how few physical drives are being used.
LVM is sort of like that, but for an individual system rather than an entire network.
Need a great big partition, but have only a bunch of smaller disks? No problem.
Have only a couple disks now, but want to add more later without reformatting? No problem.
Need to take snapshots, like with virtual servers, but you're using actual bare metal? No problem.
LVM makes dealing with storage far better than partitioning drives or using a simple RAID setup
What LVM Isn't
LVM would be a perfect replacement for hardware- or software-based RAID.
LVM doesn't provide any options for redundancy or parity.
That means if you have a drive fail in LVM, you lose data.
There's no such thing as striped LVM or mirrored LVM; it's simply not designed to do that.
LVM also isn't designed to increase speed by striping reads and writes across multiple disks.
LVM is really cool, but it is not in any way a replacement for RAID.
although it's certainly possible to use a physical drive as a physical volume in LVM, it's not a requirement.
In fact, it's not even the most common scenario.
In most production environments, LVM is used in combination with RAID.
Whether that's hardware-based RAID or software-based RAID, having your underlying physical volumes exist as RAID devices is ideal.
Even if you're installing only onto a single, non-RAID hard drive, setting up LVM allows you flexibility and expansion opportunity later.
Heck, it's possible to add RAID to a server later on, then simply migrate the data from your original physical volume to the RAID physical volume.
in this little example, you've done nothing but create a JBOD (Just a Bunch Of Disks) type system.
The Logical Volume Manager is a system that abstracts storage devices.
http://www.linuxjournal.com/content/lvm-demystified
LVM supports mirrored volumes. When you create a mirrored logical volume, LVM ensures that data written to an underlying physical volume is mirrored onto a separate physical volume. With LVM, you can create mirrored logical volumes with multiple mirrors.
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/4/html/Cluster_Logical_Volume_Manager/mirrored_volumes.html
- The mdadm utility can be used to create and manage storage arrays using Linux's software RAID capabilities.
What's LVM?
What LVM lets you do is collect all your disks, raid arrays and what-not into a big 'box' of storage (called a volume group)
Why not just use LVM?
LVM only lets you mirror or stripe - we want resilience but mirroring is bad - we need to buy twice as much storage as we want
https://www.mythtv.org/wiki/LVM_on_RAID
- Physical volumes represent disks that have been assigned to a volume group.
LVM uses each disk directly as a physical volume to overcome limitations and to allow increasing existing disks, which can be done in the hypervisor.
The illustration below shows a RAID 5 (with disk fail protection) which is included as a physical volume into the “datavg” volume group, and on the right hand the file systems “/data1” … “/data4” which use storage space from “datavg”.
https://www.helios.de/support/manuals/vsa-e/volume-management.html
- The following tutorial is intended to walk you through configuring a RAID 1 mirror using two drives with Mdadm and then configuring LVM on top of that mirror with the XFS file system. This is a great way to begin the setup of a NAS media server for either home or Enterprise use
- Software mirroring is where we start by creating raid devices upon which we will create LVM volumes