Wiki/lvm.md

922 B

Logical Volume Manager (LVM)

Physical Volume Commands

  • pvs: Report information about Physical Volumes.
  • pvcreate: Initialize a disk or partition for use by LVM.
  • pvdisplay: Display attributes of a Physical Volume.
  • pvremove: Remove a Physical Volume.
  • pvresize: Resize a disk or partition in use by LVM2.
  • pvscan: Scan all disks for Physical Volumes.

Create LVM on new HD

  • Create Physical Volume: pvcreate /dev/<disk>
    • If you get Device excluded by a filter, it means that you have to delete the partitions on that device first
  • Create Volume Group: vgcreate <volGroupName> /dev/<device>
  • Create Virtual Volume: lvcreate -n <volName> -L <size> <volGroupName>
    • To make the volume use up all available space of the VG use -l +100%FREE instead of -L
  • Create file system: mkfs.ext4 /dev/<volGroupName>/<volName>

Fstab Mount

  • /dev/mapper/<volGroupName>-<volName>