Computer data storage - LVM notes
(Redirected from LVM)
Computer data storage |
📃 These are primarily notes, intended to be a collection of useful fragments, that will probably never be complete in any sense. |
What is LVM, and what can it do?
✎ This article/section is a stub — some half-sorted notes, not necessarily checked, not necessarily correct. Feel free to ignore, or tell me about it.
LVM is a logical layer between physical disks and mountable volumes, that is typically managed and supported within the OS itself, or close enough that the result is still visible as whatever a relatively low-level drive (e.g. block device in linux).
LVM can refer to this idea of "let's put something inbetween to ease certain management",
and sometimes to some specific implementations of this idea.
LVMs can be useful for
- splitting up disks for different users (like partitioning, but with some of the below features involved)
- move data to other underlying disks without the filesystem level being aware of this
- e.g. preventive replacement of disks, or admins spreading VM's storage around
- resizing logical volumes, e.g. useful on servers where size requirements are likely to change over the long term (only makes sense when your filesystem supports resizes too, but various do)
- combine disks into a single storage space (note: basically like concatentating, so not failure-safe at all)
- mirroring volumes (similar to RAID1)
- making snapshots (online, read-only)
- often block-based copy-on-write logic - meaning blocks are shared between snapshot and current data until you change the current data.
- Snapshots are allocated as you create them, and act as mountable filesystems
- note that in itself offers no protection against drive failure
- ...and once you run out of copy-on-write space, the snapshots die -- an important detail in your planning
- useful as protection against (recent) user mistakes, not backup against failure
Linux LVM requires kernel support - that most kernels have.
Linux can boot from LVM columes, and many linux installers understand it.
In windows, there's
- "Dynamic disks" for a long while
- "Storage spaces" since around win10
OSX has Core Storage since Lion
Linux LVM
Terminology
There are three or four major concepts:
- PV: Physical Volume is a physical thing you can hold.
- VG: Volume Group is one or more PVs, which by itself is little more than a named pool of some PVs
- pp: A physical partition is a single partition on a disk (PV).
- Yes, you could use a single partition per PV, but in a number of situations it makes sense to subdivide them
- LV: A Logical Volume is a mountable result
- made of some combination of underlying linux device names (PV or pp device (verify)) that is configured in a specific way
- Exposed LV device names look something like /dev/vgname/lvname
See also: