Virtual Box commands: Difference between revisions

From Newroco Tech Docs
Jump to navigationJump to search
(Created page with "== Virtual Box commands == '''List commands''' <pre> vboxmanage list vms vboxmanage list ostypes vboxmanage list runningvms vboxmanage list hostdvds vboxmanage list hostinfo...")
 
Line 22: Line 22:
'''Creade a new image .vdi of 4000 MB'''
'''Creade a new image .vdi of 4000 MB'''
<pre>
<pre>
VBoxManage createvdi -filename new_image.vdi -size 4000 -register
VBoxManage createvdi -filename new_image.vdi -size 4000
</pre>


'''Start VM in headless mode'''
'''Start VM in headless mode'''

Revision as of 14:02, 30 August 2017

Virtual Box commands

List commands

vboxmanage list vms
vboxmanage list ostypes
vboxmanage list runningvms
vboxmanage list hostdvds
vboxmanage list hostinfo
vboxmanage list hddbackends
vboxmanage list systemproperties
vboxmanage list dhcpservers
vboxmanage list hdds
vboxmanage list dvds

Create new VM

VBoxManage createvm -name name_new_vm -register

Creade a new image .vdi of 4000 MB

VBoxManage createvdi -filename new_image.vdi -size 4000

'''Start VM in headless mode'''
<pre>
VBoxManage startvm vm_name --type headless

Power off VM

VBoxManage controlvm vm_name poweroff


Create raw partition

qemu-img create -f raw -o size=1.2T image_name.raw

Convert from .raw to .vdi

VBoxManage convertfromraw image_name.raw image_name.vdi

Attach a disk to virtualbox

  • To check the right configuration use
 VBoxManage showvminfo vm_name 
  • use depending on the situation SATA, SATAController, SATA Controller
  • change the port if you have multiple disk on the VM
VBoxManage storageattach Moodle --storagectl "SATA" --port 3 --device 0 --type hdd --medium vm_image.vdi 

Remove disk from VM

sudo VBoxManage storageattach Moodle --storagectl "SATA" --port 3 --device 0 --type hdd --medium emptydrive

Delete a disk

vboxmanage closemedium disk disk_name --delete