Choosing disk size in VirtualBox

When creating a new virtual machine in VirtualBox, always go for a large size dynamically allocated disk.

Don’t use the defaults, as it is a dynamically expanded storage, it will use only the space it needs. If you set the limit too low, you risk running into storage capacity shortage soon enough and will have to waste your time thinking about expanding or adding disks.

Use something safe, like 100GB or 200GB – it will not use that much anyway unless actually needed.

Advertisements

Resize hard disk in VirtualBox

You may run out of space at your virtual hard drive of your virtual computer running inside Oracle VirtualBox.

You may easily expand the disk with one command. This example shows expanding a (dynamically allocated) disk to 20GB in size:

  • VBoxManage modifyhd "/home/john/VirtualBox VMs/bunsenlabs/bunsenlabs.vdi" --resize 20480

Please note, that you may have to supply the full path to your virtual disk file.

You can read more about it at Oracle’s site.

Also, you must afterwards extend the file system to use all the space that became available. Use a disk magament tool, typically gparted, to do it.

Please be aware, that the extra space on the virtual disk may not show up if you are using snapshots. In such a case you can clone the original virtual machine, merging all the changes  (“Full clone”), into a new one. Then, while it is switched off, run the modifyhd command on its .vdi file.

Please be aware that the purpose of the disk and the way of partitions are organized may prevent you from effectively resizing a particular partition. Consider creating a new partition in the new space and mount it at the necessary place in your file system (for example, mount the whole new partition as /home/john).

If there is an existing swap partition getting in the way, you can delete it and recreate at the end of the available space.


Run a process in VirtualBox from outside

You can launch a program within an Oracle VirtualBox virtual machine from the host system’s command prompt.

Example 1:  Run notepad in MS Windows 7 virtual machine named “7” as user “user” with password “1” from Ubuntu:

  • VBoxManage guestcontrol "7" run --exe "C:\\Windows\\notepad.exe" --username user --password 1

Example 2: Output guest network info:

  • VBoxManage --nologo guestcontrol "7" run --exe "c:\\windows\\system32\\ipconfig.exe" --username user --password 1 --wait-stdout

Notes:

  • You must have Guest Additions installed
  • The user account must have a password

Video capture VirtualBox from command line

Start and then stop VirtualBox screen recording from command line for a headless Windows 10 session running in virtual machine named Win10:

  • VBoxManage controlvm Win10 videocap on
  • VBoxManage controlvm Win10 videocap off

Windows 10 icon PNG

A 48×48 pixel PNG icon for use with Linux desktops.

Can be used to start a virtual machine with MS Windows 10 inside.

Windows 10 icon, PNG, 48x48 pixels

Windows 10 icon, PNG, 48×48 pixels


VirtualBox: Could not claim parallel port

You try to run Oracle VirtualBox with a direct access to the parallel port at your Linux box, but it fails with the following error message:

Error: failed to start machine. Error message: Parallel#0 could not claim parallel port ‘/dev/parport0’Be sure that no other process or driver accesses this port (VERR_DEV_IO_ERROR).
Parallel device 0 cannot attach to host driver (VERR_DEV_IO_ERROR)

The main point: you have to unload the Linux kernel module lp, which is blocking access to the port, like this:

  • rmmod lp

 

P.S.

You might also either add your user to groups having file access permissions for the device or modifying the permissions to give access to more users.


Creating Oracle VirtualBox virtual machine from command line

This is how you create, on a server without a GUI, a  virtual machine with 128 MB RAM and 5 GB HDD, with a virtual network adapter (enabling you to connect to it by a Remote Desktop client), and with a Microsoft Windows installation disk image in the virtual DVD drive: Read the rest of this entry »