How to change the properties of VirtualBox virtual machines

Martin Brinkmann
Jan 2, 2018
Updated • Jan 11, 2018
Misc, Tutorials
|
16

It is quite easy to set up virtual machines using VirtualBox and other virtualization programs. You configure a few parameters such as disk size or memory, select an ISO image of an operating system, and wait for the program to create the virtual machine and install the operating system on it.

Virtual machines are useful for many different tasks. You can use them to test updates or new software programs, to browse the Internet, and to chain VPN connections.

VirtualBox users may change some properties of a virtual machine using the graphic user interface and others only from the command line. This guide looks at both options.

Here is a list of situations where you may need to change the properties:

  • The disk size of the virtual machine image is not large enough or is too large.
  • You want to enable or disable clipboard sharing or drag and drop.
  • You want to increase or decrease the memory of the virtual machine.
  • You need to increase or decrease video memory.

VirtualBox Settings

virtualbox settings

You open the Settings of any virtual machine image in Virtualbox by right-clicking on it and selecting settings from the context menu.

  • General > Advanced: Shared Clipboard and Drag and Drop.
  • System > Motherboard: Change base memory and boot order.
  • System > Processor: Change number of processors.
  • Display > Screen: Change video memory, monitor count, and scale factor. Enable 2D and 3D acceleration.
  • Display > Remote Display: enable server mode.
  • Storage: Add or remove storage attachments.
  • Audio: Enable or disable audio, and configure it.
  • Network > Adapter: add network adapters.
  • Serial Ports: Add serial ports.
  • USB: Change the USB controller and add device filters.
  • Shared Folders: Manage shared folders.

And a lot more. You may have noticed already that you cannot change some virtual machine properties using the GUI. It is for instance not possible to change the size of the virtual hard drive; that's reserved to the command line.

VirtualBox command line

resize virtual machine virtualbox

VirtualBox supports many different command line options to change the properties of a virtual machine image.

These commands use VBoxManage modifyvm ImagePath as the base command followed by the actual command.

The following instructions are for Windows. Linux and Mac users should not have issues figuring this out for their devices though.

VBoxManage.exe is a file in the root directory of the VirtualBox installation on Windows. You find it under C:\Program Files\Oracle\VirtualBox by default.

Start by opening a new command prompt window and navigating to the VirtualBox folder.

Tip: if you use the command regularly, consider adding it as a system path so that you can run the commands from anywhere.

  1. Make sure the virtual machine that you want to modify is shut down.
  2. Tap on the Windows-key, type cmd.exe, and hit the Enter-key to start a command prompt window.
  3. Type cd C:\Program Files\Oracle\VirtualBox to switch to the VirtualBox root directory.

Here is a short list of important commands:

Resize virtual machine (VDI and VHD)

  • Command: VBoxManage modifyhd "PathTOVDIImage" −−resize <megabytes>
  • Example: VBoxManage modifyhd "C:\Users\Martin\VirtualBox VMs\windows 7\windows 7.vdi" −−resize 40000
  • Explanation: This changes the size of the virtual hard drive to 40000 MB

Move virtual machine image

  • Command: VBoxManage modifymedium "PathTOVDIImage" −−move <Path>
  • Example: VBoxManage modifymedium "C:\Users\Martin\VirtualBox VMs\windows 7\windows 7.vdi" −−move "C:\virtual"
  • Explanation: This moves the virtual machine image to the new location.

Cap Virtual CPUs

  • Command: VBoxManage modifyvm "PathTOVDIImage" −−cpuexecutioncap <1-100>
  • Example: VBoxManage modifyvm "C:\Users\Martin\VirtualBox VMs\windows 7\windows 7.vdi" −−cpuexecutioncap 50
  • Explanation: Caps the CPU use to 50%.

Change memory allocation

  • Command: VBoxManage modifyvm "PathTOVDIImage" −−memory <memorysize>
  • Example: VBoxManage modifyvm "C:\Users\Martin\VirtualBox VMs\windows 7\windows 7.vdi" −−memory 2048
  • Explanation: Sets the memory to 2048 MB.
Summary
How to change the properties of VirtualBox virtual machines
Article Name
How to change the properties of VirtualBox virtual machines
Description
VirtualBox users may change some properties of a virtual machine using the graphic user interface and others only from the command line. This guide looks at both options.
Author
Publisher
Ghacks Technology News
Logo
Advertisement

Previous Post: «
Next Post: «

