Книга: Mastering VMware® Infrastructure3

Creating a Virtual Machine

Creating a Virtual Machine

Before we get too deep into the virtual machine creation and management process, we must first establish a few distinctions with regard to the terminology we will use. It is common for IT folk to commonly refer to a Windows or Linux system running on an ESX Server host as a virtual machine. Technically, the statement is not 100 percent accurate. I am not here to change the world, so I won't try to force a change; however, a virtual machine actually deserves a separate distinction from the guest operating system. The assembly of a set of virtual hardware that makes up the virtual machine is still a virtual machine prior to the installation of the guest operating system, just as a physical server without an operating system is still a physical machine. So, from a technical perspective, a virtual machine is a set of virtual hardware selected for the purpose of running a guest operating system. However, from a practical perspective you can go on calling the Windows or Linux system a virtual machine.

A virtual machine can consist of different virtual hardware components that utilize drivers written by VMware. These drivers are not as complex as using manufacturer-released drivers for specific hardware components. For example, the drivers for the VMware SVGA II are not as heavy or invasive as the drivers for an ATI Radeon video adapter. Figure 6.1 shows virtual hardware identified in the Device Manager of a virtual machine. Noticeably, much of the third-party device driver installation is replaced with the virtualized hardware that the ESX Server is providing.


Figure 6.1 The drivers for hardware in a virtual machine are much lighter than the third-party drivers found on physical computers.

The lighter and less intrusive drivers found in a virtual machine result in an easier hardware maintenance schedule and reduced opportunity for server failures due to driver incompatibilities.

A virtual machine consists of several types of files; the two most common are the configuration file and the virtual hard disk file. The configuration file is identified by a .vmx extension and functions as the structural definition of the virtual machine. The VMX file defines the virtual hardware that resides in a virtual machine. The number of processors, the amount of RAM, the number of network adapters, associated MAC addresses, and the number, names, and locations of all virtual hard drives are stored in the configuration file.

The virtual hard disk file (identified by a .vmdk extension) holds the data stored by a virtual machine. Typically the first VMDK file is the storage location for the C drive of the virtual machine that holds the operating system. Additional virtual hard disks (VMDK files) can be added to provide additional storage locations for the virtual machine.

A virtual machine, as shown in Figure 6.2, can consist of the following virtual hardware devices:

? Processors — one, two, or four processors with VMware Virtual SMP

? Memory — Maximum of 16GB of RAM

? SCSI adapter — Maximum of four SCSI adapters with 15 devices per adapter

? Network adapter — Maximum of four network adapters

? Parallel port — Maximum of three parallel ports

? Serial port — Maximum of four serial ports

? CD/DVD ROM — Maximum of two CD/DVD ROM drives

? Floppy drive — Maximum of two floppy disk drives

? Keyboard, video card, and mouse


Figure 6.2 A virtual machine consists of virtual processors, SCSI adapters, network adapter, CD/DVD drives, memory, and more.

Hard drives are not listed in the virtual hardware because virtual machine hard drives are added as SCSI devices. With up to four SCSI adapters and 15 SCSI devices per adapter, it is possible to attach 60 hard drivers to a virtual machine. Keep in mind, however, that the size limit for a virtual hard drive is 2TB.

Perform the following steps to create a virtual machine:

1. Use the VI Client to connect to a VirtualCenter server or an individual ESX Server host.

2. In the inventory tree, right-click on the name of a cluster or an individual ESX Server host and select the New Virtual Machine option, as shown in Figure 6.3. Alternatively, use the File menu or the Ctrl+N keyboard shortcut to launch the wizard.

3. When the New Virtual Machine Wizard opens, select the Custom radio button, shown in Figure 6.4, and then click Next. The Custom selection lets you configure input/output (I/O) adapters during the virtual machine creation process.

4. As shown in Figure 6.5, type a name for the virtual machine in the Virtual Machine Name text box, select a location in the inventory where the virtual machine should reside, and click Next.

