Building a Virtual Machine

With Oracle VirtualBox 6.1

Chris Crawford
netdef
5 min readApr 20, 2020

--

In I Want to Learn How to Build a Computer From Scratch, but I Have No Money. Now What?, I talked about virtual machine software and installed Oracle VirtualBox. This time, we’re going to use Oracle VirtualBox to build a very simple virtual machine.

But before we go ahead and build a virtual computer, let’s review a few very simple but important concepts about computers.

Computers are machines designed to do something with data. Every computer is made up of hardware components, and each individual hardware component in the computer handles data in a particular way. There are four main jobs for a piece of hardware in a computer, and all of them concern data:

  1. Input
  2. Storage
  3. Processing
  4. Output

Your smart phone is a computer. Your Alexa is a computer. Your DVR & smart TV are computers. And yes, obviously your laptop or desktop is a computer. Every one of them is made up of a collection of hardware that does those one of those four things.

We’ll come back to these ideas in later blog posts. But that’s enough theory for now. Let’s do something!

Open up VirtualBox and click the New button.

You’ll see a window that looks like this:

Give your new machine a name. I chose netdef for mine.

Machine Folder tells VirtualBox where you want to store your new virtual machine. It’s OK to accept the default, just be aware of where VirtualBox plans on putting your new machine. I chose to not use the defaults and am storing my virtual machine in /home/chris . When all is said and done, I’ll expect to find a new folder named /home/chris/netdef , which is where I’ll find my new virtual machine.

Because we plan to install a linux operating system on this machine in a future blog post, choose Linux for Type and Linux 2.6 / 3.x / 4.x (32-bit) for Version.

When all looks good, click the Next button and you’ll see this:

This screen lets us tell VirtualBox how much memory (aka RAM) our virtual machine should have. How much you can give away to your virtual machine will depend on how much RAM you have in the computer your using to actually run VirtualBox.

In my case, I have plenty of RAM to spare — 16GB — and so I’ll give the VM 4GB. I recommend setting aside at least 4GB of RAM for this exercise, if you can swing it.

If all looks good, click Next, and you should see:

This is where we tell VirtualBox about what kind of virtual hard drive our virtual machine should have. We want to create a new one, so just go ahead and click Create. (By the way, we’re going to ignore the recommended size of the hard disk. More on that in a minute.)

You should see this:

This is where VirtualBox lets us choose the type of virtual disk we want to create. Just like how GIF , PNG, and JPG are all picture files, VDI, VHD, and VMDK are all types of virtual disk files. We’re going to choose VMDK and click Next.

Here, we’ll choose to create a Dynamically allocated virtual disk. This will make our virtual hard drive appear to be large, from inside of our virtual machine, but from the point of view of the computer actually running VirtualBox, the virtual hard drive will only be as large as it needs to be. This will make a little more sense when we get to the next screen.

We’re also going to choose to Split into files of less than 2GB. This is a wonderful feature that I’ve grown to appreciate more and more over the years, and it is only an option with VMDK disks. This is the reason why we chose to create a VMDK disk over our other choices. In my experience, splitting up our virtual hard disk file into multiple files makes copying the virtual machine to another drive or sending it across a network a little bit more reliable and manageable.

When we click Next, we see:

This is where choosing to create a dynamically allocated virtual disk, on the previous screen, comes into play. We’re going to create an 80 GB hard drive. However, because this virtual disk is dynamically allocated, it will not take up 80 GB on the computer running VirtualBox until the virtual disk is 100% full. Before that happens, the disk will only grow to be as big as it needs to be. But, our virtual machine will still think the virtual disk is actually 80 GB big.

Click Create, and…

Tada! You’ve built a virtual machine!

Let’s fire it up and see what it can do:

Exactly as if we had bought a bunch of physical hardware, wired it together, and turned it on for the first time, our computer doesn’t really do anything. But fear not. Over the next couple of posts, we’ll take a closer look at what’s actually inside this virtual machine, and we’ll start making it do useful things.

So, until next time, stay tuned!

--

--