VirtualBox

From Colettapedia
Revision as of 14:16, 30 January 2014 by Colettace (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
  • VIRTUAL MACHINES BABY

Benefits

  • freeze, wake, copied, backed up, transported btw hosts
  • "Snapshots" - save state of virtual machine, and revert back to that state later
  • Reduce hardware costs. Can even deploys workstations on thin clients that access virtual server through RDP
  • Deploy "appliances" with entire software configurations, like mail server or BOINC

Terminology

  • host OS - os of physical computer
  • guest OS - os running inside virtual machine
  • VM - special environment VirtualBox creates for OS. run OS "in" a VM. Dictate hardware settings, how much memory, hard disks available, what CDs that are mounted; state information, running frozen, snapshot
  • Guest additions - optimizations designed to be installed within the VM specific to particulat guest OS, like making the mouse work seamlessly and the keyboard control

Set Up Virtual Machine

  1. Click new. Virtual Machine Set up wizard
  2. Specify name and type of OS
  3. Specify amount of RAM - 512MB is good
  4. Specify a virtual hard disk. Standard is to use a large image file on your real hard disk
  5. Create a new image file to be used as the virtual hard disk, either a dynamically expanding hard drive, or a fixed size (faster) hard drive. Will need to be several gigabytes for most modern systems

Run Virtual Machine

  • First time run, will act like a comp with not OS on it.
  • "First Start Wizard" shows up helping you install OS
  • To give control of mouse and keyboard to guest OS, click inside window
  • To revoke control, press left Command key, referred to as "host key"
  • Operations like Ctrl-Alt-Delete can be run in the "Machine" menu of VM window
  • Close (Command Q) gives three options
  1. Save machine state - freeze VM, completely sae state to local disk. Can resume VM from the VM start window.
  2. Shutdown - perform a proper OS shutdown
  3. power off - Pull the plug immediately!
  • Take a snapshot, from "Machine" window

Import Virtual Appliance Package

  • widely used vmdk format, with an .ovf extension
  • Choose File -> Import appliance. Select .ovf file

Using VirtualBox via command line

Expanding HD size

  • The --resize x option (where x is the desired new total space in megabytes) allows you to change the capacity of an existing image; this adjusts the logical size of a virtual disk without affecting the physical size much.[38] This currently works only for VDI and VHD formats, and only for the dynamically allocated variants, and can only be used to expand (not shrink) the capacity. For example, if you originally created a 10G disk which is now full, you can use the --resize 15360 command to change the capacity to 15G (15,360MB) without having to create a new image and copy all data from within a virtual machine. Note however that this only changes the drive capacity; you will typically next need to use a partition management tool inside the guest to adjust the main partition to fill the drive.
  • VBoxManage modifyhd /path/to/the_hard_drive.vdi --resize 32768 - resize the HD to 32 GB