VirtualBox Setups - sammanthp007/Linux-Kernel-Development GitHub Wiki

VirtualBox Setup

To enable copy paste mode + shared directory mode

  1. In devices, turn those features on.
  2. Then, install Guest Additions

How to Resize a VirtualBox VDI or VHD File on Mac OS X

As mentioned in this blog and this blog:

  1. Goto VirtualBox app directory:
cd /Applications/VirtualBox.app/Contents/Resources/VirtualBoxVM.app/Contents/MacOS/
  1. See details of the current vdi
VBoxManage showhdinfo ~/path/to/vmdrive.vdi
  1. Resize the vdi
# VBoxManage modifyhd --resize [new size in MB] [/path/to/vdi]
VBoxManage modifyhd --resize 30000 ~/Documents/VM/Windows10.vdi
  1. Verify the change
VBoxManage showhdinfo ~/path/to/vmdrive.vdi
  1. Resize the linux partition
  • Close all virtual machines
  • Download GParted iso from their site
  • Go to VirtualBox and for the Virtual Machine we are extending, open settings->storage
  • Under “Controller: IDE Controller” add a new CD/DVD device. Browse to the location of your GParted ISO file and select it. Your first item under “Controller: IDE” should be “gparted-live-XXX”. If you have a second “Empty” disk you can remove it.
  • Press OK and start your GParted Virtual Machine and you should see it boot (very quickly). Choose Gparted Live (Default settings). Choose all the default settings and your language of choice. Press 0 to start X
  • You can see that there are 78.12GB unallocated and this is the space that we wish to allocate in my case to /dev/sda1 which is an ext4 filesystem and is currently 18.53GB in size.
  • Now, you should have made a backup of your vdi at this point. If you haven’t go back and do that – so many things can go wrong here and you are on your own!
  • If it is any partition other than /dev/sda1 you can right-click the partition you wish to resize and choose “Resize/Move” (as in Figure 4) – not in my case!
  • However, my problem is that the extended partition and my linux-swap are blocking me from changing the size of my /dev/sda1/. So, unfortunately I have to delete and re-create them again. So, select the linux-swap and press “Delete” and /dev/sda2 (or whatever your one is!) and press “Delete”. The press “Apply”
  • After applying the changes choose the /dev/sda1 partition and choose resize as in Figure 6, allowing enough space (“free space following” of 1023) for a new swap partition. It should say “Grow /dev/sda1 from 18.53GiB to 96.66GiB” and it may take a short while (~1 min). Hopefully you should get a “All operations successfully completed” message
  • Now, re-add your Linux Swap Space. Press on the unallocated space and right-click to “Created new Partition” -> “Create as: Extended partition”
  • Press “+Add” and right-click the new “unallocated” to Create a new partition. Choose as “Create as: Logical Partition” and underneath “File System: linux-swap”
  • Now press “+Add” and then “Apply”
  • You can now safely shut down this Live CD Virtual Machine and you are DONE