Book Image

vSphere Virtual Machine Management

By : Rebecca Fitzhugh
Book Image

vSphere Virtual Machine Management

By: Rebecca Fitzhugh

Overview of this book

Table of Contents (17 chapters)
vSphere Virtual Machine Management
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Virtual machine files


vSphere administrators should know the components of virtual machines. There are multiple VMware file types that are associated with and make up a virtual machine. These files are located in the VM's directory on a datastore. The following table will summarize and provide a quick reference and short description of the files that make up a virtual machine:

File

Example filename

Description

.vmx

<vmname>.vmx

Configuration file

.vmfx

<vmname>.vmfx

Additional configuration file

.vmtx

<vmname>.vmtx

Template file

.nvram

<vmname>.nvram

BIOS/EFI configuration

.vswp

<vmname>.vswp

Swap files

vmx-<vmname>.vswp

.log

vmware.log

Current log file

vmware-##.log

Old log file entries

.vmdk

<vmname>.vmdk

Virtual disk descriptor

-flat.vmdk

<vmname>-flat.vmdk

Data disk

-rdm.vmdk

<vmname>-rdm.vmdk

Raw device map file

-delta.vmdk

<vmname>-delta.vmdk

Snapshot disk

.vmsd

<vmname>.vmsd

Snapshot description data

.vmsn

<vmname>.vmsn

Snapshot state

.vmss

<vmname>.vmss

Suspend file

Depending on the state and configuration of the virtual machine, not all files may be present in the virtual machine directory.

Let's explore these virtual machine files in more detail.

Configuration files

The .vmx file describes the current configuration information and hardware settings for the VM. This can contain a large variety of information regarding the virtual machine, to include its specific virtual hardware configuration (amount of RAM, NIC settings, CD-ROM information, parallel/serial port information, and so on), as well as its advanced resource and power settings, VMware tools options, and so forth. It is possible to make changes and directly edit this file; however, do this at your own risk. Generally, it is recommended to have a backup of this file first and to not edit until recommended by VMware support.

The .vmx file is a plain-text file that functions as the structural definition of the VM. The .vmx file can be copied from the datastore and opened using a program that supports creation and saving of files using UTF-8 encoding, such as WordPad. The following excerpt shows an example of a .vmx file for a virtual machine named ExampleVM:

.encoding = "UTF-8"
config.version = "8"
virtualHW.version = "10"
nvram = "ExampleVM.nvram"
pciBridge0.present = "TRUE"
svga.present = "TRUE"
pciBridge4.present = "TRUE"
pciBridge4.virtualDev = "pcieRootPort"
pciBridge4.functions = "8"
pciBridge5.present = "TRUE"
pciBridge5.virtualDev = "pcieRootPort"
pciBridge5.functions = "8"
pciBridge6.present = "TRUE"
pciBridge6.virtualDev = "pcieRootPort"
pciBridge6.functions = "8"
pciBridge7.present = "TRUE"
pciBridge7.virtualDev = "pcieRootPort"
pciBridge7.functions = "8"
vmci0.present = "TRUE"
hpet0.present = "TRUE"
displayName = "SampleVM"
extendedConfigFile = "ExampleVM.vmxf"
virtualHW.productCompatibility = "hosted"
memSize = "384"
sched.cpu.units = "mhz"
powerType.powerOff = "soft"
powerType.suspend = "hard"
powerType.reset = "soft"
scsi0.virtualDev = "lsilogic"
scsi0.present = "TRUE"
ide1:0.deviceType = "cdrom-image"
ide1:0.fileName = "/vmfs/volumes/5099c3c8-d8fe7ee8-2961-005056903273/win2k3srvsp2.iso"
ide1:0.present = "TRUE"
floppy0.startConnected = "FALSE"
floppy0.clientDevice = "TRUE"
floppy0.fileName = "vmware-null-remote-floppy"
ethernet0.virtualDev = "e1000"
ethernet0.networkName = "Production"
ethernet0.addressType = "vpx"
ethernet0.generatedAddress = "00:50:56:bc:c0:47"
ethernet0.present = "TRUE"
scsi0:0.deviceType = "scsi-hardDisk"
scsi0:0.fileName = "ExampleVM.vmdk"
scsi0:0.present = "TRUE"
guestOS = "winnetenterprise"
toolScripts.afterPowerOn = "TRUE"
toolScripts.afterResume = "TRUE"
toolScripts.beforeSuspend = "TRUE"
toolScripts.beforePowerOff = "TRUE"
uuid.bios = "42 3c 4c d6 12 1e 5e c2-a4 a3 b6 89 95 9f 7a 75"
vc.uuid = "50 3c 6f a7 75 fb 68 7c-d1 42 df f7 f8 9b f5 f2"
chipset.onlineStandby = "FALSE"
sched.cpu.min = "0"
sched.cpu.shares = "normal"
sched.mem.min = "0"
sched.mem.minSize = "0"
sched.mem.shares = "normal"
sched.swap.derivedName = "/vmfs/volumes/5099c3c8-d8fe7ee8-2961-005056903273/ExampleVM/ExampleVM-7f1e3e76.vswp"
uuid.location = "56 4d 9b 08 ee d9 6c e2-ab 67 3a dc 63 16 cb fe"
replay.supported = "FALSE"
replay.filename = ""
scsi0:0.redo = ""
pciBridge0.pciSlotNumber = "17"
pciBridge4.pciSlotNumber = "21"
pciBridge5.pciSlotNumber = "22"
pciBridge6.pciSlotNumber = "23"
pciBridge7.pciSlotNumber = "24"
scsi0.pciSlotNumber = "16"
ethernet0.pciSlotNumber = "32"
vmci0.pciSlotNumber = "33"
vmci0.id = "-1784710539"
hostCPUID.0 = "0000000b756e65476c65746e49656e69"
hostCPUID.1 = "000106a50002080080b822291fabfbff"
hostCPUID.80000001 = "00000000000000000000000128100800"
guestCPUID.0 = "0000000b756e65476c65746e49656e69"
guestCPUID.1 = "000106a500010800809822010fabbbff"
guestCPUID.80000001 = "00000000000000000000000128100800"
userCPUID.0 = "0000000b756e65476c65746e49656e69"
userCPUID.1 = "000106a500020800809822010fabbbff"
userCPUID.80000001 = "00000000000000000000000128100800"
evcCompatibilityMode = "FALSE"
vmotion.checkpointFBSize = "4194304"
cleanShutdown = "TRUE"
softPowerOff = "FALSE"
ide1:0.startConnected = "TRUE"
toolsInstallManager.lastInstallError = "0"
tools.syncTime = "FALSE"
tools.remindInstall = "FALSE"
toolsInstallManager.updateCounter = "1"
unity.wasCapable = "FALSE"

