How to resize a VirtualBox Ubuntu vm hard drive

HowTo : resize ubuntu vm hard drive hosted on Virtual Box

Pre-requisites

on host (host is the computer having virtualbox) :
  • VirtualBox version should be greater than 4.0.0
  • you should have enough space to clone your VM and available space (using to extend your hard drive)
  • you should have enought space to get gparted livecd (130Mo)


Step by step

original Ubuntu will be called "oU" and the clone "oUextended"

  • on oU menu halt ubuntu (or stop oU using VirtualBox)
  • on virtualbox : right clic on oU, then (context menu) clone "oU" 
    • name the clone "oUextended" (or wathever you want)
  • on host under a shell : go under oUextended directory and use this command to extend for example to 25GB the hard drive :
 c:\Users\myuser\VirtualBox VMs\UBUNTU_EXTENDED_25G>"c:\Program Files\Oracle\Virtual Box\VBoxManage.exe" modifyhd UBUNTU_EXTENDED_25G.vdi --resize 25625  
 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%  

  • on virtualbox : oUextended/configuration you should show the hard drive size : 25G (==25625MB)
  • on virtualbox : oUextended/configuration you should assert booting on CD before hard drive

  • go to http://gparted.sourceforge.net/download.php and download the last stable gparted ISO
  • on virtualbox : oUextended/configuration/storage : add a CD and select gparted iso
  • on virtualbox : start oUextended
  • on oUextended : boot menu : select the first and default choice : "GParted Live"
  • on oUextended : anwer gparted question (depending of your preferences) : eg. keyboard azerty / fr / PC Keyboard / 08 French / (0)
  • on oUextended : select the parent ("extended") of the partition you would like to extend : right clic on it / resize / extend to the full free size

  • on oUextended : the parent ("extended") of the partition should have 24Gio size
  • on oUextended : select the partition you would like to extend : right clic on it / resize / extend to the full free size

  • on oUextended : the partition should have 24Gio size
  • on oUextended : clic on "Apply" / wait the operations to finish / clic "Close"
  • on oUextended : clic on "Exit" on the gparted desktop; then select "shutdown" / enter
  • on virtualbox : oUextended/configuration/storage : remove gparted iso CD (should be an empty CD)
  • on virtualbox : start oUextended
Assert the result on ubuntu xterm :
df -kh

Resources


Aucun commentaire:

Enregistrer un commentaire