Solution : Since Oracle VM Template is using logical partition, it can be expand easily by following the steps below.
Before proceed to expand the Logical partition, please do a backup of the virtual guest machine first. You can easily clone the virtual machines by using the cloning feature in Oracle VM Manager.
You also need to gather the required information in your system first before proceed.
Prerequisite : You will have to know the file system type, volume group.
To check file system type, you can issue the command df -Thl.
[root@e1ent /]# df -Thl
Filesystem Type Size Used Avail Use% Mounted on
/dev/xvda2 ext3 9.6G 3.0G 6.7G 31% /
/dev/xvda1 ext3 99M 39M 56M 41% /boot
tmpfs tmpfs 1.5G 0 1.5G 0% /dev/shm
/dev/mapper/VolGrp01-LgVol01
ext3 20G 11G 8.4G 56% /u01
Filesystem Type Size Used Avail Use% Mounted on
/dev/xvda2 ext3 9.6G 3.0G 6.7G 31% /
/dev/xvda1 ext3 99M 39M 56M 41% /boot
tmpfs tmpfs 1.5G 0 1.5G 0% /dev/shm
/dev/mapper/VolGrp01-LgVol01
ext3 20G 11G 8.4G 56% /u01
Now, you have got the required information. It is time to proceed to expand the logical drive of u01.
Steps to expand storage:
1. Create a new virtual disk and attach to the virtual machines that you want to expand the logical partition by using Oracle VM Manager.
After attached, in virtual machines issue the command fdisk -l and you will be able to see a new disk without partition.
After you have able to see the new disk, run the below command to create a new partition.
3. Run a file system check with the command /sbin/fsck -f /dev/VolGrp01/LgVol01 where VolGrp01 is the VolumeGroup and LgVol01 is the LogicalVolume. If there is error will checking the file system, you can issue the same command but add in the option "-y" to attempt to repair the error. The new command will be
/sbin/fsck -fy /dev/VolGrp01/LgVol01
4. Initialize the new partition with the command pvcreate /dev/xvdc1.
5. Add the newly created partition to the volume group with command
vgextend VolGrp01 /dev/xvdc1
6. Type vgs to verify that the Volume Group is extended.
7. After added in the new partition, you have to extend the actual logical volume with the command lvextend -L +20G VolGrp01/LgVol01
8. Type lvs to make sure the Logical Volume is extended.
9. Now, extend the ext3 filesystem with the command /sbin/resize2fs /dev/VolGrp01/LgVol01.
10. Re-check the newly created filesystem with the same command as in Point number 3.
11. Mount back /u01 with the command mount /u01.
12. Type df -hl and you should be able to see the size of the mounted volume which is /u01 increased.
Reference :
Oracle Support
How To Extend An LVM (Logical Volume Manager) Volume (Doc ID 979522.1)