How to Resize a VirtualBox guest Linux VDI Disk under Windows Host?

How to Resize a VirtualBox guest Linux VDI Disk under Windows Host?

Issue Summary

1. I would like to resize a VirtualBox Guest VM's VDI from the present size of 450 GB to 550 GB.

2. While I was applying patch in Oracle E-Business I got the following error, and that's where I realized that the Guest VM's VDI was full and require resizing:

Java HotSpot(TM) 64-Bit Server VM warning: Failed to reserve shared memory (errno = 12)

Environment

  • Host OS = Windows 7
  • Guest OS = Oracle Linux
  • GParted Live ISO Version = 0.20.0-2-i486.iso
  • Virtualbox Version = 4.3.15

Investigation Done

I found that the Logical Volume associated with second Linux Partition (/sda2) was full, and required more space allocated. I found it using the following command on the terminal:

df -k

b2ap3_thumbnail_0.png

Resolution Summary

Follow the below mentioned steps (in sequential order) to resize the Guest VM's VDI:

Step 1 - Shutdown Guest VM

Step 2 - Resize your Guest VM's VDI file from current 450 GB to 550 GB using the following command:

2.1. Open a command prompt in Windows 7

2.2. Change directory to where Virtualbox has been installed and issue the following commands:

cd C:\Program Files\Oracle\VirtualBox

VBoxmanage modifyhd "D:\VirtualBox VMs\Oracle EBS 12.2.4\Oracle EBS 12.2.4.vbox" --resize 550000

where 'Oracle EBS 12.2.4.vbox' is the name of my VDI.

Syntax of above command: VBoxManage modifyhd <absolute path to file> --resize <size in MB>

Step 3. Now the next step is to resize the Linux Physical partition sda2. Follow the below given steps to do it:

3.1. Download GParted Live ISO from gparted.org. The file I downloaded was by the name of gparted-live-0.20.0-2-i486.iso.

3.2. Now go to your Virtualbox VM Settings > Storage > Hit the + sign next to Controller IDE and select the gparted ISO file there. In my case it was with the name of 'gparted-live-0.20.0-2-i486.iso'.

 b2ap3_thumbnail_1.png

3.3. Save your settings and reboot.

3.4. On reboot choose GParted Live default settings and then press '0' to start in GUI mode.

3.5. There you will see the sda2. Simply resize it by pulling it towards right and consuming the entire 'free' space available.

3.6. Hit Apply button. Then right click on sda2 and 'Activate'.

b2ap3_thumbnail_2_20141114-001817_1.png

3.7. Close the window and shutdown the machine.

3.8. Go back to Virtualbox Settings > Storage > Remove GParted Live ISO CD.

Step 4. Now we should increase the Linux Logical Volume to the the new size of the partition (for which we have just increased the space). Follow these steps:

4.1. Reboot the Guest VM and login into Oracle Linux. Then open a new Terminal.

4.2. Resize the logical volume that was associated with sda2 partition. We will issue the command to consume the entire free space available in sdb2. To do that issue the following command:

lvextend -l +100%FREE /dev/mapper/VolGroup00-LogVol00

Output

Extending logical volume LogVol00 to 573.84 GB

Logical volume LogVol00 successfully resized

4.3. At this stage you have resized the logical volume (associated with sda2) but the file-system has not been resized. So if you go back and restart your installation it will fail since the files-system is still full.

Step 5. So the next step is to resize the ext4 file system that was associated with the above Linux Logical Volume. We will resize the ext file system to the full space available in the above Logical Volume. To do that issue the following command:

resize2fs /dev/VolGroup00/LogVol00

Output

resize2fs 1.39 (29-May-2006)

Filesystem at /dev/VolGroup00/LogVol00 is mounted on /; on-line resizing required

Performing an on-line resize of /dev/VolGroup00/LogVol00 to 150429696 (4k) blocks.

The filesystem on /dev/VolGroup00/LogVol00 is now 150429696 blocks long.  

Step 6. You may now re-boot the Guest VM, and restart your installation with the new size.

Syntax error: Invalid parameter 'VMs\Oracle' while...
Error while applying Oracle E-Business Suite Relea...