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:
- Creating Physical Volumes (PV):
pvcreate /dev/sdX - Creating a Volume Group (VG):
vgcreate vg_name /dev/sdX - Creating Logical Volumes (LV):
lvcreate -L 10G -n lv_name vg_name - Formatting and mounting:
mkfs.ext4 /dev/vg_name/lv_name mount /dev/vg_name/lv_name /mnt/point - 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.
- Extending a volume:
Thus, LVM allows dynamically changing volume sizes without reformatting, combining multiple physical disks into a single pool, and creating snapshots for backup.