If extension of file system is
needed then you need to check for space in LV, if sufficient free space is not
there in that LV then you need to check for the space in VG, if it also not
have sufficient free space then you need
to add new physical Volume(PV). If you system have space at any step you can
proceed from that point onwards. Here in below scenario we imagine there in no
sufficient free space in LV and VG.
Plan of action
Ø Identify
new disk and create PVØ Extend Volume group.
Ø Extend Logical Volume.
Ø Extend File System.
Detect new LUN on the server
#ioscan -nfNC disk
To find which disks are not used in the LVM
#pvdisplay -l /dev/disk/*
Verify size of disk
#diskinfo /dev/rdisk/disk42Extend Volume group
Add the physical volume in the volume group using the vgextend command.# vgextend /dev/vg03 /dev/disk/disk42
Volume group "/dev/vg03" has been
successfully extended.
Volume Group configuration for /dev/vg03 has been
saved in /etc/lvmconf/vg03.conf
|
Verify that the volume group is
successfully extended using the vgdisplay command.
It gives complete information
about VG, LV, and PV#vgdisplay -v /dev/vg03
You can also use grep to get useful information only like below:
# vgdisplay -v /dev/vg03 |grep "PV Name"
PV Name /dev/disk/disk41
PV Name /dev/disk/disk42
|
Extend Logical Volume
A logical volume can span multiple physical volumes, but it cannot span multiple volume groups. If you don't specify where LVM should allocate the new extents, LVM simply uses the first available extents in the volume group.
Extend lvol1 up to 900GB without
specifying PV
# lvextend -L 1924 /dev/vg03/lvol1
Logical volume "/dev/vg03/lvol1" has
been successfully extended.
Volume Group configuration for /dev/vg01 has been
saved in /etc/lvmconf/vg03.conf
|
If you not have enough space on
VG then you may get the following error:
lvextend: Not enough free physical extents
available.
Logical volume "/dev/vg03/lvol1" could
not be extended.
Failure possibly caused by contiguous allocation
policy.
Failure possibly caused by strict allocation
policy
|
Verify the volume size by using the lvdisplay command.
# lvdisplay -v /dev/vg03/lvol1
It gives us complete information
about LV, Distribution of logical volume (in PV) and LE.
We can use grep command to get
the use full information only:#lvdisplay -v /dev/vg03/lovl1 | grep “LV Size (Mbytes)”
LV Size (Mbytes) 1924
|
Extend File System
Simply extending a logical volume does not make the new space available for use by the file system in that volume. The new space in the volume cannot be used until the file system’s superblock and other metadata structures have been notified that new space is available.
Extending file system without
online JFS:
We would need to unmount the /data
file system#umount /data
Extend the file system using the extendfs
file command.
#extendfs -F vxfs -s 115200
/dev/vg03/rlvol1
Here F: - File system type
s :- Specifies the number of
DEV_BSIZE blocks to be added to the file system.
If size is not specified, the
maximum possible size is used.
# extendfs /dev/vg03/rlvol1
You can check system block size
by below command:
#fstyp -v /dev/vg03/lvol1 | grep f_bsize
f_bsize: 8192
|
8192 file
system block size 1024
fragment size
|
From here we get 1block size =
8192KB = 8MB
Re-mount the /data file system.# mount /data
With OnlineJFS you do not need to
umount. Use fsadm instead:
# fsadm -b <new size in KB>
<mountpoint>
#fsadm -b 943718400 /data
Verify you have the OnlineJFS
software by using the command# swlist | grep JFS
Filesystem
kbytes
used
avail %used Mounted on
/dev/vg01/oracle 943718400 283115520 660612880 30% /data
|
thanks a lot for the information, its very useful
ReplyDeleteCan you extend the Volume Group without adding a new PV? I have increased the sixe of the virtual disk so do not need to add a new one.
ReplyDeleteyou can increase as many virtual disk as you want till space available in Volume Group. If there is no space in VG then you have to extend it with new PV.
ReplyDelete(root) @/var/adm/syslog> extendfs -F vxfs /dev/vgtest/lvtest
ReplyDeleteUX:vxfs extendfs: ERROR: V-3-20144: /dev/vgtest/lvtest is mounted, cannot extend.
(root) @/var/adm/syslog>
Any help?