2.9.1 Extending the root LVM Partition
The following procedure describes how to extend the size of the root (/) partition:
Note:
-
This procedure does not require an outage on the server.
-
Make sure that
LVDbSys1andLVDbSys2are sized the same.
- Collect information about the current environment.
- Use the
dfcommand to identify the amount of free and used space in the root partition (/).# df -h /The following is an example of the output from the command:
Filesystem Size Used Avail Use% Mounted on /dev/mapper/VGExaDb-LVDbSys1 30G 22G 6.2G 79% /Note:
The active root partition may be either
LVDbSys1orLVDbSys2, depending on previous maintenance activities. - Use the
lvscommand to display the current volume configuration.# lvs -o lv_name,lv_path,vg_name,lv_sizeThe following is an example of the output from the command:
LV Path VG LSize LVDbOra1 /dev/VGExaDb/LVDbOra1 VGExaDb 100.00g LVDbSwap1 /dev/VGExaDb/LVDbSwap1 VGExaDb 24.00g LVDbSys1 /dev/VGExaDb/LVDbSys1 VGExaDb 30.00g LVDbSys2 /dev/VGExaDb/LVDbSys2 VGExaDb 30.00g LVDoNotRemoveOrUse /dev/VGExaDb/LVDoNotRemoveOrUse VGExaDb 1.00g
- Use the
- Use the
dfcommand to identify the file system type that is used in the root partition (/).# df -hT /The following is an example of the output from the command:
Filesystem Type Size Used Avail Use% Mounted on /dev/mapper/VGExaDb-LVDbSys1 ext3 30G 22G 6.2G 79% /In this example, the file system type is
ext3. - If the file system type is not
xfs, use the followingtune2fscommand to check the online resize option. If the file system type isxfs, then you can skip this step.tune2fs -l /dev/mapper/vg_name-lv_name | grep resize_inodeFor example:
tune2fs -l /dev/mapper/VGExaDb-LVDbSys1 | grep resize_inodeThe
resize_inodeoption should be listed in the output from the command. If the option is not listed, then the file system must be unmounted before resizing the partition. - Verify there is available space in the volume group
VGExaDbusing thevgdisplaycommand.# vgdisplay -sThe following is an example of the output from the command:
"VGExaDb" 834.89 GB [184.00 GB used / 650.89 GB free]The volume group must contain enough free space to increase the size of both system partitions, and maintain at least 1 GB of free space for the LVM snapshot created by the
dbnodeupdate.shutility during upgrade.If there is not enough free space, then verify that the
reclaimdisks.shutility has been run. If the utility has not been run, then use the following command to reclaim disk space:# /opt/oracle.SupportTools/reclaimdisks.sh -free -reclaimIf the utility has been run and there is not enough free space, then the LVM cannot be resized.
Note:
reclaimdisks.shcannot run at the same time as a RAID rebuild (that is, a disk replacement or expansion). Wait until the RAID rebuild is complete, then runreclaimdisks.sh. - Resize both
LVDbSys1andLVDbSys2logical volumes using thelvextendcommand.In the following example, XG is the amount of space in GB that the logical volume will be extended. The amount of space added to each system partition must be the same.
# lvextend -L +XG --verbose /dev/VGExaDb/LVDbSys1 # lvextend -L +XG --verbose /dev/VGExaDb/LVDbSys2The following example extends the logical volumes by 10 GB:
# lvextend -L +10G /dev/VGExaDb/LVDbSys1 # lvextend -L +10G /dev/VGExaDb/LVDbSys2 - Resize the file system within the logical
volume.
-
For
ext3andext4file system types, use theresize2fscommand:# resize2fs /dev/VGExaDb/LVDbSys1 # resize2fs /dev/VGExaDb/LVDbSys2 -
For the
xfsfile system type:-
Use the
xfs_growfscommand to resize the active file system:# xfs_growfs / -
Determine the inactive root partition.
The inactive root partition is
LVDbSys1orLVDbSys2, whichever is not currently mounted.Examine the output from the
dfcommand to confirm the active partition. For example:# df -hT / Filesystem Size Used Avail Use% Mounted on /dev/mapper/VGExaDb-LVDbSys1 30G 22G 6.2G 79% /The example shows
LVDbSys1as the active partition. Therefore, the inactive partition isLVDbSys2. -
Mount the inactive root partition to a temporary location.
For example:
# mkdir -p /tmp/mnt/root # mount -t xfs /dev/VGExaDb/LVDbSys2 /tmp/mnt/root -
Use the
xfs_growfscommand to resize the inactive file system:# xfs_growfs /tmp/mnt/root -
Unmount the inactive root partition.
For example:
# umount /tmp/mnt/root
-
-
- Verify the space was extended for the active system partition using the
dfcommand.# df -h /
Parent topic: Resizing LVM Partitions