Child pages
  • Hyak VirtualBox
Skip to end of metadata
Go to start of metadata

Intro

VirtualBox is a virtualization application that is available on Hyak nodes and you can run on your desktop as well. Below you will find some useful information that should help you get started using VirtualBox on Hyak. This is not meant to be an exhaustive list of commands you will need to use VirtualBox on Hyak. If there's something missing you found useful, please let us know so we can add it. If you need more detail, refer to the VirtualBox end-user documentation. VirtualBox is only available on Hyak nodes.

Setup and Import

It's critical that you change the path where virtual machines are stored. By default they would be stored in your home directory which would rapidly fill up.

 VBoxManage setproperty machinefolder /gscratch/mygroup/me/virtualbox

The easiest way to move a VM to Hyak is to export it with your copy of VirtualBox on your system and then import it on Hyak.

 VBoxManage import --options keepallmacs myvm.ova

You should configure your VM to use NAT mode for networking if you configured it otherwise (NAT is the default).

 VBoxManage modifyvm myvm --nic1 nat

If it's a Linux VM and you have not yet, you may want to set up SSH forwarding. You can use this as example for other port forwarding, port 22 is the destination on the VM, port 2222 is the source on the host OS.

 VBoxManage modifyvm myvm --natpf1 "guestssh,tcp,,2222,,22"

You can configure gscratch to be available in your VM. To use shared folders within your VM, you must also have the virtual box guest additions installed in your VM and you must mount the shared filesystem using the host appropriate command inside the VM. The performance is not very good, 100MB-200MB/s, but it's on par with desktop disk performance.

 VBoxManage sharedfolder add myvm --name "gscratch" --hostpath "/gscratch"

Operation

Set the number of virtual CPUs to a number corresponding to the number of CPUs in the host or the number you plan to use.

 VBoxManage modifyvm myvm --cpus 8

Set the amount of RAM depending on how much RAM your application requires or set it to at least 4GB less than the host.

 VBoxManage modifyvm myvm --memory 20480

Enable use of the Host I/O cache for the disk controller. You can get the name of the controller from VBoxManage list -l vms.

 VBoxManage storagectl myvm --name SATA --hostiocache on

Start the VM without a graphical console. The console of your VM may be available by RDP on the node to which it is assigned. You can find the node name by running checkjob <jobid> (on mox: scontrol show job <jobid>). If your workstation supports X11 and if you've set up X11 forwarding, you can run rdesktop <node> to connect to your VM's console. You can also potentially tunnel RDP through SSH. You may wish to set up authentication for the console of your VM, more details about how to set that up can be found in the VirtualBox manual.

 VBoxHeadless -s myvm

Force use availablity of a graphical console

 VBoxHeadless -v on -s myvm

Save the state of the VM, so it can resume work later. Binaries, input files, and output files must all reside on the VM's drive. When the job completes, files can then be copied to /gscratch.

 VBoxManage controlvm myvm savestate

Depending on the OS running on your VM, this may cause it to complete a safe shutdown.

 VBoxManage controlvm myvm acpipowerbutton