Schlagwort-Archive: vboxmanage

VBoxManage 4.x – Manual


Oracle VM VirtualBox Command Line Management Interface Version 4.2.0
(C) 2005-2012 Oracle Corporation
All rights reserved.

Usage:

VBoxManage []

General Options:

[-v|--version] print version number and exit
[-q|--nologo] suppress the logo
[--settingspw ] provide the settings password
[--settingspwfile ] provide a file containing the settings password

Commands:

list [--long|-l] vms|runningvms|ostypes|hostdvds|hostfloppies|
bridgedifs|hostonlyifs|dhcpservers|hostinfo|
hostcpuids|hddbackends|hdds|dvds|floppies|
usbhost|usbfilters|systemproperties|extpacks|
groups

showvminfo | [--details]
[--machinereadable]
showvminfo | --log

registervm

unregistervm | [--delete]

createvm --name
[--groups , ...]
[--ostype ]
[--register]
[--basefolder ]
[--uuid ]

modifyvm
[--name ]
[--groups , ...]
[--ostype ]
[--memory ]
[--pagefusion on|off]
[--vram ]
[--acpi on|off]
[--pciattach 03:04.0]
[--pciattach 03:04.0@02:01.0]
[--pcidetach 03:04.0]
[--ioapic on|off]
[--pae on|off]
[--hpet on|off]
[--hwvirtex on|off]
[--hwvirtexexcl on|off]
[--nestedpaging on|off]
[--largepages on|off]
[--vtxvpid on|off]
[--synthcpu on|off]
[--cpuidset ]
[--cpuidremove ]
[--cpuidremoveall]
[--hardwareuuid ]
[--cpus ]
[--cpuhotplug on|off]
[--plugcpu ]
[--unplugcpu ]
[--cpuexecutioncap <1-100>]
[--rtcuseutc on|off]
[--monitorcount ]
[--accelerate3d on|off]
[--accelerate2dvideo on|off]
[--firmware bios|efi|efi32|efi64]
[--chipset ich9|piix3]
[--bioslogofadein on|off]
[--bioslogofadeout on|off]
[--bioslogodisplaytime ]
[--bioslogoimagepath ]
[--biosbootmenu disabled|menuonly|messageandmenu]
[--biossystemtimeoffset ]
[--biospxedebug on|off]
[--boot<1-4> none|floppy|dvd|disk|net>]
[--nic<1-N> none|null|nat|bridged|intnet|hostonly|
generic]
[--nictype<1-N> Am79C970A|Am79C973|
82540EM|82543GC|82545EM|
virtio]
[--cableconnected<1-N> on|off]
[--nictrace<1-N> on|off]
[--nictracefile<1-N> ]
[--nicproperty<1-N> name=[value]]
[--nicspeed<1-N> ]
[--nicbootprio<1-N> ]
[--nicpromisc<1-N> deny|allow-vms|allow-all]
[--nicbandwidthgroup<1-N> none|]
[--bridgeadapter<1-N> none|]
[--hostonlyadapter<1-N> none|]
[--intnet<1-N> ]
[--natnet<1-N> |default]
[--nicgenericdrv<1-N>
[--natsettings<1-N> [],[],
[],[],
[]]
[--natpf<1-N> [],tcp|udp,[],
,[],]
[--natpf<1-N> delete ]
[--nattftpprefix<1-N> ]
[--nattftpfile<1-N> ]
[--nattftpserver<1-N> ]
[--natbindip<1-N>
[--natdnspassdomain<1-N> on|off]
[--natdnsproxy<1-N> on|off]
[--natdnshostresolver<1-N> on|off]
[--nataliasmode<1-N> default|[log],[proxyonly],
[sameports]]
[--macaddress<1-N> auto|]
[--mouse ps2|usb|usbtablet
[--keyboard ps2|usb
[--uart<1-N> off| ]
[--uartmode<1-N> disconnected|
server |
client |
file |
]
[--lpt<1-N> off| ]
[--lptmode<1-N> ]
[--guestmemoryballoon ]
[--gueststatisticsinterval ]
[--audio none|null|oss|alsa|pulse]
[--audiocontroller ac97|hda|sb16]
[--clipboard disabled|hosttoguest|guesttohost|
bidirectional]
[--draganddrop disabled|hosttoguest
[--vrde on|off]
[--vrdeextpack default|
[--vrdeproperty ]
[--vrdeport ]
[--vrdeaddress ]
[--vrdeauthtype null|external|guest]
[--vrdeauthlibrary default|
[--vrdemulticon on|off]
[--vrdereusecon on|off]
[--vrdevideochannel on|off]
[--vrdevideochannelquality ]
[--usb on|off]
[--usbehci on|off]
[--snapshotfolder default|]
[--teleporter on|off]
[--teleporterport ]
[--teleporteraddress [--teleporterpassword ]
[--teleporterpasswordfile |stdin]
[--tracing-enabled on|off]
[--tracing-config ]
[--tracing-allow-vm-access on|off]
[--usbcardreader on|off]
[--autostart-enabled on|off]
[--autostart-delay ]
[--autostop-type disabled|savestate|poweroff|
acpishutdown]

clonevm |
[--snapshot |]
[--mode machine|machineandchildren|all]
[--options link|keepallmacs|keepnatmacs|
keepdisknames]
[--name ]
[--groups , ...]
[--basefolder ]
[--uuid ]
[--register]

import
[--dry-run|-n]
[--options keepallmacs|keepnatmacs]
[more options]
(run with -n to have options displayed
for a particular OVF)

export --output|-o .
[--legacy09|--ovf09|--ovf10|--ovf20]
[--manifest]
[--vsys ]
[--product ]
[--producturl ]
[--vendor ]
[--vendorurl ]
[--version ]
[--eula ]
[--eulafile ]

startvm |...
[--type gui|sdl|headless]

controlvm |
pause|resume|reset|poweroff|savestate|
acpipowerbutton|acpisleepbutton|
keyboardputscancode [ ...]|
setlinkstate<1-N> on|off |
nic<1-N> null|nat|bridged|intnet|hostonly|generic
[] |
nictrace<1-N> on|off
nictracefile<1-N>
nicproperty<1-N> name=[value]
natpf<1-N> [],tcp|udp,[],
,[],
natpf<1-N> delete
guestmemoryballoon ]
gueststatisticsinterval ]
usbattach |

|
usbdetach |

|
clipboard disabled|hosttoguest|guesttohost|
bidirectional]
draganddrop disabled|hosttoguest]
vrde on|off |
vrdeport |
vrdeproperty |
vrdevideochannelquality setvideomodehint
[[] [
[ ]]] |
screenshotpng [display] |
setcredentials
--passwordfile |
[--allowlocallogon ] |
teleport --host --port [--maxdowntime ]
[--passwordfile |
--password ]
plugcpu
unplugcpu
cpuexecutioncap <1-100>

discardstate |

adoptstate |

snapshot |
take [--description ] [--pause] |
delete | |
restore | |
restorecurrent |
edit ||--current
[--name ]
[--description ] |
list [--details|--machinereadable]
showvminfo |

closemedium disk|dvd|floppy |
[--delete]

storageattach
--storagectl
[--port ]
[--device ]
[--type dvddrive|hdd|fdd]
[--medium none|emptydrive|
||host:|iscsi]
[--mtype normal|writethrough|immutable|shareable|
readonly|multiattach]
[--comment ]
[--setuuid ]
[--setparentuuid ]
[--passthrough on|off]
[--tempeject on|off]
[--nonrotational on|off]
[--discard on|off]
[--bandwidthgroup ]
[--forceunmount]
[--server |]
[--target ]
[--tport ]
[--lun ]
[--encodedlun ]
[--username ]
[--password ]
[--initiator ]
[--intnet]

storagectl
--name
[--add ide|sata|scsi|floppy|sas]
[--controller LSILogic|LSILogicSAS|BusLogic|
IntelAHCI|PIIX3|PIIX4|ICH6|I82078]
[--sataideemulation<1-4> <1-30>]
[--sataportcount <1-30>]
[--hostiocache on|off]
[--bootable on|off]
[--remove]

bandwidthctl
add --type disk|network
--limit [k|m|g|K|M|G] |
set
--limit [k|m|g|K|M|G] |
remove |
list [--machinereadable]
(limit units: k=kilobit, m=megabit, g=gigabit,
K=kilobyte, M=megabyte, G=gigabyte)

showhdinfo |

createhd --filename
[--size |--sizebyte ]
[--diffparent |
[--format VDI|VMDK|VHD] (default: VDI)
[--variant Standard,Fixed,Split2G,Stream,ESX]

modifyhd |
[--type normal|writethrough|immutable|shareable|
readonly|multiattach]
[--autoreset on|off]
[--compact]
[--resize |--resizebyte ]

clonehd | |
[--format VDI|VMDK|VHD|RAW|]
[--variant Standard,Fixed,Split2G,Stream,ESX]
[--existing]

convertfromraw
[--format VDI|VMDK|VHD]
[--variant Standard,Fixed,Split2G,Stream,ESX]
[--uuid ]
convertfromraw stdin
[--format VDI|VMDK|VHD]
[--variant Standard,Fixed,Split2G,Stream,ESX]
[--uuid ]

getextradata global||
|enumerate

setextradata global||

[] (no value deletes key)

setproperty machinefolder default| |
vrdeauthlibrary default| |
websrvauthlibrary default|null| |
vrdeextpack null| |
autostartdbpath null| |
loghistorycount

usbfilter add
--target ||global
--name
--action ignore|hold (global filters only)
[--active yes|no] (yes)
[--vendorid ] (null)
[--productid ] (null)
[--revision ] (null)
[--manufacturer ] (null)
[--product ] (null)
[--remote yes|no] (null, VM filters only)
[--serialnumber ] (null)
[--maskedinterfaces ]

usbfilter modify
--target ||global
[--name ]
[--action ignore|hold] (global filters only)
[--active yes|no]
[--vendorid |""]
[--productid |""]
[--revision |""]
[--manufacturer |""]
[--product |""]
[--remote yes|no] (null, VM filters only)
[--serialnumber |""]
[--maskedinterfaces ]

usbfilter remove
--target ||global

sharedfolder add |
--name --hostpath
[--transient] [--readonly] [--automount]

sharedfolder remove |
--name [--transient]

guestproperty get | [--verbose]

guestproperty set | [ [--flags ]]

guestproperty enumerate |
[--patterns ]

guestproperty wait | [--timeout ] [--fail-on-timeout]

guestcontrol |
exec[ute]
--image --username
[--passwordfile | --password ]
[--domain ] [--verbose] [--timeout ]
[--environment "= [=]"]
[--wait-exit] [--wait-stdout] [--wait-stderr]
[--dos2unix] [--unix2dos]
[-- [] ... []]

copyfrom
--username
[--passwordfile | --password ]
[--domain ] [--verbose]
[--dryrun] [--follow] [--recursive]

copyto|cp
--username
[--passwordfile | --password ]
[--domain ] [--verbose]
[--dryrun] [--follow] [--recursive]

createdir[ectory]|mkdir|md
... --username
[--passwordfile | --password ]
[--domain ] [--verbose]
[--parents] [--mode ]

stat
... --username
[--passwordfile | --password ]
[--domain ] [--verbose]

updateadditions
[--source ] [--verbose]
[--wait-start]

debugvm |
dumpguestcore --filename |
info [args] |
injectnmi |
log [--release|--debug] ...|
logdest [--release|--debug] ...|
logflags [--release|--debug] ...|
osdetect |
osinfo |
getregisters [--cpu ] |all ... |
setregisters [--cpu ] = ... |
show [--human-readable|--sh-export|--sh-eval|
--cmd-set]

[[opt] what ...] |
statistics [--reset] [--pattern ]
[--descriptions]

metrics list [*|host| []]
(comma-separated)

metrics setup
[--period ] (default: 1)
[--samples ] (default: 1)
[--list]
[*|host| []]

metrics query [*|host| []]

metrics enable
[--list]
[*|host| []]

metrics disable
[--list]
[*|host| []]

metrics collect
[--period ] (default: 1)
[--samples ] (default: 1)
[--list]
[--detach]
[*|host| []]

hostonlyif ipconfig
[--dhcp |
--ip [--netmask (def: 255.255.255.0)] |
--ipv6 [--netmasklengthv6 (def: 64)]]
create |
remove

dhcpserver add|modify --netname |
--ifname
[--ip
--netmask
--lowerip
--upperip ]
[--enable | --disable]

dhcpserver remove --netname |
--ifname

extpack install [--replace] |
uninstall [--force] |
cleanup

Verkleinern von VDI Dateien mit Linux-Betriebssystem

Problem:
Ein DD kopiert klassischerweise Block für Block von einer Festplatte. Das Image ist also immer so groß, wie die Quellplatte. Auch wenn fast nichts drauf ist.

Lösung:
Die Platte muss mit Boardmitteln verkleinert werden.
Dazu boote ich via VirtualBox erstmal in das Betriebssystem.
Für jedes „richtige“ Laufwerk (nachfolgend $mountpunkt genannt), welches in der /etc/fstab genannt ist, muss folgendes durchgeführt werden.

init 1
cd $mountpunkt-der-festplatte
dd if=/dev/zero of=zero.file
rm zero.file
halt

Die Maschine ist nun wieder aus. Nun frägt man sich, was das soll! Das erklär ich gleich.

Nun nutzen wir wieder Boardmittel von Virtualbox

VBoxManage modifyhd --compact image-vom-server.dd.vdi

Das dauert nun kurz – und im Anschluss sollte das Image nur noch so groß sein, wie die tatsächliche Belegung hergibt.

Nun zum Hintergrund: Der genannte „VBoxManage“ Befehl kann nur Blöcke entfernen, die mit einer NULL beschrieben sind. Sollten die Inoden noch Restdaten beinhalten obwohl sie nicht genutzt ist, dann wird hier nichts optimiert.
Aus diesem Grund habe ich vorneweg im gebooteten System eine Datei angelegt, welche nur mit NULL gefüllt ist. „–compact“ kann nun also jeden dieser Blöcke auf dem Image nehmen. Schliesslich ist ja nichts drin 😉

Alternativ gibt es noch das Tool „zerofree„, welches das selbe erledigt. Schau kurz in Beschreibung für nähere Infos. Im Prinzip ists halt das selbe!