Computer data storage - LVM notes
|Computer data storage|
|These are primarily notes|
It won't be complete in any sense.
It exists to contain fragments of useful information.
What is LVM, and what can it do?
|This article/section is a stub — probably a pile of half-sorted notes and is probably a first version, is not well-checked, so may have incorrect bits. (Feel free to ignore, or tell me)|
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).
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
OSX has Core Storage since Lion
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