What are the basics of virtual machine?

A virtual machine (VM) is a compute resource that uses software instead of a physical computer to run programs and deploy apps. VMs run their own operating systems and functions separately from the underlying physical machine.

What are the basics of virtual machine?

Benefits of Virtual Machines

Virtual machines offer a number of benefits:

Flexibility

  • VMs can run multiple operating systems and multiple applications on the same server at the same time. For example, a Windows and Linux VM can run side-by-side.
  • It’s easy to customize VMs to meet specific needs for RAM, CPU cores, storage etc. Resources can be scaled up or down quickly.

Cost Savings

  • Servers can be consolidated using VMs, instead of dedicating a single app to each physical server. This saves money on hardware, electricity, cooling and data center space.
  • Backup and recovery is cheaper since VMs are just files that can be backed up or replicated.

Productivity

  • Speeds up development and testing since programmers can deploy mock systems and various OS configurations quickly.
  • Teams can work in isolated environments, allowing increased productivity.

Portability

  • VMs can move between different physical servers with no compatibility issues using features like vMotion.
  • Entire VM environments can move between on-prem data centers and cloud providers.

Components of a Virtual Machine

There are a few key components that make up VMs:

Hypervisors

The hypervisor creates and runs virtual machines:

  • Type 1 – Runs directly on server hardware. High performance, secured. Eg – VMware vSphere, Microsoft Hyper-V, Citrix XenServer.
  • Type 2 – Runs as an application within an OS. Easy to deploy. Eg – Oracle VirtualBox, VMware Workstation.

VM Disk File

  • Contains VM boot media, OS, apps, data. Serves as virtual hard disk.
  • Stored as .vmdk, .vhd, .vdi files depending on hypervisor.

Virtual Hardware

  • Includes CPU, memory, network adapters, storage etc.
  • Hardware profiles determine VM capabilities.

Guest OS

The OS running inside the VM such as Windows, Linux, etc.

How Virtual Machines Work

VMs share physical resources from the host computer:

Show Image

The hypervisor creates a virtual environment between the physical server and VM by logically dividing up resources. VMs use CPU scheduling and isolation techniques to maximize performance.

The end user accesses the VM as a stand-alone computer with its own OS and apps over the network. Input/output is seamlessly redirected via the hypervisor.

Kinds of Virtual Machines

There are a few types of virtual machines:

System VMs

  • Provides a substitute for a real computer.
  • Runs a complete OS such as Windows or Linux.

Process VMs

  • Designed to run a single program such as Java or Python code.
  • abstraction layer provided by the VM.

In addition to the above, there are a few other kinds:

  • High productivity VMs – Application development/testing
  • Data center VMs – Server consolidation
  • Cloud VMs – AWS, Azure, Google Cloud

Getting Started with Virtual Machines

It’s easy to get started with VMs. Here are the basics steps:

  1. Choose your hypervisor platform such as VMware, Hyper-V, VirtualBox etc.
  2. Install the hypervisor on the host machine.
  3. Create VMs by allocating resources such as RAM, vCPUs, storage etc.
  4. Select a guest OS ISO file such as Ubuntu, CentOS to install on the VM.
  5. Access VM via console or network protocols like RDP or SSH.
  6. Install software applications as needed.

Leading cloud platforms make it even easier to deploy VMs without installing any software. Simply launch EC2 instances on AWS for example.

Virtual Machine Security

Since VMs share infrastructure and resources, security is an important consideration:

  • Isolate VMs based on trust levels to prevent lateral movement between VMs in the event of a breach.
  • Follow the principle of least privilege when configuring access. Limit users to only the resources necessary.
  • Embed security controls into VM templates to have them carry through on rapid provisioning.
  • Perform vulnerability scans and patching to identify and fix security misconfigurations.
  • Enable hypervisor security features like UEFI secure boot, vTPM, and virtual TXT.

Proper planning and security controls are vital for effectively leveraging virtualization while still keeping apps and data safe.

Conclusion

Virtual machines allow you to maximize hardware utilization by running multiple virtual computers on the same physical server. VMs provide increased flexibility, cost savings, and portability to deploy a wide range of computing environments.

