Show pageOld revisionsBacklinksBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== Extend Existing Logical Volumes ====== **General Information** Expanding existing logical volumes non-destructively. ---- ===== Basic LVM Setup ===== **Create single partition on a new disk** <code bash> fdisk /dev/sdb n (new partition) (use defaults) t (change type) 8e (Linux LVM) w (write changes and quit) </code> \\ **Create physical volume** <code bash> pvcreate /dev/sdb1 pvdisplay </code> \\ **Create volume group** <code bash> vgcreate vglocal /dev/sdb1 vgdisplay </code> \\ **Create logical volume** <code bash> lvcreate -n lvstorage -L 20G vglocal lvdisplay </code> \\ **Create XFS Filesystem** <code bash> mkfs -t xfs /dev/vglocal/lvstorage </code> \\ **Mount the volume** <code bash> mkdir -p /mnt/mystorage mount /dev/vglocal/lvstorage /mnt/mystorage </code> ---- ===== Extend a volume group ===== **Create a partition on a new disk** <code bash> gdisk /dev/sdc (same defaults + lvm type change as basic setup) </code> \\ **Create physical volume from created partition** <code bash> pvcreate /dev/sdc1 </code> \\ **Extend the "vglocal" volume group and verify** <code bash> vgextend vglocal /dev/sdc1 pvs </code> ---- ==== Extend a logical volume ==== **Extend volume to be 30G in size(from 20G original)** <code bash> lvextend -L 30G --resizefs /dev/vglocal/lvstorage OR lvextend -L +10G --resizefs /dev/vglocal/lvstorage </code> * df -h shows that filesystem still needs to be resized to fill the LV container (if you did not use "--resizefs") \\ **Resize the filesystem - if you did NOT use the "--resizefs" option above** <code bash> xfs_growfs /dev/vglocal/lvstorage </code> * If EXT filesystem, use: resize2fs /dev/vglocal/lvstorage ---- linux_wiki/extend_existing_logical_volumes.txt Last modified: 2019/05/25 23:50(external edit)