Difference between revisions for lvm





Next edit →


Hits : 6,708

lvm basics


physical volumes


# pvs
  PV         VG     Fmt  Attr PSize   PFree  
  /dev/sda2  vg_79 lvm2 a--  465.52g 211.52g		


list physical volumes

# pvdisplay 

# pvdisplay  -C		

volume groups


# vgs
  VG     #PV #LV #SN Attr   VSize   VFree  
  vg_79   1  1    wz--n- 465.52g 211.52g		


list all volume groups

# vgscan

# vgdisplay

# vgdisplay -C		


activate all 

# vgchange -ay		


deactivate a specific volume group

# vgchange -an vol_group_1		


activate all logical volumes on a volume group, only

# vgchange -ay vol_group_1		

logical volumes


list logical volumes

# lvs

# lvdisplay -C		


Create a new LVM partition


# lvcreate -L 1G -n /dev/vg_group1/lv_vol1 

# mkfs.ext4 -L lv_vol1 /dev/vg_group1/lv_vol1 

# mount /dev/vg_group1/lv_vol1 /media/		

extend an lvm partition


How to extend an lvm partition:

umount /opt/dnl

lvextend -L +5G /dev/vg1/dnl

e2fsck -f /dev/vg1/dnl

resize2fs /dev/vg1/dnl 

mount /opt/dnl/		

resize to 1%


BASH
# lvresize -l +1%FREE -n /dev/vg1/backup 
<!--markup:2:begin-->


resize xfs 

LVM resize




# lvresize -l +1%FREE -n /dev/vg_xps/lv_Breach

  Size of logical volume vg_xps/lv_Breach changed from 5. GiB (128 extents) to <6.97 GiB (1784 extents).
  Logical volume vg_xps/lv_Breach successfully resized.		

xfs grow



# xfs_growfs /opt/Breach<!--markup:2:end-->