Reading through this file gives us important information regarding the configuration of the virtual machine. Here are a few examples:

  • The VM's configured guest operating system can be derived from the guestOS line.

  • Based upon the memsize line, it is known that the VM was configured for 384 MB of memory.

  • The virtual machine only has one network adapter configured for the VM network port group based on the ethernet0 lines.

  • The virtual machine's vNIC has a MAC address of 00:50:56:bc:c0:47, specified by the ethernet0.generatedAddress line.

A virtual machine's .vmx file is most commonly edited to modify the MAC address so that it matches the effective MAC address set within the guest operating system.

The .vmx file is extremely important to the virtual machine. However, keep in mind that it only structurally defines the VM's virtual hardware composition. It does not hold any actual data from the guest OS running within the VM. The virtual machine's data is stored in its virtual disk file. Here is an overview of the configuration and BIOS files:

  • .vmtx: When a virtual machine is converted to a template, the virtual machine configuration file (.vmx) is replaced by the template configuration file (.vmtx).

  • .nvram: This is generally a fairly small file that contains the BIOS settings that the VM uses upon boot. This is similar to how a physical server that has a BIOS chip allows hardware configuration options. The virtual BIOS settings, contained in the .nvram file, can be accessed by pressing F2 when the virtual machine is powered on.

Swap files

The .vswp file is created when the virtual machine is powered on. The size of the .vswp file is equal to that of a configured memory, unless there is a reservation. When a memory reservation is configured for a VM, then the .vswp file size would equal the configured memory size minus the memory reservation. This file is used as a last resort when the hypervisor is reclaiming physical memory from its virtual machines, due to contention. Memory reclamation techniques are discussed in Chapter 6, Virtual Machine Performance and Resource Allocation.

Looking at the previous table, you may have noticed the vmx-<vmname>.vswp file. This file is for the overhead memory created for a VM, a new feature in vSphere 5.x. Historically, this memory overhead was not swappable. Though there was a memory reservation to back this, the entire address space did not actually have to reside in memory. This file helps to reduce the reservation requirements for virtual machines.

Virtual disks

The following are some of the virtual disk files:

  • .vmdk: Virtual disk descriptor, which holds information such as the size and disk geometry of the virtual disk, information that makes the VM believe it has a real hard disk and not files on a datastore. Such information includes the virtual disk's adapter type, drive sectors, heads, and cylinders. This descriptor file also contains a pointer to the larger data file for the virtual disk or the -flat.vmdk file. An example of this information is demonstrated in the following screenshot:

  • -flat.vmdk: This file actually contains the virtual disk's data. This is created by default when a virtual hard drive is added to a virtual machine that is not using the Raw Device Mapping (RDM) option. When created as a thick provisioned disk, it will be sized approximately to what was specified in the creation wizard. The different disk provisioning types will be discussed in Chapter 2, Creating a Virtual Machine Using the Wizard.

  • -rdm.vmdk: This is the mapping file for the Raw Device Mapping (RDM) option, managing the RDM device's mapping data. The virtual machine isn't aware of this since the mapping file is presented to the ESXi host as a traditional disk file and available for normal filesystem operations. The storage virtualization layer presents the mapped device as a virtual SCSI device to the VM. An –rdm.vmdk file exists for each RDM configured for the virtual machine. RDMs will be discussed in more detail in Chapter 2, Creating a Virtual Machine Using the Wizard and Chapter 10, Virtual Machine Design.

