LVM
Here are some useful commands to manage LVM.
Configuration
Commands
Display informations
- Display attributes of physical volumes
root@host:~# pvdisplay
- Display volume group information
root@host:~# vgdisplay
- Display information about a logical volume
root@host:~# lvdisplay
Create
root@host:~# pvcreate /dev/sda1
- Create volume group named vg01
root@host:~# vgcreate vg01 /dev/sda1
- Create 15Go size logical volume named lv01
root@host:~# lvcreate -L 15G -n lv01 vg01
Extend a ext2/ext3/ext4 volume (here with /tmp)
root@host:~# umount /tmp
- Here we want to add 10Go more (we can use -r argument which allow to automatically resize file system) :
root@host:~# lvextend -L+10G /dev/mapper/tmp
- We manually resize our file system
root@host:~# resize2fs /dev/mapper/tmp
- We mount back our partition
root@host:~# mount /tmp
Activate logicals volumes
- Active all logicals volumes from a volume group
root@host:~# vgchange -ay VGNAME
root@host:~# lvchange -ay LVNAME