Where are VM stored?

A virtual machine (VM) is an emulation of a computer system implemented through software virtualization. VMs run on top of a physical machine using a hypervisor to abstract the hardware layer and allocate computing resources to each VM. But where exactly are VMs stored? Read on to understand VM storage and best practices for optimization.

Where are VM stored?

What is a VM?

A virtual machine is a software program that emulates a physical computer and its components. It consists of a virtual processor, RAM, storage, and networking interface that allows it to run its own operating system and applications like a physical machine. Multiple VMs can run on the same physical server to maximize hardware resource utilization.

Some key highlights of VMs:

  • Emulated computer system abstracted from underlying hardware
  • Provides dedicated CPU, memory, storage, networking resources
  • Runs own guest operating system e.g. Linux, Windows
  • Enables application isolation and better security
  • Allows fast provisioning of multiple systems

What is a hypervisor?

A hypervisor, also known as virtual machine monitor (VMM), is a software layer that creates and manages virtual machines. It abstracts the system hardware from the VMs to allocate resources dynamically and schedule instruction execution.

Different types of hypervisors:

  • Type 1 – Native or bare-metal hypervisors run directly on host hardware
  • Type 2 – Hosted hypervisors run as an application on the OS

Popular hypervisors used today include VMware ESXi, Microsoft Hyper-V, Citrix XenServer.

Where are VMs stored?

When a VM is created, the hypervisor emulates virtual storage for it in the form of virtual disks comprised of one or more virtual disk image files. These virtual disk image files reside on physical storage provided by the underlying host machine.

The virtual disks contain the VM boot disk with OS, program files, applications, in addition to any other data disks attached to the VM. The virtual disk images emulate an actual storage disk. Reads and writes by the VM guest OS are handled by the hypervisor to the virtual disk file.

Types of physical storage for VMs

The virtual disk files can be hosted on different types of physical storage attached to the hypervisor server:

  • Local storage – Virtual disk files stored on hypervisor server’s own disks
  • Shared storage – Disk files located on centralized storage such as SAN or NAS accessible over network
  • External storage – Virtual disks stored on directly attached external disks

Benefits of shared storage:

  • Centralized VM management independent of hypervisor server
  • Storage network redundancy against server failures
  • Live migration of VMs across hypervisor nodes
  • Dynamic resource allocation and high availability

Most enterprise-grade hypervisors leverage shared SAN or NAS storage for hosting virtual machine disk files. Local server storage or DAS may be used only for limited use cases.

How does the hypervisor access and manage VM storage?

The hypervisor manages VM virtual disks by mapping guest storage IO operations to underlying physical disks:

  1. Storage abstraction – Hypervisor provides a virtual disk interface to VMs hiding physical storage details
  2. Virtual disk mapping – Guest disk blocks are mapped to file blocks on virtual image files
  3. IO translation – Guest storage IO requests are translated to host file system and disk operations
  4. Cache management – The hypervisor manages IO caches and optimizes virtual disk performance

This allows the VMs to access a logical storage disk while the hypervisor handles all interaction with the physical storage layer. Technologies like VMware VMFS enable advanced storage features for VMs like snapshots, thin provisioning and failover.

Factors affecting VM storage performance

Some key considerations for optimizing virtual machine storage performance:

  • Disk file format – VMDK, VHDX, RAW etc. offer different features and overheads
  • Virtual disk size – Right-size VMDK files as per storage needs
  • Disk shares and limits – Control relative disk access across VMs
  • Storage caching – Leverage host-level SSD caching tiers
  • Hyperconverged storage – Combine compute and storage for faster data access
  • All-flash arrays – Low-latency storage with high bandwidth and IOPS

Additionally, distributing VMs across well-configured shared storage arrays and balancing workloads allows maximizing available storage performance.

Best practices for VM storage management

Follow these tips for ideal VM storage deployment:

Performance

  • Use shared block-level SAN rather than NAS for optimal performance
  • Leverage host-side caching using SSDs
  • Benchmark storage performance regularly

Availability

  • Configure storage network redundancy with multipathing
  • Set up clustered filesystems like VSAN or Oracle ASM

Manageability

  • Standardize hosts to access shared storage pools
  • Monitor VM storage capacity and growth
  • Automate provisioning workflows through self-service catalogs

Costs

  • Employ storage tiering with SSDs and HDDs
  • Deduplicate and compress data to optimize capacity
  • Archive cold data to object storage

Security

  • Isolate storage traffic in secured VLANs
  • Encrypt data-at-rest and secure remote replication

Conclusion

Virtual machines store their boot disks, data drives, program files, databases and all other data on virtual disk image files emulated by the hypervisor platform. These VMDK/VHD files representing the virtual storage disks get stored on the shared or local storage allocated to the host servers.

Leveraging centralized shared storage like FC SAN or iSCSI NAS allows the most flexible and scalable VM deployments. The hypervisor translates all guest VM storage IO operations to file and disk operations on the underlying physical storage arrays.

Optimizing VM storage performance, availability, security and costs is key to efficiently run production workloads. This requires properly architecting the storage environment, aligning to virtualization leading practices and continuously monitoring and improving the storage systems.

Key Takeaways

  • Virtual machines access emulated virtual disk image files running on hypervisor server storage
  • Virtual disks map IO reads/writes from guest VM to underlying physical storage
  • Shared FC/iSCSI storage facilitates live migration and resource pooling
  • Several components impact VM storage performance from disk formats to array caching tiers and block sizes
  • Follow availability, security, and automation best practices for VM storage deployment

FAQs:

Q1: Where are VMs stored in VMware infrastructure?
VMware VMs store their configuration files, virtual disks, snapshots and other data in VMFS or NFS datastores. These datastores can exist on the hypervisor’s local storage or on external shared storage like SAN or NAS exposed via FC, iSCSI, FCoE or NFS protocols.

Q2: Can you store VM files on a flash drive?
It is possible but not recommended to store VM files on external flash drives or USB disks due to performance and reliability limitations. For small temporary desktop VMs, using an external SSD disk via eSATA/USB 3.0 can work. But production VMs should always run off shared SAN/NAS systems or internal RAID-protected storage.

Q3: How to reduce VM storage size?
Some ways to reduce VM storage footprint include removing any temporary files or OS page files, running storage deduplication and compression, archiving stale data to cold tiers, limiting disk size quotas, and converting thick disks to thin provisioned disks.

Q4: How are VM snapshots stored?
VM snapshots capture the system disk state at a point in time. Most hypervisor snapshots use a delta disk model splitting the VMDK into -base disk for original data + delta file capturing subsequent writes. The delta file stores changes between the snapshot and current disk state.

Q5: Can we migrate VMs with local storage to shared storage?
Yes, VMs running on a hypervisor’s local storage can be migrated to shared storage through techniques like Storage vMotion in case of VMware. This facilitates seamlessly migrating VMs across hosts while eliminating downtime or changes to the guest OS.

Q6: How to monitor VM storage performance?
Hypervisors provide storage performance graphs and reports to monitor metrics like IOPS, throughput, latency for VMs. Third-party tools can give deeper insights into storage bottlenecks across VM, host, array and network. 

Leave a Comment