Snapshot files

The following are the snapshot files:

  • -delta.vmdk: These files are only used when creating snapshots. When a snapshot is created, the original –flat.vmdk file is no longer written to; it becomes read only. All changes that are written to the virtual disk are now being written to the –delta.vmdk files instead. Due to the fact that these –delta.vmdk files are bitmaps of changes made to a virtual disk, the –delta.vmdk file cannot exceed the size of the original –flat.vmdk file. A –delta.vmdk file is created for each snapshot that is generated. These –delta.vmdk files are updated in 16 MB increments as changes are written to the virtual disk.

  • .vmsd: This file is a snapshot descriptor that contains information regarding which files are used by each snapshot, description, display name, and any associated UIDs. There is only one .vmsd file per virtual machine, regardless of how many snapshots the virtual machine has. This file is updated each time a new snapshot is created or a snapshot is deleted.

  • .vmsn: This file stores the virtual machine's state at the time the snapshot was taken. The size of this file varies depending on whether the option to include the VM's memory state was selected during snapshot creation. A separate .vmsn file will be created for each snapshot and will automatically be removed when the snapshot is deleted.

Other files

Let's take a look at some other files:

  • .vmss: This file is used when a virtual machine is suspended so as to preserve the VM's memory contents; it is only present when the VM is suspended. When the virtual machine is resumed from the suspended state, it can start again right from where it left off. The contents of this file are written back to the ESXi host's physical memory when the virtual machine is brought out of a suspended state; however, the file will not be automatically deleted until the VM is powered off. This file will be approximately the same size as the configured memory for the virtual machine, unless memory contention is present.

  • .log: Log files are created in order to log information regarding the virtual machine, typically used during troubleshooting efforts. The current log file is always named vmware.log, and by default up to six older log files will be retained. These older log files will have a number appended at the end of their names, which will be updated with each file (vmware-2.log).

Viewing virtual machine files

A virtual machine's files can either reside on a VMFS or a NFS datastore. The vSphere Client or the vSphere Web Client can be used to browse the datastore and display a virtual machine's files.

Using the vSphere Client

In order to figure out which datastore the VM resides on and browse the datastore by performing the following steps:

  1. First select the virtual machine in the inventory.

  2. On the VM's Summary tab, there is a Resources pane that lists all the datastores being used by the selected VM.

  3. Right-click on a datastore and select Browse Datastore... from the available options.

    This is demonstrated in the following screenshot:

This process opens the Datastore Browser, which is a handy tool to quickly display the contents of any datastore. The virtual machine's files can be displayed by selecting the VM's directory, as shown in the following screenshot:

Note

The Datastore Brower shows that the virtual disk consists of only a single file, the .vmdk file. This is not indicative of reality; there are actually at least two files that make up the virtual disk, the .vmdk and –flat.vmdk files.

Another option in the vSphere Client is Storage Views; to access this option, perform the following steps:

  1. Select the VM in the inventory and then the Storage Views tab.

  2. There is a drop-down menu towards the left-hand side, click on it and select Show All Virtual Machine Files.

This is shown in the following screenshot:

Notice that the –flat.vmdk file is displayed in this view. This is the only view in the vSphere Client where the –flat.vmdk file is shown. All other views show only the .vmdk file.

Using the vSphere Web Client

If the vSphere Web Client is installed, then the virtual machine files may also be viewed using it. This view is the vSphere Web Client equivalent to the vSphere Client's Datastore Browser. Once the vSphere Web Client is launched:

  1. Browse to the Datastore and Datastore Cluster view.

  2. Once in this view, select the datastore that the virtual machine resides on in the inventory pane.

  3. From there, go to the Manage tab and select the Files button.

  4. The datastore directories will be listed on the left-hand side. Select the virtual machine; the results will look similar to what is displayed in the following screenshot. Note that the –flat.vmdk file is not shown:

Using command line

Alternatively, the files can be displayed via a command line. Ensure SSH is enabled on the ESXi host that the virtual machine is located on and use an SSH client, such as PuTTy, to establish a connection. For steps on how to enable SSH, check http://vmware.com/kb/1017910. Navigate to the virtual machine's directory and use the ls –l command to view the files.

An example of the output from using the ls –l command, after navigating to the VM's directory, is shown in the following screenshot: