Christopher Juckins

SysAdmin Tips, Tricks and other Software Tools

User Tools

Site Tools


virtualbox_general_notes

VirtualBox General Notes

If new kernel on host machine Rocky Linux 9 causes failure to start VirtualBox VMs, ensure the following kernel RPMs are installed:

kernel
kernel-core
kernel-devel
kernel-devel-matched
kernel-headers
kernel-modules
kernel-modules-core
kernel-modules-extra

Check version of installed Guest Additions:

modinfo vboxguest

Running VirtualBox as a service on Windows: http://techgenix.com/start-virtualbox-service/

C:\Program Files\Oracle\VirtualBox>VBoxManage.exe clonehd --format VDI "C:\Users\Chris\VirtualBox VMs\centos7-vtatdb2-w\CENTOS7-vtatdb2-disk001.vmdk" "C:\Users\Chris\VirtualBox VMs\centos7-vtatdb2-w\CENTOS7-vtatdb2-disk001.vdi"

How to convert VMDK to VDI

See notes at https://www.bonusbits.com/wiki/HowTo:Convert_VMDK_to_VDI

How to resize a Virtual Drive

  • The following was tested with VBox 5.1.26
  • Shutdown the VM you want to resize
  • Navigate to the .vdi file you want to resize
  • Make a backup copy of the .vdi file
  • Run a command like this (example for 30GB drive)
# VBoxManage modifyhd /path/to/file.vdi --resize 30000

Note, if you have a vmdk file you need to follow this (see this link) and then update the UUID following this link or navigating to $HOME/.VirtualBox/VirtualBox.xml and updating the information there (make a backup first):

# VBoxManage clonehd "source.vmdk" "cloned.vdi" --format vdi
# VBoxManage modifyhd "cloned.vdi" --resize 51200
# mv source.vmdksource.vmdk.BAK 
# VBoxManage clonehd "cloned.vdi" "source.vmdk" --format vmdk
  • Start VirtualBox manager
  • Highlight the VM whose disk you are resizing
  • Click Settings and then click storage
  • Mount a virtual CDROM (gparted-live ISO that you downloaded to the host machine)
  • Start the VM
  • Start Gparted LIVE
  • Follow the menus to resize the partition that you need to make larger
    • Select the partition you want to edit/resize and manipulate accordingly
  • When done, exit Gparted and unmount the CDROM
  • Boot the VM and verify your changes were implemented

Possible mouse unresponsiveness issue in 5.1.18 https://forums.virtualbox.org/viewtopic.php?f=3&t=79034

Running in Headless Mode

# List virtual machines
VBoxManage list vms
"MyVM" {e4b0c92c-4301-4a7d-8af8-fe02fed00451}

# Start VM in headless mode
VBoxManage startvm MyVM –type headless

# Power off VM
VBoxManage controlvm MyVM poweroff

Run VirtualBox Headless at Startup in Windows 10

February 2015

Updated October 2016 for wodim issues

Installing Guest Additions in run-level 3 on CentOS6, CentOS7, CentOS8 Stream:

  • First, go to the VirtualBox window that is running the guest machine and choose Devices > Insert Guest Additions CD Image
  • From a separate terminal window (via ssh) or in the VM window itself, su - root
  • yum install cdrecord
  • wodim –devices
    • (note the drive designation)
      • If that command fails on a CENTOS7 v7.2.1511 VirtualBox instance, try: wodim dev=/dev/sr0 –devices
      • If that succeeds, it should say something like 'VBOX' 'CD-ROM'
      • Or: wodim -prcap (although that doesn't seem to give you the info needed)
  • mkdir /media/cdrom
  • mount -t iso9660 /dev/scd0 /media/cdrom
    • if you used "sr0" above, substitute sr0 for scd0 in the line above
  • cd /media/cdrom
  • Then run Linux version of script
    • Ex: sh VBoxLinuxAdditions.run
  • When done, cd / and eject and reboot

Updated 18 March 2019

virtualbox_general_notes.txt · Last modified: 2024/08/27 14:19 by juckins