Linux Administration/Devices and Filesystems/LVM
Appearance
(Redirected from LVM)
LVM[1] available in Linux allows manage multiple physical volumes or entire hard disks. It supports among other functionalities:
- Create single logical volumes of multiple physical volumes or entire hard disks
- Add or remove volumes/disk dynamically
- Increase or decrease size of Logical Volumes (LVs)
- Create snapshots
LVM introduces the concept of Volume Groups (VGs) and Logical Volumes (LVs).
Basic commands
[edit | edit source]- List Volume Groups:
vgs
[2] - List logical volumes:
lvs
[3], lvdisplay - Resize LV:
lvresize
lvextend
lvreduce
- Display commands:
- Create commands:
- Ls commands:
pvs
,lvs
[7],vgs
- Scan commands:
pvscan
[8],vgscan
- PV commands:
pvdisplay
[9],pvresize
,pvscan
,pvcreate
orpvcreate -vv
- LV commands:
lvcreate
[10], lvconvert - VG commands:
vgdisplay
,vgcreate
,vgcfgbackup
,vgscan
- LVM commands:
lvm dumpconfig
Advanced commands
[edit | edit source]lvchange
[11] — Change attributes of the Logical Volume Manager.lvmdiskscan
— Scan for all devices visible to LVM2.lvmdump
— Create lvm2 information dumps for diagnostic purposes.
Activities
[edit | edit source]Basic
[edit | edit source]- Read StackOverflow LVMs questions: https://superuser.com/questions/tagged/lvm?tab=Votes
- Configure an LVM Volume with an ext File Sytem: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/high_availability_add-on_administration/s1-lvmsetupnfs-haaa
Advanced
[edit | edit source]Before doing these exercises make your you have a backup of your data.
- Convert a Linear Device to a RAID device: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/configuring_and_managing_logical_volumes/index#proc_converting-linear-to-raid-configure-manage-raid
See also
[edit | edit source]- mdadm and ZFS
- resize2fs[12] file system resizer for ext2/ext3/ext4 (resize2fs /dev/mapper/VolGroup-lv_root) (for ext4 only).[13]. Code: https://github.com/tytso/e2fsprogs/blob/master/resize/resize2fs.c
- KVM
- Ansible LV module: https://docs.ansible.com/ansible/latest/modules/lvol_module.html#lvol-module
- dmsetup
- ↑ http://man7.org/linux/man-pages/man8/lvm.8.html
- ↑ http://man7.org/linux/man-pages/man8/vgs.8.html
- ↑ http://man7.org/linux/man-pages/man8/lvs.8.html
- ↑ http://man7.org/linux/man-pages/man8/pvdisplay.8.html
- ↑ http://man7.org/linux/man-pages/man8/pvcreate.8.html
- ↑ http://man7.org/linux/man-pages/man8/lvcreate.8.html
- ↑ http://man7.org/linux/man-pages/man8/lvs.8.html
- ↑ http://man7.org/linux/man-pages/man8/pvscan.8.html
- ↑ http://man7.org/linux/man-pages/man8/pvdisplay.8.html
- ↑ http://man7.org/linux/man-pages/man8/lvcreate.8.html
- ↑ http://man7.org/linux/man-pages/man8/lvchange.8.html
- ↑ https://manpages.debian.org/stretch/e2fsprogs/resize2fs.8.en.html
- ↑ https://www.technomenace.com/2014/08/how-to-extend-lvm-on-qcow2-images/