LVM: Difference between revisions
imported>Mrmaxmeier m fixed syntax |
Converted type descriptions to a definition list |
||
(11 intermediate revisions by 7 users not shown) | |||
Line 1: | Line 1: | ||
The Logical Volume Manager (LVM) provides means to dynamically organize partitions. | [https://en.wikipedia.org/wiki/Logical_Volume_Manager_(Linux) The Logical Volume Manager] (LVM) provides means to dynamically organize partitions. | ||
== Basic Setup == | == Basic Setup == | ||
LVM manages three types: | LVM manages three types: | ||
; Physical volume (PV) : Space reservation consisting of a disk partition, a whole disk, a meta device, or a loopback file. | |||
; 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 === | === Create a logical volume === | ||
Line 16: | Line 17: | ||
# creates a new logical volume named "home" with the size of 10GB (check with lvdisplay) | # creates a new logical volume named "home" with the size of 10GB (check with lvdisplay) | ||
# makes /dev/pool/home available | # makes /dev/pool/home available | ||
lvcreate - | lvcreate --size 10G --name home pool | ||
mkfs.ext4 /dev/pool/home | mkfs.ext4 /dev/pool/home | ||
</syntaxHighlight> | </syntaxHighlight> | ||
=== Use the Logical Volume === | === Use the Logical Volume === | ||
in your | in your <code>configuration.nix</code>: | ||
<syntaxHighlight lang=nix> | <syntaxHighlight lang=nix> | ||
fileSystems."/home" = { | |||
device = "/dev/pool/home"; | device = "/dev/pool/home"; | ||
fsType = "ext4"; | fsType = "ext4"; | ||
} | }; | ||
</syntaxHighlight> | </syntaxHighlight> | ||
== | |||
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 to put into your < | == 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>: | |||
<syntaxHighlight lang=nix> | <syntaxHighlight lang=nix> | ||
boot.initrd.kernelModules = [ | boot.initrd.kernelModules = [ | ||
"dm-snapshot" # when you are using snapshots | "dm-snapshot" # when you are using snapshots | ||
"dm-raid" # e.g. when you are configuring raid1 via: `lvconvert -m1 /dev/pool/home` | "dm-raid" # e.g. when you are configuring raid1 via: `lvconvert -m1 /dev/pool/home` | ||
"dm-cache-default" # when using volumes set up with lvmcache | |||
]; | ]; | ||
services.lvm.boot.thin.enable = true; # when using thin provisioning or caching | |||
</syntaxHighlight> | </syntaxHighlight> | ||
Line 45: | Line 50: | ||
=== Disko === | === Disko === | ||
Disko provides means to automatically generate the creation and configuration of logical volumes, see | [[Disko]] provides means to automatically generate the creation and configuration of logical volumes, see https://github.com/nix-community/disko | ||
[[Category:Filesystem]] |