Difference between revisions of "Managing VMware Server 2.0 Virtual Disks"
(→Modifying VMware Server Virtual Disk Configurations) |
m (Text replacement - "<google>BUY_VMWARE_SERVER_2_BOTTOM</google>" to "<htmlet>vmware</htmlet>") |
||
(14 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
+ | <table border="0" cellspacing="0" width="100%"> | ||
+ | <tr> | ||
+ | <td width="20%">[[VMware Server 2.0 DHCP Configuration|Previous]]<td align="center">[[VMware Server 2.0 Essentials|Table of Contents]]<td width="20%" align="right">[[Command Line Management of VMware Virtual Disks|Next]]</td> | ||
+ | <tr> | ||
+ | <td width="20%">VMware Server 2.0 DHCP Configuration<td align="center"><td width="20%" align="right">Command Line Management of VMware Virtual Disks</td> | ||
+ | </table> | ||
+ | <hr> | ||
+ | |||
+ | |||
+ | <htmlet>vmware</htmlet> | ||
+ | |||
+ | |||
Rather than using a physical disk drive to store the system and user files for a guest operating system, VMware Server virtual machines use files (known as ''virtual disks'') located on the disk drives attached to the host system. | Rather than using a physical disk drive to store the system and user files for a guest operating system, VMware Server virtual machines use files (known as ''virtual disks'') located on the disk drives attached to the host system. | ||
Line 5: | Line 17: | ||
== VMware Server Virtual Disk and Device Types == | == VMware Server Virtual Disk and Device Types == | ||
− | Virtual disks provide the storage for guest operating system and user files. Each VMware Server virtual machine will likely have one or more virtual disks configured and during the lifecycle of a virtual machine virtual disks may be added and removed as needed. | + | Virtual disks provide the storage for guest operating system and user files. Each VMware Server virtual machine will likely have one or more virtual disks configured and during the lifecycle of a virtual machine virtual disks may be added and removed as needed. The size of a virtual disk is specified at creation time and can range from 1MB up to a maximum of 950GB. |
− | When a virtual disk is first created (either during the virtual machine process or later) it may be configured as ''growable'' or ''pre-allocated''. | + | When a virtual disk is first created (either during the virtual machine creation process or later) it may be configured as ''growable'' or ''pre-allocated''. The virtual disk type may subsequently be converted using the ''vmware-vdiskmanager'' command line tool as described in the chapter entitled [[Command Line Management of VMware Virtual Disks]]. A ''growable'' disk is initially created smaller than the specified disk size, and subsequently grows as space is needed up until the maximum specified size is reached. This has the advantage that the disk creation process is shorter and less disk space on the host is used initially. A further advantage of growable disks is that the size of the disk can be reduced at a later time using the VMware Tools ''Shrink Disk'' feature (see the chapter entitled [[The VMware Tools Control Panel]] for more details on this and other VMware Tools features). These features, however, come at the cost of reduced performance (since system resources will be needed to increase the size of the disk as additional data is written). |
− | In the case of a ''pre-allocated'' virtual disk, the entire space required for the disk is allocated at creation time. This has the advantage that virtual disk performance is not degraded due to the need to increase the disk size as more space is needed. Disadvantages include an increased amount of time needed to create the disk (taking several hours for a 950GB virtual disk) and the inability to reduce the size of the disk at a later time. | + | In the case of a ''pre-allocated'' virtual disk, the entire space required for the disk is allocated at creation time. This has the advantage that virtual disk performance is not degraded due to the need to increase the disk size as more space is needed. Disadvantages include an increased amount of time needed to create the disk (taking several hours for a 950GB virtual disk) and the inability to reduce the size of the disk at a later time unless the disk is converted to ''growable''. |
− | An additional | + | An additional option allows virtual disks to be split amongst multiple 2GB files on the host, rather than contained in a single file. This option has little benefit unless VMware Server is hosted on a file system which limits file sizes to 2GB. |
− | To the guest operating system running inside a virtual machine, virtual disks appear as though they are physical devices. As such, the disk can be configured to appear to the virtual machine as either an IDE or SCSI device. In the case of SCSI virtual disks, VMware uses a virtual SCSI controller which appears to the guest as either an LSI Logic or BusLogic controller. As such, guest operating system drivers may need to be installed accordingly. | + | To the guest operating system running inside a virtual machine, virtual disks appear as though they are physical devices. As such, the disk can be configured to appear to the virtual machine as either an IDE or SCSI device. In the case of SCSI virtual disks, VMware uses a virtual SCSI controller which appears to the guest as either an LSI Logic or BusLogic controller. As such, guest operating system hardware drivers for these devices may need to be installed accordingly. |
== VMware Server Disk Modes == | == VMware Server Disk Modes == | ||
− | VMware Server virtual disks may be configured to run | + | VMware Server virtual disks may be configured to run in ''Independent mode'' which provides two additional options in terms of disk configuration: |
− | * '''Persistent''' - Data written to the disk by the guest operating system is retained when the system is powered off. This is the normal mode of | + | * '''Persistent''' - Data written to the disk by the guest operating system is retained when the system is powered off. This is the normal mode of operation for most virtual disks. |
− | * ''Nonpersistent'' - Data written to the disk during a discarded after the virtual machine is powered off or reset. This is useful if the guest operating system is required to be started with a clean system each time the virtual machine is powered on, perhaps in a testing or secure environment. | + | * '''Nonpersistent''' - Data written to the disk during a virtual machine session are discarded after the virtual machine is powered off or reset. This is useful if the guest operating system is required to be started with a clean system each time the virtual machine is powered on, perhaps in a testing or secure environment. |
Disks configured as independent are not included in snapshots. | Disks configured as independent are not included in snapshots. | ||
Line 27: | Line 39: | ||
== VMware Server Virtual Disk Caching Options == | == VMware Server Virtual Disk Caching Options == | ||
− | The disk write caching policy for virtual disks defines the point at which new data is written to the virtual disk (as opposed to being cached in memory before being written) by the guest operating system. These settings have implications for performance, with increased performance being available at the cost of data integrity. A choice of two policy options | + | The disk write caching policy for virtual disks defines the point at which new data is written to the virtual disk (as opposed to being cached in memory before being written) by the guest operating system. These settings have implications for performance, with increased performance being available at the cost of data integrity. A choice of two policy options is available: |
− | * Optimize for safety - Data is not cached. Write operations made by the guest operating system are written immediately to the virtual disk image. Reduces risk of data loss in the event of a system failure, but results in slower disk write performance. | + | * '''Optimize for safety''' - Data is not cached. Write operations made by the guest operating system are written immediately to the virtual disk image. Reduces risk of data loss in the event of a system failure, but results in slower disk write performance. |
− | * Optimize for performance - Write operations performed by the guest operating system are initially cached prior to being written to the virtual disk. Provides increased write performance at the cost of increased risk of data loss | + | * '''Optimize for performance''' - Write operations performed by the guest operating system are initially cached prior to being written to the virtual disk. Provides increased write performance at the cost of increased risk of data loss in the event of a system failure. |
== Adding a New Virtual Disk == | == Adding a New Virtual Disk == | ||
− | A new virtual disk may be added to a virtual machine via the VI Web Access management interface (details of which are covered in the [[A Guided Tour of the VMware Server 2.0 Infrastructure Web Access Interface]] chapter of this book). SCSI based virtual disks may be installed on running virtual machines as long as those machines are running on VMware virtual hardware version 7 or later (the default setting when virtual machines are created in VMware Server 2.0). IDE based virtual disks or virtual machines running on older versions of the virtual hardware require that the virtual machine be powered off prior to addition of a new virtual disk. | + | A new virtual disk may be added to a virtual machine via the VI Web Access management interface (details of which are covered in the [[A Guided Tour of the VMware Server 2.0 Infrastructure Web Access Interface]] chapter of this book). SCSI based virtual disks may be installed on running virtual machines as long as those machines are running on VMware virtual hardware version 7 or later (the default setting when virtual machines are created in VMware Server 2.0). IDE based virtual disks or virtual machines running on older versions of the virtual hardware require that the virtual machine be powered off prior to the addition of a new virtual disk. |
Once logged into the VI Web Access interface, the first step in adding a new virtual disk is to select the required virtual machine from the ''Inventory'' panel. In the ''Commands'' section of the virtual machine workspace, click on the ''Add Hardware'' link to invoke the ''Add Hardware Wizard'' as illustrated in the following figure: | Once logged into the VI Web Access interface, the first step in adding a new virtual disk is to select the required virtual machine from the ''Inventory'' panel. In the ''Commands'' section of the virtual machine workspace, click on the ''Add Hardware'' link to invoke the ''Add Hardware Wizard'' as illustrated in the following figure: | ||
Line 48: | Line 60: | ||
== Modifying a VMware Server Virtual Disk Configuration == | == Modifying a VMware Server Virtual Disk Configuration == | ||
+ | |||
+ | The current configuration of a virtual disk may be viewed and modified by logging into the VI Web Access interface and selecting the virtual machine to which the disk is attached from the ''Inventory'' panel. Once the workspace updates to reflect the selected virtual machine, locate the disk drive from the ''Hardware'' panel, click on it and select ''Edit...'' from the menu. This will display the hard disk settings dialog as illustrated in the following figure: | ||
+ | |||
+ | |||
+ | [[Image:vmware_virtual_disk_settings.jpg|Editing the settings for a VMware Server virtual disk]] | ||
+ | |||
+ | |||
+ | An important point to note is that many of the settings will be read-only (and consequently grayed out) if the selected virtual machine, or any other virtual machine which shares the disk, is currently powered on. In addition, the ''Increase capacity...'' link shown in the above figure will not be visible if the virtual machine is powered on. To make changes to configuration values, or to increase disk capacity, it will be necessary to power off all virtual machines that utilize the virtual disk. | ||
== Enlarging a VMware Server Virtual Disk == | == Enlarging a VMware Server Virtual Disk == | ||
+ | |||
+ | The capacity of a virtual disk may be increased using the disk settings dialog (described above). As with most other virtual disk settings, a disk may only be increased in size when all virtual machines sharing the disk are powered off. Once this is achieved, select a virtual machine which uses the virtual disk from the ''Inventory'' panel of the VI Web Access interface, click on the required hard disk from the ''Hardware'' panel and select ''Edit...'' from the menu. Once the disk settings dialog appears, click on the ''Increase capacity...'' link to display the disk capacity fields as illustrated in the following figure: | ||
+ | |||
+ | |||
+ | [[Image:vmware_server_increase_virtual_disk_size.jpg|Increasing the size of a VMware Server 2.0 virtual disk]] | ||
+ | |||
+ | |||
+ | The current size of the virtual disk is listed, together with two text boxes for the amount by which the disk is to be increased and the new capacity. Both are specified in gigabytes (GB), and either may be used to increase the size of the virtual disk. The amount of space available for allocation to the virtual disk is dictated by the available space on the ''datastore'' in which the virtual disk file resides. The current free space on the datastore is also listed beneath the capacity text boxes. The increase in virtual disk capacity cannot exceed this value. | ||
== Shrinking a VMware Server Virtual Disk == | == Shrinking a VMware Server Virtual Disk == | ||
+ | |||
+ | Unlike increasing the capacity of virtual disks, which is performed outside the virtual machine using the VI Web Access interface, virtual disks can only be reduced in capacity from within the virtual machine's guest operating system and requires the installation of VMware Tools. If VMware Tools are not currently installed on the guest operating system, begin by reading the chapter entitled [[Understanding and Installing VMware Tools]]. | ||
+ | |||
+ | Once VMware Tools are installed into the guest operating system, the next step is to access the VMware Tools Control Panel. The default configuration for VMware Tools on Windows should have placed a VMware Tools icon in the Windows notification area in the bottom right hand corner of the Windows task bar (where the date and time are typically displayed) and also as an icon in the Windows Control Panel (accessed via Start->Control Panel). Double clicking on either of these options will invoke the control panel. | ||
+ | |||
+ | To invoke the VMware Tools control panel on Linux and Solaris systems, simply execute the following at a command-line prompt: | ||
+ | |||
+ | <pre> | ||
+ | /usr/bin/vmware-toolbox& | ||
+ | </pre> | ||
+ | |||
+ | The "Shrink" tab of the VMware Tools control panel allows virtual disks associated with the virtual machine to be reduced in size by reclaiming unused areas on the disk. In the first instance, free space on the disk is reclaimed within the guest operating system. Subsequently, the virtual disk image on the host file system is then reduced in size by the VMware Server software. | ||
+ | |||
+ | In order to be able to perform a shrink operation the virtual disk must not have been created as a ''pre-allocated'' disk and there must be no current snapshots of the virtual machine. For details on converting a pre-allocated disk to a growable disk refer to the chapter entitled [[Command Line Management of VMware Virtual Disks]]. | ||
+ | |||
+ | If the virtual disk is an ''independent'' disk it must be in ''persistent mode''. In the case of Linux guest operating systems, the operation must be performed as superuser. | ||
== Removing a VMware Server Virtual Disk == | == Removing a VMware Server Virtual Disk == | ||
+ | |||
+ | Virtual disks are removed using the VI Web Access interface. As with previous tasks, any virtual machines which access the virtual disk must first be powered off. Assuming this to be case, select the virtual machine to which the disk is attached from the ''Inventory'' panel, click on the disk drive in the ''Hardware'' panel and select either ''Remove'' or ''Delete from disk''. The ''Remove'' option simply removes the disk from the configuration of the currently selected virtual machine. The physical ''.vmdk'' file which represents the virtual disk remains intact in the datastore in which it was created and is available for use by other virtual machines. | ||
+ | |||
+ | The ''Delete from disk'' option, on the other hand, both removes the disk from the configuration of the select virtual machine and also physically removes the ''.vmdk'' file from the datastore. As such the disk is no longer available and the space it used is released. | ||
+ | |||
+ | |||
+ | <htmlet>vmware</htmlet> |
Latest revision as of 18:49, 29 May 2016
Previous | Table of Contents | Next |
VMware Server 2.0 DHCP Configuration | Command Line Management of VMware Virtual Disks |
Purchase and download the full PDF and ePub editions of this VMware eBook for only $8.99 |
Rather than using a physical disk drive to store the system and user files for a guest operating system, VMware Server virtual machines use files (known as virtual disks) located on the disk drives attached to the host system.
The objective of this chapter is to provide an overview of the creation, management and configuration of virtual disks.
VMware Server Virtual Disk and Device Types
Virtual disks provide the storage for guest operating system and user files. Each VMware Server virtual machine will likely have one or more virtual disks configured and during the lifecycle of a virtual machine virtual disks may be added and removed as needed. The size of a virtual disk is specified at creation time and can range from 1MB up to a maximum of 950GB.
When a virtual disk is first created (either during the virtual machine creation process or later) it may be configured as growable or pre-allocated. The virtual disk type may subsequently be converted using the vmware-vdiskmanager command line tool as described in the chapter entitled Command Line Management of VMware Virtual Disks. A growable disk is initially created smaller than the specified disk size, and subsequently grows as space is needed up until the maximum specified size is reached. This has the advantage that the disk creation process is shorter and less disk space on the host is used initially. A further advantage of growable disks is that the size of the disk can be reduced at a later time using the VMware Tools Shrink Disk feature (see the chapter entitled The VMware Tools Control Panel for more details on this and other VMware Tools features). These features, however, come at the cost of reduced performance (since system resources will be needed to increase the size of the disk as additional data is written).
In the case of a pre-allocated virtual disk, the entire space required for the disk is allocated at creation time. This has the advantage that virtual disk performance is not degraded due to the need to increase the disk size as more space is needed. Disadvantages include an increased amount of time needed to create the disk (taking several hours for a 950GB virtual disk) and the inability to reduce the size of the disk at a later time unless the disk is converted to growable.
An additional option allows virtual disks to be split amongst multiple 2GB files on the host, rather than contained in a single file. This option has little benefit unless VMware Server is hosted on a file system which limits file sizes to 2GB.
To the guest operating system running inside a virtual machine, virtual disks appear as though they are physical devices. As such, the disk can be configured to appear to the virtual machine as either an IDE or SCSI device. In the case of SCSI virtual disks, VMware uses a virtual SCSI controller which appears to the guest as either an LSI Logic or BusLogic controller. As such, guest operating system hardware drivers for these devices may need to be installed accordingly.
VMware Server Disk Modes
VMware Server virtual disks may be configured to run in Independent mode which provides two additional options in terms of disk configuration:
- Persistent - Data written to the disk by the guest operating system is retained when the system is powered off. This is the normal mode of operation for most virtual disks.
- Nonpersistent - Data written to the disk during a virtual machine session are discarded after the virtual machine is powered off or reset. This is useful if the guest operating system is required to be started with a clean system each time the virtual machine is powered on, perhaps in a testing or secure environment.
Disks configured as independent are not included in snapshots.
VMware Server Virtual Disk Caching Options
The disk write caching policy for virtual disks defines the point at which new data is written to the virtual disk (as opposed to being cached in memory before being written) by the guest operating system. These settings have implications for performance, with increased performance being available at the cost of data integrity. A choice of two policy options is available:
- Optimize for safety - Data is not cached. Write operations made by the guest operating system are written immediately to the virtual disk image. Reduces risk of data loss in the event of a system failure, but results in slower disk write performance.
- Optimize for performance - Write operations performed by the guest operating system are initially cached prior to being written to the virtual disk. Provides increased write performance at the cost of increased risk of data loss in the event of a system failure.
Adding a New Virtual Disk
A new virtual disk may be added to a virtual machine via the VI Web Access management interface (details of which are covered in the A Guided Tour of the VMware Server 2.0 Infrastructure Web Access Interface chapter of this book). SCSI based virtual disks may be installed on running virtual machines as long as those machines are running on VMware virtual hardware version 7 or later (the default setting when virtual machines are created in VMware Server 2.0). IDE based virtual disks or virtual machines running on older versions of the virtual hardware require that the virtual machine be powered off prior to the addition of a new virtual disk.
Once logged into the VI Web Access interface, the first step in adding a new virtual disk is to select the required virtual machine from the Inventory panel. In the Commands section of the virtual machine workspace, click on the Add Hardware link to invoke the Add Hardware Wizard as illustrated in the following figure:
To add a new virtual disk, select the Hard Disk option from the list of new hardware devices to proceed to the Hard Disk page. Options are available to either create an entirely new virtual disk, or to use an existing virtual disk that may already have been created for a pre-existing virtual machine. In fact, this second option can be used to enable multiple virtual machines to share a virtual disk, although careful steps should be taken to avoid disk write conflicts (for example both guests attempting to write simultaneously to the same disk block will likely cause problems for most standard file systems).
Once a decision has been made about creating or re-using a virtual disk, the next wizard screen provides the option to configure the disk type, mode and caching options as described in the preceding sections of this chapter. Finally, a summary page is displayed highlighting the choices made during the configuration process. Clicking the Finish button will begin the addition process which, depending on the settings, may take some time to complete.
Modifying a VMware Server Virtual Disk Configuration
The current configuration of a virtual disk may be viewed and modified by logging into the VI Web Access interface and selecting the virtual machine to which the disk is attached from the Inventory panel. Once the workspace updates to reflect the selected virtual machine, locate the disk drive from the Hardware panel, click on it and select Edit... from the menu. This will display the hard disk settings dialog as illustrated in the following figure:
An important point to note is that many of the settings will be read-only (and consequently grayed out) if the selected virtual machine, or any other virtual machine which shares the disk, is currently powered on. In addition, the Increase capacity... link shown in the above figure will not be visible if the virtual machine is powered on. To make changes to configuration values, or to increase disk capacity, it will be necessary to power off all virtual machines that utilize the virtual disk.
Enlarging a VMware Server Virtual Disk
The capacity of a virtual disk may be increased using the disk settings dialog (described above). As with most other virtual disk settings, a disk may only be increased in size when all virtual machines sharing the disk are powered off. Once this is achieved, select a virtual machine which uses the virtual disk from the Inventory panel of the VI Web Access interface, click on the required hard disk from the Hardware panel and select Edit... from the menu. Once the disk settings dialog appears, click on the Increase capacity... link to display the disk capacity fields as illustrated in the following figure:
The current size of the virtual disk is listed, together with two text boxes for the amount by which the disk is to be increased and the new capacity. Both are specified in gigabytes (GB), and either may be used to increase the size of the virtual disk. The amount of space available for allocation to the virtual disk is dictated by the available space on the datastore in which the virtual disk file resides. The current free space on the datastore is also listed beneath the capacity text boxes. The increase in virtual disk capacity cannot exceed this value.
Shrinking a VMware Server Virtual Disk
Unlike increasing the capacity of virtual disks, which is performed outside the virtual machine using the VI Web Access interface, virtual disks can only be reduced in capacity from within the virtual machine's guest operating system and requires the installation of VMware Tools. If VMware Tools are not currently installed on the guest operating system, begin by reading the chapter entitled Understanding and Installing VMware Tools.
Once VMware Tools are installed into the guest operating system, the next step is to access the VMware Tools Control Panel. The default configuration for VMware Tools on Windows should have placed a VMware Tools icon in the Windows notification area in the bottom right hand corner of the Windows task bar (where the date and time are typically displayed) and also as an icon in the Windows Control Panel (accessed via Start->Control Panel). Double clicking on either of these options will invoke the control panel.
To invoke the VMware Tools control panel on Linux and Solaris systems, simply execute the following at a command-line prompt:
/usr/bin/vmware-toolbox&
The "Shrink" tab of the VMware Tools control panel allows virtual disks associated with the virtual machine to be reduced in size by reclaiming unused areas on the disk. In the first instance, free space on the disk is reclaimed within the guest operating system. Subsequently, the virtual disk image on the host file system is then reduced in size by the VMware Server software.
In order to be able to perform a shrink operation the virtual disk must not have been created as a pre-allocated disk and there must be no current snapshots of the virtual machine. For details on converting a pre-allocated disk to a growable disk refer to the chapter entitled Command Line Management of VMware Virtual Disks.
If the virtual disk is an independent disk it must be in persistent mode. In the case of Linux guest operating systems, the operation must be performed as superuser.
Removing a VMware Server Virtual Disk
Virtual disks are removed using the VI Web Access interface. As with previous tasks, any virtual machines which access the virtual disk must first be powered off. Assuming this to be case, select the virtual machine to which the disk is attached from the Inventory panel, click on the disk drive in the Hardware panel and select either Remove or Delete from disk. The Remove option simply removes the disk from the configuration of the currently selected virtual machine. The physical .vmdk file which represents the virtual disk remains intact in the datastore in which it was created and is available for use by other virtual machines.
The Delete from disk option, on the other hand, both removes the disk from the configuration of the select virtual machine and also physically removes the .vmdk file from the datastore. As such the disk is no longer available and the space it used is released.
Purchase and download the full PDF and ePub editions of this VMware eBook for only $8.99 |