Home > Hardware, Storage > Extending filesystems on LVM VXVM/VXFS how to

Extending filesystems on LVM VXVM/VXFS how to

April 17th, 2011

Linux LVM


You can grow LVM/ext pair online, without the need to umount the FS.

Step zero: check how much space is available in the PV in question, using “vgdisplay”
First, use “lvextend -L” to extend the volume. You can either specify total new size, like “2GB”, or how much space to add, like “+1GB”
Second, grow the FS. Use “resize2fs” without any flags to grow/shrink the FS to all the space available in the volume.

lvextend -L 2G /dev/VolGroup00/apps-yourapp
resize2fs /dev/VolGroup00/apps-yourapp

Shrinking can’t be done that easily and requires an umount. To shrink the FS, do the following:

umount <logical-volume-device>
e2fsck -f <logical-volume-device>
resize2fs <logical-volume-device> <new-size-minus-50MB>
lvreduce -L <new-size> <logical-volume-device>
resize2fs <logical-volume-device>
mount <logical-volume-device>
Basically, we have to umount the partition and fsck it, then we resize the FS to a slightly smaller size then we want in the result, this saves us from counting up actual size blocks and possible errors buried here (if we accidentally resize the volume to be smaller then the FS, FS will become corrupted and there’s no easy way to restore it). Only then we shrink the volume and resize the FS to fill the whole volume.


umount /dev/VolGroup00/apps-yourapp
e2fsck -f /dev/VolGroup00/apps-yourapp
resize2fs /dev/VolGroup00/apps-yourapp 750M
lvreduce -L 800M /dev/VolGroup00/apps-yourapp
resize2fs /dev/VolGroup00/apps-yourapp
mount /dev/VolGroup00/apps-yourapp
Solaris zfs

Working with zfs filesystems is real simple. Just change quota and possibly reservation attributes on the relevant filesystem, like this:

zfs set quota=1G localpool/var-opt
zfs set reservation=1G localpool/var-opt
You can both grow and shrink filesystems like this, online.


1) Enlarging VxVM controlled filesystem by adding new LUN

- get & discover new LUN

- add LUN to DG

vxdg -g dg1 adddisk {disk_name}
-grow filesystem

vxresize -b -F vxfs -g dg1 vol1 100G
2) Enlarging VxVM controlled filesystem by extending LUN

- grow LUN

- refresh VxVM info on LUN size

vxdisk -g dg1 resize {disk_name}
- get new max volume size

vxassisst -b maxgrow vol1
- grow volume and FS

vxresize -b -F vxfs -g dg1 vol1 100G

If working on a server that is part of a cluster (VCS/WAS/other), make sure to apply changes to all nodes to keep them consistent.

Good Luck!

Categories: Hardware, Storage Tags:
  1. No comments yet.
Comments are closed.