From Notes Wiki
Jump to: navigation, search
(Created page with "<yambe:breadcrumb>CentOS_7.x_LVM|CentOS 7.x LVM</yambe:breadcrumb> =CentOS 7.x Live extend size of ext4 on top of LVM without umount= If ext4 filesystem is setup on top of a...")
 
m
 
Line 43: Line 43:
 
* https://www.tecmint.com/extend-and-reduce-lvms-in-linux/
 
* https://www.tecmint.com/extend-and-reduce-lvms-in-linux/
 
* https://kerneltalks.com/disk-management/how-to-rescan-disk-in-linux-after-extending-vmware-disk/
 
* https://kerneltalks.com/disk-management/how-to-rescan-disk-in-linux-after-extending-vmware-disk/
 +
 +
 +
For reverse shriking or reducing existing partition on top of LVM refer https://www.systutorials.com/124416/shrinking-a-ext4-file-system-on-lvm-in-linux/
 +
 +
Also see:
 +
*[[CentOS 7.x Create LVM partition on new disk]]
 +
  
  
 
<yambe:breadcrumb>CentOS_7.x_LVM|CentOS 7.x LVM</yambe:breadcrumb>
 
<yambe:breadcrumb>CentOS_7.x_LVM|CentOS 7.x LVM</yambe:breadcrumb>

Latest revision as of 12:54, 13 September 2019

Home > CentOS > CentOS 7.x > System administration > File system management > CentOS 7.x LVM > CentOS 7.x Live extend size of ext4 on top of LVM without umount

CentOS 7.x Live extend size of ext4 on top of LVM without umount

If ext4 filesystem is setup on top of a logical volume, we can increase the file-system size without umount. This can also be done even if ext4 is not on top of LVM if filesystem is created directly on top of iSCSI/FC storage and we can increase size of storage disks:

  1. If storage LUN is known skip this step, else use "vgdisplay <volume-name> -v" command to get full details of physical volumes associated with a volume group.
  2. Once physical volume name(s) is known we can determine corresponding storage LUN ID. If physical volume is a multipath address /dev/mapper/mpath<x> then use "multipath -ll" to see associated disks and LUN ID. If physical volume is on top of a physical disk /dev/sd<x> then use "ls -l /dev/disk/by-id" to figure our corresponding LUN ID.
  3. Once LUN ID is known using above steps or if LUN is already known due to proper naming/documentation, then extend the LUN at storage level. Some storages might require re-mapping (or exporting) the increased LUN with the same host again for the changes to reflect at compute server end.
    If existing LVM physical volume (Disk) is not coming from storage then we can add additional disks, create physical volume on top of them and add them to existing volume group. These steps are not described as part of this article
  4. On Linux machine in case of multipath use "multipath -ll" to see if the new disk size is visible in corresponding mpath. If not rescan all associated devices using:
    echo "1" > /sys/class/block/sd<x>/device/rescan
    Do this for all devices in corresponding multipath group.
    If multipath was not used then simply scan the individual disk which is resized.
  5. Then use "systemctl reload multipathd". Note use of "reload" and do not use "restart"
  6. Now verify that "multipath -ll" is showing updated size from storage.
  7. Check existing number of used and free Physical Extent (PE) in corresponding volume group using:
    vgdisplay <volume-group> -v
  8. Resize physical volume to use full disk space using:
    pvresize /dev/mapper/mpath<x>
  9. Again use:
    vgdisplay <volume-group> -v
    and see that number of free PE have increased from previous (possibly 0) to a larger value.
  10. Resize corresponding lvm partition using:
    lvresize /dev/<volume-group>/<logical-volume> -l +<physical-extents>
    Here, number of physical extents cannot exceed free physical extents in vgdisplay -v output
  11. Use file-system resize option. In case of ext4 we can do live resize without umount using:
    resize2fs /dev/<volume-group>/<logical-volume>


Refer:


For reverse shriking or reducing existing partition on top of LVM refer https://www.systutorials.com/124416/shrinking-a-ext4-file-system-on-lvm-in-linux/

Also see:


Home > CentOS > CentOS 7.x > System administration > File system management > CentOS 7.x LVM > CentOS 7.x Live extend size of ext4 on top of LVM without umount