Skip to content

Instantly share code, notes, and snippets.

@jhyland87
Last active May 22, 2018 21:47
Show Gist options
  • Save jhyland87/c9525d15628ab03dbca312efcde91abf to your computer and use it in GitHub Desktop.
Save jhyland87/c9525d15628ab03dbca312efcde91abf to your computer and use it in GitHub Desktop.
[VirtualBox] Miscellaneous Commands

Miscellaneous VboxManage Commands


Delete Storage Medium

1. Detach it from the storage controller

$ vboxmanage storageattach d2c7e68e-fc6d-4ae1-b601-61ab2a4b7c0b --storagectl "SATA" --port 1 --medium none

2. Delete the storage medium

$ vboxmanage closemedium disk 66acdc79-d523-4cf9-9106-9bb7401d85fa --delete
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%

Other Shit


List VMs

$ vboxmanage list vms
"xmlrpc-dev (use this)" {066da6d8-5b1e-4c27-8a32-524a89258ee2}
"Magento2-CentOS7" {f45b824f-02e9-4695-a857-27530526e59b}
"CentOS7 Basic" {8c8d29e6-fe66-416e-91cb-e915b9c4774d}
"Magento 1 (old)" {063cd0df-3be8-4d38-b2a0-f1a6636f2f53}
"Magento 1" {d70d9ca8-23b2-47c1-aa9b-913cee9f9435}
"xmlrpc-dev 01.22.18" {56b6527f-952a-4dc8-b790-c5b8d659b808}
"Plop Boot Manager (USB)" {fb8a6407-9849-4ddd-a506-bad952cb3e1e}
"Magento2 CentOS7 2" {d2c7e68e-fc6d-4ae1-b601-61ab2a4b7c0b}

Get all available properties for specified guest:

