Skip to main content

Virtual Machine Learning Activity – VMs

Hands-On Lab

 

Photo of Rob Marti

Rob Marti

Linux Training Architect I in Content

Length

00:30:00

Difficulty

Intermediate

In this lab, we're going to be using the provisioned servers to practice managing Virtual Machines in a RHEL7 environment. We'll start one, and investigate the settings to discover and troubleshoot issues.

What are Hands-On Labs?

Hands-On Labs are scenario-based learning environments where learners can practice without consequences. Don't compromise a system or waste money on expensive downloads. Practice real-world skills without the real-world risk, no assembly required.

Virtual Machine Learning Activity

Introduction

In this lab, we're going to be using the provisioned servers to practice managing Virtual Machines in a RHEL7 environment.

We'll start one, and investigate the settings to discover and troubleshoot issues.

Get logged in

Use the credentials and server IP in the hands-on lab overview page to log into our lab server. Once we're in, we can get moving. We're going to need root access right off, so as soon as we're logged in, we'll run a quick sudo -i and get the privileges required.

Find the Name of the Virtual Machine on the Server

To get a list of any running virtual machines, we'll run:

[root@host]$ virsh list

At the moment, we don't have any running, so nothing will show up in that list. To see the ones that are installed (whether they're running or not), we can run:

[root@host]$ virsh list --all

We'll see one named centoz7.0 now.

Start the VM

[root@host]$ virsh start centos7.0

Note that when we see Domain centos7.0 started, the word Domain is synonymous with Virtual Machine.

Now when we run virsh list, we'll see it.

Determine the Location and Names of the Files that the VM is Storing

We can look at the configuration of an individual VM by running:

[user@host]$ virsh edit centos7.0

This essentially dumps us into a Vim session, and we're looking at an XML file containing all of the configuration for this centos7.0 VM.

Sections labled disk contain the source file (something like var/lib/libvirt/images/centos7.0.qcow2) for all the disks allocated to the VM.

If we get out of the file (it's Vim, so hit Esc, then type q!, and hit Enter) we can look at how big these disks are. In this case, we'd run ls -l /var/lib/libvirt/images.

Conclusion

This was just a tour really, but we made it through. We've got a little better idea of how to look at VM details, including where they store files. Congratulations!