Real World Scenario

Virtual Machine Naming

The display name given to a virtual machine might seem like a trivial assignment, but you must ensure an appropriate naming strategy is in place. As a rule, the display names of virtual machines should, but don't have to, match the hostnames configured in the guest operating system being installed. For example, if the intention is to name the guest operating system host Server1, then the virtual machine display name should match with Server1. If spaces are used in the virtual display name, which is allowed, then using command-line tools to manage virtual machines becomes a bit tricky because the spaces will have to be quoted out in the command-line use. In addition, since DNS hostnames cannot include spaces, using spaces in the virtual machine name would create a disparity between the virtual machine name and the guest operating system hostname. Ultimately, this means you should avoid using spaces and special characters that are not allowed in standard DNS naming strategies to ensure similar names both inside and outside the virtual machine.

The display name assigned to a virtual machine also becomes the name of the folder in the VMFS volume where the virtual machine files will live. At the file level, the associated configuration (VMX) and virtual hard drive (VMDK) files will assume the name supplied in the display named text box during virtual machine creation.  


Figure 6.3 You can launch the New Virtual Machine Wizard from the context menu of an ESX Server cluster or an individual ESX Server host.

5. Select a datastore where the virtual machine files should be located, as shown in Figure 6.6, and then click Next.


Figure 6.4 The Custom option lets you adjust the type of I/O adapter in the virtual machine. 


Figure 6.5 The name provided for the display name of the virtual machine becomes the name of the folder it resides in and the prefix for all of the corresponding virtual machine files (i.e., VMX and VMDK).

6. As shown in Figure 6.7, select the radio button that corresponds to the operating system vendor, select the correct operating system version, and then click Next.

7. As shown in Figure 6.8, select the number of virtual processors to include in the virtual machine, and then click Next.

8. Configure the virtual machine with the determined amount of RAM by adjusting the slider bar or typing the value, as shown in Figure 6.9, and then click Next. 

The amount of RAM configured on this page is the amount of RAM the guest operating system reflects in its system properties. The setting on this page is not a guarantee that physical memory will be used to achieve the configured value. As discussed in later chapters, memory for a virtual machine can be physical RAM, VMkernel swap file space, or a combination of both.


Figure 6.6 Virtual machines can be stored in any of the datastores available to an ESX Server host as long as the space requirements meet the needs of the virtual machine.


Figure 6.7 Selecting the appropriate operating system vendor and version ensures that the correct I/O adapter is automatically chosen for the virtual machine.

9. As shown in Figure 6.10, select the number of network adapters to include in the virtual machine, configure each NIC for the appropriate network, and then click Next.

10. Select the radio button that corresponds to the appropriate SCSI adapter for the operating system selected on the Guest Operating System page of the New Virtual Machine Wizard. The correct default driver should already be selected based on the previously selected operating system. 

Virtual Machine SCSI Controllers 

Typically, Windows 2000 and Windows XP have built-in support for the BusLogic SCSI controller, while Windows Server 2003 and later operating systems have built-in support for the LSI Logic controller. Choosing the wrong controller will result in an error during the operating system installation. The error states that hard drives cannot be found. Choosing the wrong SCSI controller during a physical to virtual (P2V) operation will result in an “inaccessible boot device blue screen error” inside the virtual machine. 


Figure 6.8 You can configure virtual machines with one, two, or four processors with VMware Virtual SMP (which is included in the VMware Standard and Enterprise editions).  


Figure 6.9 The RAM configured on the Memory page of the New Virtual Machine Wizard equates to the amount of RAM the guest operating system reflects when viewing the system properties.


Figure 6.10 A virtual machine can be configured with up to four network adapters that reside on the same or different networks as needed. 

11. Select the appropriate radio button for the virtual disk to be used, as shown in Figure 6.11, and then click Next.


Figure 6.11 A virtual disk can be created as new, from an existing virtual disk, or with access to a raw SAN LUN. 