Comments

  1. Ryunosuke said on January 16, 2020 at 1:16 am
    Reply

    Hi

    I am wondering if you might be able to help me with something.

    I am running an AMD Ryzen 7 3700x with 16Gb of GSkill 3200GHz ram and a GTX 2070 with 8Gb of ram.

    In Virtual Box (running on an SSD) I set my VM to use 8GB of ram and 128Mb of vram

    In my guest OS it reports that it sees 7.xGb of 1600GHz ram and 7Mb of vram

    Why is VB reporting my ram so incredibly wrong and how can I fix it? With the current settings (3D acceleration both en/disabled) my VM gets so slow at times that I must move my mouse in 2mm increments then wait 5 to 6 seconds to see where the cursor is… OrI type my 4 digit password then sit back and wait while the digits appear in the text field one at a time and eventually get to the return button that was pressed a good 10 to 20 seconds before

    Allocating 1 core prevents the guest from even starting, 2 cores gives me incredibly sluggish performance (as mentioned above) and giving it more than 2 cores makes it super unstable and causes the above to happen more often

    I don’t see any options for specifying RAM speed so… what can I do about that very inaccurate ram speeds?

  2. Gerard Egan said on October 15, 2019 at 9:16 pm
    Reply

    I have just installed VirtualBox 0n my win 10 machine with the object of running an Amateur Radio programme called XPware. this programme will only work in XP. The programme controls a Modem (terminal node controller) for transmitting radio data. The TNC works on com6 in win10, however I need to know how to tell the XPWare software operating under Win XP in VirtualBox where com6 is. I have read that you can put the path in the settings of VirtualBox. But I can’t find the path. If anyone could put me in the right direction I would be most grateful

    Gerard Egan

  3. Shannana said on May 25, 2018 at 4:13 pm
    Reply

    I’ve always used VMware with success, but after reading this article I gave VirtualBox another try.

    So, I tried to install Zorin OS Lite on Windows 10 under VirtualBox. During the install the VirtualBox window was not full screen nor could I change that. Yet I could still see everything as Zorin was installing, that is until it got to this one step where the window was off the VM screen and thus hidden, so I could not access the continue button. I tried the VirtualBox settings and tried various keyboard commands, but i could not get past that screen. Fail.

    I then used VMware and it installed fine.

    1. A different Martin said on May 25, 2018 at 11:09 pm
      Reply

      I’ve had trouble getting a *lot* of Linux guests to work right in VirtualBox on a Windows 7 host — possibly even a slight majority of the ones I tried — but I don’t *think* I had problems with Zorin OS (not Lite). I just didn’t like it as much as Linux Mint Cinnamon. Often (usually?), you have to manually install VirtualBox’s Linux Guest Additions in the host to get a proper screen resolution and full-screen capability (although this doesn’t work for every distro). But if you can’t even complete the installation, I don’t see how you could do that. Is the display scaled up in your Windows 10 host? If so, maybe that’s why the Zorin install window was offscreen, and maybe it could be avoided by temporarily scaling down the host display. But to be honest, it doesn’t seem like it would be worth the effort to go through another install attempt, especially if you’re happy with VMWare. The reason I use VirtualBox instead of VMWare is because the core package is open-source and (via the extension pack) it provides more functionality than VMWare to personal, non-institutional users for free. It works with my favorite distro so far (Linux Mint Cinnamon), but *not* with all of the other distros I’ve wanted to try (notably PCLinuxOS KDE), so maybe I should give VMWare a try for those.

      1. Shannana375 said on May 29, 2018 at 10:58 pm
        Reply

        @A different Martin

        Thanks for the tips. I ended up removing VMWare and Zorin VM, so I’m going to give VirtualBox another try, as I prefer to try that still. My other option is to use Linux Mint, but I already have that on another box and wanted to give Zorin another try. But whatever, as I think I would rather have Linux Mint in VirtualBox than Zorin OS in VMWare, if those are my only choices for this box.

        As for VMWare, I’ve always been happy with them for many years now, although as you I usually prefer open-source software, and VirtualBox may provide options I may want, that are not in VMWare for free.

      2. A different Martin said on May 30, 2018 at 6:36 am
        Reply

        @Shannana375: I’m glad you replied. It made me re-read my post and prompt me to make the following correction:

        Often (usually?), you have to manually install VirtualBox’s Linux Guest Additions in the [Linux] *GUEST* to get a proper screen resolution and full-screen capability….

        (In my defense, I was just out of hospital and even less lucid than usual, which is a pretty high bar to clear. Just ask anyone here! ;-)

        Hope it works out for you!

  4. A different Martin said on January 11, 2018 at 3:06 am
    Reply

    Hi, Martin. Thanks for this. It came at the right time, as I wanted to increase the size of my Linux Mint guest and start using Timeshift to get familiar with it before ultimately going to a bare-metal install.

    Just one suggestion for improvement: when you’re entering sample command-line text (or running a spelling/formatting check on copy that includes command-line text), take care that your word processor’s autocorrect/autoformat function doesn’t inappropriately do stuff like change straight quotes into left/right curly quotes or convert two hyphens into an em dash. (Could a special style for command-line text help?) I don’t think Windows 7’s command processor stumbled over the curly double quotes in your –resize sample, but the inadvertently substituted em dash was a showstopper.

    Now I guess I have to learn how to use gparted to increase the size of a partition or two from within Linux Mint. I’m glad I have a backup copy of my virtual machine!

  5. dwarf_t0ssn said on January 2, 2018 at 11:18 pm
    Reply

    Virtualbox is pretty great. Infinitely useful for testing out linux distros or NT-lite’d Windows 7. One can even grab a pre-fab networking appliance like GNS3 and learn useful skills on a shoestring budget. Not bad for being 100% free.

  6. Belga said on January 2, 2018 at 8:27 pm
    Reply

    This is telepathy!
    I was just looking on the net way to increase the RAM of one of my virtual machines.
    For my part, I never had a problem until last version : one machine did not started properly anymore.
    I returned meanwhile to the previous version and will see what happens with the following version.
    For the rest, same as Sophie here.
    Thanks Martin & Happy New Year.

    1. STech said on January 4, 2018 at 4:30 pm
      Reply

      Hi Belga

      change ‘modifyhd’ in ‘modifyvm’ and all will work fine.

      Martin,
      the memory syntax command is OK but the example must be corrected;
      also for resizing the disk, the example is OK but the command syntax is not.

      1. Belga said on January 4, 2018 at 9:57 pm
        Reply

        Thanks STech, but even like that (and after reinstallation of the program)…

        C:\Program Files\Oracle\VirtualBox
        VBoxManage modifyvm “C:\Users\JEAN\VirtualBox VMs\windows 7\windows 7.vdi” -memory 2048
        VBoxManage.exe: error: Could not find a registered machine named ‘C:\Users\JEAN\VirtualBox VMs\windows 7\windows 7.vdi’
        VBoxManage.exe: error: Details: code VBOX_E_OBJECT_NOT_FOUND (0x80bb0001), component VirtualBoxWrap, interface IVirtualB
        ox, callee IUnknown
        VBoxManage.exe: error: Context: ”FindMachine(Bstr(a->argv[0]).raw(), machine.asOutParam())” at line 512 of file VBoxMana
        geModifyVM.cpp
        C:\Program Files\Oracle\VirtualBox

      2. Martin Brinkmann said on January 4, 2018 at 4:44 pm
        Reply

        Thanks, I totally blanked on this. Checked all commands and fixed those that needed fixing.

    2. Belga said on January 3, 2018 at 12:44 pm
      Reply

      I tried today the command for “Change memory allocation” but it does not work for me :

      C:\WIND0WS\system32> cd C:\Program Files\Oracle\VirtualBox
      C:\Program Files\Oracle\VirtualBox>VBoxManage modifyhd “C:\Users\Jean\VirtualBox VMs\Win 7\Win 7.vdi” –memory 2048
      Oracle UM VirtualBox Command Line Management Interface Version 5.2.2
      2005-2017 Oracle Corporation
      All rights reserved.
      Usage:
      VBoxManage modifymedium [disk|dvd|Floppy]
      [—type normal|writethrough|immutable|shareable|
      readonly|multiattach]
      [—autoreset on|off]
      [—property ]
      [—compact ]
      [—resize |—resizebyte ]
      [—move <path]
      [—description ]
      Syntax error: unknown option: –memory
      c:\Program Files\Oracle\VirtualBox>

  7. Sophie said on January 2, 2018 at 6:02 pm
    Reply

    I use VirtualBox and I must say that its so stable, where others have reported issues or BSODs, that I feel I would have to have a very good reason to tinker with it. I’ve Win7 on it, and the whole Virtual Disk Image is only just over 5GB, with loads of stuff on it. Memory allocation seems to be working well, and I rather leave it just as it is. Just treating it rather tenderly, and with caution due to relative inexperience I guess!

    I keep up to 8 snapshots, and periodically delete the oldest ones. Its way way ahead of any kind of Windows System Restore, and I use it for all testing. I also chain VPN on it, thanks to Martin’s earlier article some time ago. I do find my CPU heats a little (its a fanless) while in use, but only into the 60s degrees or so.

    Truly, VM was a great discovery, and very happy with it even if I’d rather now leave it. Also, I have the benefit of having Win7 installed on it with NO updates whatsoever….straight out of the original 2009 box. Being a VM, I don’t fear for its integrity, as I can just roll back. It also means that Win7 is unadulterated, untouched by Microsoft, and even though it has no patches, I’ve yet to find a single thing wrong with it since 8 months now.

    Thanks for the tips though Martin, should I ever wish to return to its’ settings.

    1. wb said on January 2, 2018 at 11:43 pm
      Reply

      i have the win7 updated, with almost nothing installed but chrome and couple other relatively small programs, and it’s about 15 GB after optimization 0_o
      not that big deal if you have just a couple installations like me, but if you need several it might add up. Windows 10 takes off a few GB (~13), tough the constant updating gets annoying fast if you have that enabled. Windows 8 could be a good middle ground. If you can still get by with XP, an updated one take about 7-8 Gb.
      Very happy with Virtualbox, was using Vmware before, but it had this constant cpu usage spikes on the host that i couldn’t get rid of.

    2. Martin Brinkmann said on January 2, 2018 at 6:27 pm
      Reply

      Sophie, you are welcome. VirtualBox runs stable on my end as well.

Leave a Reply

Check the box to consent to your data being stored in line with the guidelines set out in our privacy policy

We love comments and welcome thoughtful and civilized discussion. Rudeness and personal attacks will not be tolerated. Please stay on-topic.
Please note that your comment may not appear immediately after you post it.