Sobes.tech
Junior — Middle

How is the configuration and management of logical volumes via LVM in Linux OS carried out?

sobes.tech AI

Answer from AI

LVM (Logical Volume Manager) in Linux allows flexible management of disk space through logical volumes. The main steps for configuration and management:

  1. Creating Physical Volumes (PV):
    pvcreate /dev/sdX
    
  2. Creating a Volume Group (VG):
    vgcreate vg_name /dev/sdX
    
  3. Creating Logical Volumes (LV):
    lvcreate -L 10G -n lv_name vg_name
    
  4. Formatting and mounting:
    mkfs.ext4 /dev/vg_name/lv_name
    mount /dev/vg_name/lv_name /mnt/point
    
  5. Management:
    • Extending a volume:
      lvextend -L +5G /dev/vg_name/lv_name
      resize2fs /dev/vg_name/lv_name
      
    • Shrinking and deleting volumes are also possible but require caution.

Thus, LVM allows dynamically changing volume sizes without reformatting, combining multiple physical disks into a single pool, and creating snapshots for backup.