Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
vbox:resize-vdi [2015/10/18 04:24]
admin
vbox:resize-vdi [2015/11/12 16:42] (current)
admin [Mount a VDI to the host system]
Line 1: Line 1:
-====== ​Resizing a VDI ======+====== ​Managing VDIs ======
 ---- ----
 +
 +==== Resize (grow) a VDI ====
  
 The most straight forward way to enlarge an existing VDI is described in [[http://​www.webdesignblog.asia/​software/​linux-software/​resize-virtualbox-disk-image-manipulate-vdi/#​sthash.BjcUtHc7.dpbs|this article]], we can summarize it as follow (on a Linux based guest): The most straight forward way to enlarge an existing VDI is described in [[http://​www.webdesignblog.asia/​software/​linux-software/​resize-virtualbox-disk-image-manipulate-vdi/#​sthash.BjcUtHc7.dpbs|this article]], we can summarize it as follow (on a Linux based guest):
Line 8: Line 10:
 > VBoxManage modifyhd <​HARD_DISK>​.vdi --resize <​SIZE_IN_MB>​ > VBoxManage modifyhd <​HARD_DISK>​.vdi --resize <​SIZE_IN_MB>​
 </​code>​ </​code>​
 +
 +=== Using a GUI ===
  
 Then launch the VM, you'll need **gparted**,​ a graphical tool to manage disk partitions, to then enlarge the file system and use the newly available space on the VDI. In case it is not yet available on your VM, go to:\\ Then launch the VM, you'll need **gparted**,​ a graphical tool to manage disk partitions, to then enlarge the file system and use the newly available space on the VDI. In case it is not yet available on your VM, go to:\\
 **Menu > Software Manager Search: gparted > Install** **Menu > Software Manager Search: gparted > Install**
  
-Right click on the /dev/sda2 (adapt to your configuration),​ and select //​**Resize/​Move**//,​ drag the right limit of the partition to use all additional space available.+Right click on the /dev/sda2 (adapt to your configuration),​ and select //​**Resize/​Move**//,​ drag the right limit of the partition to use all additional space available. ​Then apply the changes. 
 + 
 +=== From the CLI === 
 + 
 +<color darkorange>​To be completed....</​color>​ 
 + 
 + 
 +==== Mount a VDI to the host system ==== 
 + 
 + 
 +With the VM **stopped**:​ 
 +<​code>​ 
 +> apt-get install qemu-utils kpartx 
 +> modprobe nbd 
 +> qemu-nbd -c /dev/nbd0 /​path/​to/​file.vdi 
 +> kpartx -a /dev/nbd0 
 +> mount /​dev/​mapper/​nbd0p1 /mnt 
 +</​code>​ 
 + 
 +Now we can access files on the vdi: 
 +<​code>​ 
 +> nano /​mnt/​etc/​network/​interfaces 
 + 
 +ADD: 
 +# Static private LAN interface 
 +auto eth1 
 +iface eth1 inet static 
 +   ​address 172.30.30.XXX 
 +   ​netmask 255.255.255.0 
 +   ​broadcast 172.30.30.255 
 +   ​network 172.30.30.0 
 +</​code>​ 
 + 
 +To **UNMOUNT** the vdi: 
 +<​code>​ 
 +> umount /mnt 
 +> qemu-nbd -d /dev/nbd0 
 +</​code>​