- Written by Erwin
- Category: Linux
- Published: 06 November 2013
- Hits: 1704
It took me a while to figure this out, but it is pretty easy... once you know how it works :)
You have installed Oracle Linux in a Virtualbox. You discover that your disk size is too low. You increase the VirtualBox disksize and you start the VM, discovering that the partition/disk isn't increased.
What you need to do is add the extra disk size to the partition. In my case /dev/sda.
Start a terminal session.
Enter the root password and then display your current partition info
You probably will notice a /dev/dm-x partition of the size equal to the increased size of your Virtualdisk. We need to add this partition to your /dev/sd<x>.
Check the fdisk -l output and notice that the number of cylinders does not match the End number of the last /dev/sd<x><n> device. Beneath you see 2610 cylinders but the /dev/sda2 ends already at 1566.
So, we need to add the partition at /dev/sda (in my case)
we want to create a new partition, partition number 3, with first and last cylinder as default, choose: n, p, 3, [press enter], [press enter]
then change the partition to LVM, choose: t, 3, 8e
finally choose: w
this will write the changes to disk
reboot your VM
after reboot start a terminal
enter root password
now we're going to add the partition (/dev/sda3) to the VolumeGroup. Thát will finally increase the volume.
first we create a physical volume
second, extend the volumegroup with /dev/sda3. Before we do that, we need to know the volumegroup.
My volumegroup is VolGroup00 and I need to add /dev/sda3
vgextend /dev/VolGroup00 /dev/sda3
Then we check if that went ok
The vgdisplay also displays the free extents (Free PE / Size). You need that number (in my case 255) to extend the Logical Volume (LV).
lvextend -l +255 /dev/VolGroup00/LogVol00
Finally use resize2fs (in case of ext2 and ext3 filesystem) to resize the LV.