LVM: Difference between revisions

Axka (talk | contribs)
Converted type descriptions to a definition list
Axka (talk | contribs)
Add ArchWiki link and document PE to explain that LVs don't have to be contiguous on a PV.
Line 1: Line 1:
[https://en.wikipedia.org/wiki/Logical_Volume_Manager_(Linux) The Logical Volume Manager] (LVM) provides means to dynamically organize partitions.
Linux's '''[https://en.wikipedia.org/wiki/Logical_Volume_Manager_(Linux) Logical Volume Manager] (LVM)''' provides means to dynamically organize partitions. For example, partitions can be created, moved, resized and deleted regardless of fragmentation on disk.


== Basic Setup ==
== Basic Setup ==
LVM manages three types:


; Physical volume (PV) : Space reservation consisting of a disk partition, a whole disk, a meta device, or a loopback file.
LVM manages four basic building blocks:
; Volume group (VG) : Group of physical volumes.
; Logical volume (LV) : Space reservation inside a volume group, which may be laid across multiple physical volumes.


=== Create a logical volume ===
; Physical volume (PV) : Unix block device node reserved for use by LVM. Examples: a disk partition, a whole disk (i.e. without a partition table), a meta device, or a loopback file.
; Volume group (VG) : Group of PVs for allocating PEs to LVs.
; Logical volume (LV) : "Virtual partition" composed of PEs inside a VG.
; Physical extent (PE) : The smallest contiguous [[wikipedia:Extent (file systems)|extent]] (default 4 MiB) in the physical volume that can be allocated to an LV.
 
=== Create an LV ===


<syntaxHighlight lang=bash>
<syntaxHighlight lang=bash>
Line 21: Line 23:
</syntaxHighlight>
</syntaxHighlight>


=== Use the Logical Volume ===
=== Use the LV ===
in your <code>configuration.nix</code>:
in your <code>configuration.nix</code>:


Line 32: Line 34:


== Booting with special LVM Modes ==
== Booting with special LVM Modes ==
LVM provides a number of special features such as creating snapshots, raid for single Logical Volumes and much more. If you want to use these devices on bootup, the associated <code>dm-*</code> kernel module must be provided in the initrd (see for example {{Issue|33646}}) . This is a non-exhaustive list of features and the corresponding kernel module and other options to put into your <code>configuration.nix</code>:
LVM provides a number of special features such as creating snapshots, RAID for single LVs and much more. If you want to use these devices on bootup, the associated <code>dm-*</code> kernel module must be provided in the initrd (see for example {{Issue|33646}}). This is a non-exhaustive list of features and the corresponding kernel module and other options to put into your <code>configuration.nix</code>:
<syntaxHighlight lang=nix>
<syntaxHighlight lang=nix>
boot.initrd.kernelModules = [
boot.initrd.kernelModules = [
Line 47: Line 49:


=== NixOps ===
=== NixOps ===
NixOps can repartition Hetzner Physical Machines, see [[https://nixos.org/nixops/manual/#idm140737318354032 NixOps Manual]].
NixOps can repartition Hetzner Physical Machines, see [https://nixos.org/nixops/manual/#idm140737318354032 NixOps Manual].


=== Disko ===
=== Disko ===
[[Disko]] provides means to automatically generate the creation and configuration of logical volumes, see https://github.com/nix-community/disko
[[Disko]] provides means to automatically generate the creation and configuration of logical volumes, see https://github.com/nix-community/disko
== See also ==
* [https://wiki.archlinux.org/title/LVM The corresponding ArchWiki page]


[[Category:Filesystem]]
[[Category:Filesystem]]