$ vboxmanage guestproperty enumerate f45b824f-02e9-4695-a857-27530526e59b
Name: /VirtualBox/GuestInfo/OS/Product, value: Linux, timestamp: 1527014178028564000, flags:
Name: /VirtualBox/GuestInfo/Net/0/V4/IP, value: 10.0.2.15, timestamp: 1527014188028018000, flags:
Name: /VirtualBox/HostInfo/GUI/LanguageID, value: en_US, timestamp: 1527014146200380000, flags:
Name: /VirtualBox/GuestInfo/Net/0/MAC, value: 0800272A6F71, timestamp: 1527014188028525000, flags:
Name: /VirtualBox/GuestInfo/OS/ServicePack, value: , timestamp: 1527014178028828000, flags:
Name: /VirtualBox/HostInfo/VBoxVerExt, value: 5.0.20, timestamp: 1527014145851136000, flags: TRANSIENT, RDONLYGUEST
Name: /VirtualBox/GuestInfo/Net/1/Status, value: Up, timestamp: 1527014188029160000, flags:
Name: /VirtualBox/GuestInfo/Net/1/V4/Broadcast, value: 192.168.56.255, timestamp: 1527014188028892000, flags:
Name: /VirtualBox/GuestInfo/Net/0/V4/Netmask, value: 255.255.255.0, timestamp: 1527014188028396000, flags:
Name: /VirtualBox/GuestInfo/Net/1/V4/Netmask, value: 255.255.255.0, timestamp: 1527014188028965000, flags:
Name: /VirtualBox/GuestInfo/Net/1/MAC, value: 08002721B56B, timestamp: 1527014188029066000, flags:
Name: /VirtualBox/GuestInfo/OS/Version, value: #1 SMP Tue Jun 20 12:24:47 UTC 2017, timestamp: 1527014178028744000, flags:
Name: /VirtualBox/GuestAdd/VersionExt, value: 5.0.20, timestamp: 1527014178029202000, flags:
Name: /VirtualBox/GuestAdd/Revision, value: 106931, timestamp: 1527014178029382000, flags:
Name: /VirtualBox/HostGuest/SysprepExec, value: , timestamp: 1527014145850602000, flags: TRANSIENT, RDONLYGUEST
Name: /VirtualBox/GuestInfo/OS/LoggedInUsers, value: 1, timestamp: 1527014202208275000, flags: TRANSIENT, TRANSRESET
Name: /VirtualBox/GuestInfo/Net/0/Status, value: Up, timestamp: 1527014188028607000, flags:
Name: /VirtualBox/GuestInfo/Net/0/Name, value: enp0s3, timestamp: 1527014188028688000, flags:
Name: /VirtualBox/HostGuest/SysprepArgs, value: , timestamp: 1527014145850657000, flags: TRANSIENT, RDONLYGUEST
Name: /VirtualBox/GuestAdd/Version, value: 5.0.20, timestamp: 1527014178028957000, flags:
Name: /VirtualBox/HostInfo/VBoxRev, value: 106931, timestamp: 1527014145851161000, flags: TRANSIENT, RDONLYGUEST
Name: /VirtualBox/GuestInfo/Net/0/V4/Broadcast, value: 10.0.2.255, timestamp: 1527014188028259000, flags:
Name: /VirtualBox/HostInfo/VBoxVer, value: 5.0.20, timestamp: 1527014145851110000, flags: TRANSIENT, RDONLYGUEST
Name: /VirtualBox/GuestInfo/OS/LoggedInUsersList, value: root, timestamp: 1527014202207317000, flags: TRANSIENT, TRANSRESET
Name: /VirtualBox/GuestInfo/Net/1/V4/IP, value: 192.168.56.101, timestamp: 1527014188028799000, flags:
Name: /VirtualBox/GuestInfo/Net/1/Name, value: enp0s8, timestamp: 1527014188029271000, flags:
Name: /VirtualBox/GuestInfo/Net/Count, value: 2, timestamp: 1527016962406262000, flags:
Name: /VirtualBox/GuestInfo/OS/Release, value: 3.10.0-514.21.2.el7.x86_64, timestamp: 1527014178028675000, flags:
Name: /VirtualBox/GuestInfo/OS/NoLoggedInUsers, value: false, timestamp: 1527014202209182000, flags: TRANSIENT, TRANSRESET

Get a specific property from a specified guest:

$ vboxmanage guestproperty get f45b824f-02e9-4695-a857-27530526e59b "/VirtualBox/GuestInfo/Net/0/V4/IP"
Value: 10.0.2.15

Get VM Logs

The logs for the virtual machines can be retrieved by passing the --log n argument to the showvminfo command. The n value corresponds to the log file stored in the Log folder for that VM.

Example:

$ wc -l ~/VirtualBox\ VMs/Magento2-CentOS7/Logs/VBox.log
    1129 /Users/jhyland/VirtualBox VMs/Magento2-CentOS7/Logs/VBox.log
$ vboxmanage showvminfo f45b824f-02e9-4695-a857-27530526e59b --log 0 | wc -l
    1129
$ wc -l ~/VirtualBox\ VMs/Magento2-CentOS7/Logs/VBox.log.2
    1629 /Users/jhyland/VirtualBox VMs/Magento2-CentOS7/Logs/VBox.log.2
$ vboxmanage showvminfo f45b824f-02e9-4695-a857-27530526e59b --log 2 | wc -l
    1629

Resources

  • VBoxManage - Online documentation for VBoxManage command
    • VBoxManage list - The list command gives relevant information about your system and information about VirtualBox's current settings.
    • VBoxManage guestproperty - The "guestproperty" commands allow you to get or set properties of a running virtual machine.
    • VBoxManage closemedium - This commands removes a hard disk, DVD or floppy image from a VirtualBox media registry.
    • VBoxManage storageattach -This command attaches/modifies/removes a storage medium connected to a storage controller that was previously added with the storagectl command (see the previous section).
    • VBoxManage showvminfo - The showvminfo command shows information about a particular virtual machine.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment