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?
tl;dr: you can more easily replace and resize things later, can combine disks, and use copy-on-write snapshots
LVM is a logical layer between physical disks and mountable volumes.
They can be useful for
- move data to other underlying disks without the filesystem level being aware of this
- e.g. preventive replacement of disks
- also nice for admins when allocating space to VMs
- resizing logical volumes, e.g. useful on servers where size requirements are likely to change (only makes sense when your filesystem supports resizes too, but most 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)
- 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.
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