Posted By

mprabhuram on 07/23/13


Tagged

VirtualBox shell-utility


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

Priestd09


Convert VMWARE vmdk file to VIRTUALBOX vdi file


 / Published in: Bash
 

Companies provide a virtual image to test drive their software. Often the virtual machine is in vmware format. Use this to convert vmware vmdk file to virtualbox vdi file. Create a new virtualbox machine using this vdi. You are ready to go testing the virtual machine on virtualbox

  1. vboxmanage clonehd -format vdi "Virtual Disk.vmdk" vbox2.vdi
  2.  
  3. # Create & register a new virtual machine in virtualbox
  4. vboxmanage createvm --name phd07 --register
  5.  
  6. # Set Parameters for newly created VM
  7. vboxmanage modifyvm phd07 --ostype RedHat_64 --memory 8192 --cpus 6 --nic1 nat
  8.  
  9. # Storage Controller
  10. vboxmanage storagectl phd07 --name "SATA1" --add sata --controller IntelAhci
  11.  
  12. # Attach a existing disk
  13. vboxmanage storageattach phd07 --storagectl "SATA1" --port 0 --device 0 --type hdd --medium "/vhdd/vbox2.vdi"
  14.  
  15. # Set up port forwarding
  16. vboxmanage modifyvm phd07 --natpf1 "guestssh,tcp,,2222,,22"
  17. vboxmanage modifyvm phd07 --natpf1 "psql,tcp,,5432,,5432"
  18. vboxmanage modifyvm phd07 --natpf1 "phdcc,tcp,,5000,,5000"
  19.  
  20. # If you need RDP support
  21. vboxmanage modifyvm phd07 --vrde on --vrdemulticon on --vrdeport 3389 --vrdeauthtype external
  22. VBoxManage setextradata phd07 "VBoxAuthSimple/users/gpadmin" 0fb25430a453886e1ae6974205cb89a7abfe6d7b4e308f5346f407977f83a513
  23.  
  24. # Kick off the VM in headless mode
  25. vboxmanage startvm phd07 --type headless
  26.  
  27.  
  28. # APPENDIX
  29.  
  30. # Shutdown & Delete the VM - p.s. this deletes config files and the attached disk
  31. vboxmanage controlvm phd07 poweroff
  32. vboxmanage unregistervm phd07 --delete
  33.  
  34. # Monitor VMs
  35. vboxmanage list runningvms
  36. vboxmanage showvminfo phd07
  37.  
  38.  
  39. #download virtualbox extension pack for enabling vrde
  40. http://download.virtualbox.org/virtualbox/4.2.16/Oracle_VM_VirtualBox_Extension_Pack-4.2.16-86992.vbox-extpack
  41.  
  42. # Enable VRDE simpleauth (the username and password stored in the local config file itself)
  43. VBoxManage setproperty vrdeauthlibrary "VBoxAuthSimple"
  44. VBoxManage internalcommands passwordhash "gpadmin"
  45. vboxmanage clonehd -format vdi "Virtual Disk.vmdk" vbox2.vdi
  46.  
  47. Reference : http://stdioe.blogspot.com/2012/01/creating-virtual-machine-with.html

Report this snippet  

You need to login to post a comment.