The option Use an Existing Virtual Disk allows a virtual machine to be created from a virtual disk that is already configured with an operating system and residing in an available datastore. 

The option Raw Device Mappings allows a virtual machine to have raw SAN LUN access. We will discuss this in more detail later in the book. 

Adding Existing Disks 

The existing virtual disk doesn't have to contain an OS; it can contain data that perhaps will serve as a secondary drive inside the virtual machine. The ability to add existing disks with data makes virtual hard drives extremely portable as they can be moved from virtual machine to virtual machine without repercussions. 

12. As shown in Figure 6.12, configure the desired disk size for the virtual machine hard drive and specify the location where the file should be stored; then click Next. The disk size configuration cannot exceed the maximum file size as defined by the format of the VMFS volume on which the file is being stored.


Figure 6.12 A virtual machine disk will consume the full amount of disk space by default. The size of the virtual machine's hard drive should be carefully considered. 

The option Store with the Virtual Machine will place the file in the same subdirectory as the configuration file and the rest of the virtual machine files. This is the most commonly selected option and makes managing the virtual machine files administratively easier. 

The option Specify a Datastore allows you to store the virtual machine file separately from the rest of the files. You'd typically select this option when adding new virtual hard disks to a virtual machine and when you need to separate the operating system virtual disk from a data virtual disk.

13. As shown in Figure 6.13, the Advanced Options page lets you specify the SCSI node the virtual disk is connected to and also allows you to configure a virtual disk in Independent mode. As noted in the wizard, this page is normally not altered and can be accepted by clicking Next.

The Node drop-down list reflects the 15 different SCSI nodes available on each of the four SCSI adapters a virtual machine supports.


Figure 6.13 The virtual device node defines where in the virtual SCSI adapter the virtual hard disk is connected, while the virtual disk node defines the characteristics of the data storage. The Snapshots (Allowed) disk mode is the default configuration, which permanently writes to the disk and permits snapshots.

By not selecting the Independent mode option, you ensure that the virtual disk remains in the default state that allows virtual machine snapshots to be created. If you select the Independent checkbox, you can configure the virtual disk as a Persistent disk, in which changes are written immediately and permanently to the disk, or as a Nonpersistent disk, which discards all changes when the virtual machine is turned off.

14. As shown in Figure 6.14, complete a final review of the virtual machine configuration and then click Finish.


Figure 6.14 Reviewing the configuration of the New Virtual Machine Wizard ensures the correct settings for the virtual machine and prevents mistakes that require deleting and re-creating the virtual machine.

Building Scalable Virtual Machines 

Although many configuration options are available for creating virtual machines, there are some best practices that facilitate the management, scalability, and backup of virtual machines. First and foremost, virtual machines should be created with multiple virtual disk files as a means of separating the operating system from the custom user data. Separating the system files and the user data will make it easier to increase the number of data drives in the future and will allow for a more practical backup strategy. A system drive of 25GB to 30GB, for example, will provide ample room for the initial installation and continued growth of the operating system. The data drives across different virtual machines will vary in size due to the installed applications, the function of the system, and the number of users who connect to the computer. However, due to the fact that the extra hard drives are not operating system data, it will be easier to make adjustments to those drives when needed.

Additional virtual hard drives will pick up on the same naming scheme as the original virtual hard drive. For example, a virtual machine named SERVER1 that has an original virtual hard disk file named SERVER1. vmdk will name the new virtual hard disk file SERVER11.vmdk. Each additional file will increment the last number, making it administratively easy to identify all virtual disk files related to a particular virtual machine. This image shows a virtual machine configuration with operating system hard drives and an extra hard drive added for storing user nonsystem data:


Later in this chapter, we will revisit this concept to see how templates can be used to implement and maintain an optimal virtual machine configuration that separates the system data from the user data.

Оглавление книги


Генерация: 0.700. Запросов К БД/Cache: 2 / 0
поделиться
Вверх Вниз