Leading platforms make working with VMs simple. By implementing proper access controls and security measures, businesses can safely provision VMs as needed. As computing moves to the cloud, leveraging virtualization helps optimize infrastructure.

Key Takeaways

  • VMs virtualize hardware to create isolated environments using a hypervisor.
  • Benefits include increased flexibility, cost savings and productivity.
  • Types of VMs include system VMs running full guest OSes and process VMs for code execution.
  • Security measures like isolation, access controls and patching help keep VMs and host infrastructure safe.

Frequently Asked Questions

  1. What is desktop virtualization?
    Desktop virtualization refers to hosting a desktop OS like Windows 10 as a VM that is delivered remotely to an end user device. This allows accessing apps and data centralized in a data center.
  2. What is the difference between containers and VMs?
    Containers provide operating system level virtualization by isolating user space instances. VMs virtualize hardware to run complete operating systems. Containers share the host OS kernel while VMs have their own guest OS kernel.
  3. Can you run VMs inside another VM?
    Yes, nested virtualization allows you to run hypervisors and VMs within another VM. For example, VMware Workstation can run ESXi VMs which then host nested VMs.
  4. How do you access a VM?
    You can access VMs via protocols like RDP, SSH or VNC depending on the guest OS. These protocols are transported over the network to the IP address assigned to the VM.
  5. Do VMs improve security?
    VMs can improve security by isolating apps and data into separate containers with restricted access and resources. This limits damage in the event of a breach. Proper implementation is vital for security gains.
  6. Can you convert a physical machine to a VM?
    Physical to virtual (P2V) conversions are commonly done using hypervisor specific tools. These capture a system image of the physical hardware and import it as a VM file to boot up.
  7. What hardware does a VM simulate?
    A VM can virtualize standard PC hardware like CPU, memory, network interfaces, storage, graphics cards, USB controllers, etc. Advanced features can also be simulated.
  8. Is VMware a hypervisor?
    Yes, VMware’s hypervisors include ESXi which runs directly on the host machine hardware and vSphere which manages infrastructure.
  9. What is VM snapshotting?
    VM snapshots save the complete state of a VM at any point in time, including memory, settings and disk. This allows rolling back to previous versions later if needed.
  10. How are VMs licensed?
    VMs follow licensing models of the underlying software. The hypervisor, guest OSes (Windows Server etc.) and apps running inside VMs may have licenses costs tied to sockets, cores or simple counts.
  11. What are paravirtualized devices?
    Paravirtualized devices are VM hardware devices that include special interfaces for improving performance. This allows bypassing emulation for faster access the hypervisor.
  12. What is Xen?
    Xen is an open-source type-1 hypervisor that runs directly on server hardware without needing an underlying host OS. It provides near-native performance for VMs.
  13. What is Hyper-V?
    Microsoft’s Hyper-V is a native hypervisor built directly into Windows. It allows managing Windows and Linux VMs using included management tools or System Center.
  14. How do you access VM root files?
    VM root files contain VM configurations, virtual disk files and other components. These reside on VMware ESXi or Microsoft Hyper-V host file systems, accessible within the hypervisor.
  15. Can you run Mac OS as a guest VM OS?
    Yes, it is possible to run various versions of Mac OS X inside VMs using utilities like MacOS Unlocker with VMware or VirtualBox. Special configuration steps are needed.
  16. Can VMs be converted to physical machines?
    In most cases no, VMs cannot directly be converted to physical machines. However disk images may be bootable if all system files are contained within and necessary hardware drivers are added.
  17. Is Docker a hypervisor?
    Docker is not a hypervisor but rather provides operating system-level virtualization for containers. Docker relies on container primitives in the host machine’s Linux kernel and doesn’t create virtual hardware.
  18. Can you game in a VM?
    Yes it is possible to play games in a VM but performance is inferior to running games natively. VMs introduce CPU and graphics overhead but hardware acceleration options can help improve FPS for simple games.
  19. What are the alternatives to virtual machines?
    Alternatives for delivering virtualized environments include Docker containers which package apps with libraries and settings or Desktop as a Service (DaaS) which remotes an entire desktop.

Leave a Comment