IT tutorials
 
Technology
 

Windows Server 2012 : Deploying and configuring virtual machines (part 3) - Configuring virtual machines - Adding virtual disks

4/18/2014 1:10:28 AM
- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019

3. Configuring virtual machines

Once you have created a virtual machine, you might need to further configure its virtual hardware and management settings. You can do this either by opening the virtual machine’s settings in Hyper-V Manager or by using Windows PowerShell. For example, to view or modify the settings for a virtual machine using Hyper-V Manager, right-click on the virtual machine and select Settings. Doing this displays a Settings dialog such as the one shown in Figure 2.

Configuring virtual hardware for a virtual machine.
Figure 2. Configuring virtual hardware for a virtual machine.

To view the settings of the same virtual machine using Windows PowerShell, you can use the Get-VM cmdlet as shown here:

PS C:\> Get-VM -Name SRV-A | Format-List *

VMName : SRV-A
VMId : cabb9f25-1d4a-4ce0-884a-a04520ed0880
Id : cabb9f25-1d4a-4ce0-884a-a04520ed0880
Name : SRV-A
State : Off
OperationalStatus : {Ok}
PrimaryOperationalStatus : Ok
SecondaryOperationalStatus :
StatusDescriptions : {Operating normally}
PrimaryStatusDescription : Operating normally
SecondaryStatusDescription :
Status : Operating normally
Heartbeat :
ReplicationState : Disabled
ReplicationHealth : NotApplicable
ReplicationMode : None
CPUUsage : 0
MemoryAssigned : 0
MemoryDemand : 0
MemoryStatus :
SmartPagingFileInUse : False
Uptime : 00:00:00
IntegrationServicesVersion :
ResourceMeteringEnabled : False
ConfigurationLocation : C:\ProgramData\Microsoft\Windows\Hyper-V
SnapshotFileLocation : C:\ProgramData\Microsoft\Windows\Hyper-V
AutomaticStartAction : StartIfRunning
AutomaticStopAction : Save
AutomaticStartDelay : 0
SmartPagingFilePath : C:\ProgramData\Microsoft\Windows\Hyper-V
NumaAligned :
NumaNodesCount : 1
NumaSocketCount : 1
IsDeleted : False
ComputerName : HOST4
Notes :
Path : C:\ProgramData\Microsoft\Windows\Hyper-V
CreationTime : 8/13/2012 8:16:47 AM
IsClustered : False
SizeOfSystemFiles : 28464
ParentSnapshotId :
ParentSnapshotName :
MemoryStartup : 1073741824
DynamicMemoryEnabled : False
MemoryMinimum : 536870912
MemoryMaximum : 1099511627776
ProcessorCount : 1
RemoteFxAdapter :
NetworkAdapters : {Network Adapter}
FibreChannelHostBusAdapters : {}
ComPort1 : Microsoft.HyperV.PowerShell.VMComPort
ComPort2 : Microsoft.HyperV.PowerShell.VMComPort
FloppyDrive : Microsoft.HyperV.PowerShell.VMFloppyDiskDrive
DVDDrives : {DVD Drive on IDE controller number 1 at location 0}
HardDrives : {Hard Drive on IDE controller number 0 at location 0}
VMIntegrationService : {Time Synchronization, Heartbeat, Key-Value Pair Exchange, Shutdown...}

To modify these virtual machine settings, you can use the Set-VM cmdlet and other Hyper-V cmdlets. In the sections that follow, we will examine only a few of these different virtual machine settings and how to configure them. For additional information on configuring virtual machine settings, search the TechNet Library for the appropriate topic.

3.1 Adding virtual disks

You can use the IDE Controller 0, IDE Controller 1, and SCSI Controller pages of the virtual machine settings dialog box in Hyper-V Manager to add new virtual disks to a virtual machine. You can also use subpages of these pages to inspect, browse, or edit an existing virtual hard disk; remove a virtual disk that is attached to the virtual machine; or attach a physical disk on the host’s storage system to the virtual machine.

When you add a virtual disk using the New Virtual Hard Disk Wizard, you have a choice of using either the VHDX or VHD format for the new disk. (The default is VHDX.) The new Virtual Hard Disk Wizard also lets you configure a name for the new disk, the disk type (with the default being dynamically expanding), the maximum size for the disk (with the default being 127 GBs), and whether the new disk should be blank or contain the data on a physical disk on the host or on an existing virtual disk, as shown in Figure 3.

Configuring a new virtual disk to copy its data from a physical disk on the host.
Figure 3. Configuring a new virtual disk to copy its data from a physical disk on the host.

You can also use the Add Hardware page of the virtual machine settings dialog box to add additional SCSI controllers to your virtual machine so that you can connect more virtual disks to the virtual machine.

You can also use Windows PowerShell to create new virtual disks and add them to your virtual machines. For example, let’s say you want to create and attach a 500-GB dynamically expanding data disk to virtual machine SRV-A on HOST4. You can begin by using the Get-VHD command to display a list of disks attached to SRV-A as follows:

PS C:\> Get-VM -VMName SRV-A | Select-Object VMId | Get-VHD | `
Format-List Path,VhdFormat,VhdType,Size

Path : C:\Users\Public\Documents\Hyper-V\Virtual Hard Disks\SRV-A.vhdx
VhdFormat : VHDX
VhdType : Dynamic
Size : 536870912000

The preceding command takes advantage of the pipeline capabilities of Windows PowerShell and works like this:

  1. The command Get-VM –VMName SRV-A returns an object representing virtual machine SRV-A.

  2. The output of the preceding command is then piped into the command Select-Object VMId, which returns an object representing the GUID for SRV-A.

  3. The GUID for SRV-A is then piped into the Get-VHD command to indicate which virtual machine is to be queried for its virtual disks.

  4. The output of the Get-VHD command is then formatted as a list to display only those properties of interest—namely, the path and file name of the virtual disk file, the format it uses, the type of the disk, and the disk’s size.

Next you can use the New-VHD cmdlet to create the new data disk as follows:

PS C:\> New-VHD -SizeBytes 500GB `
-Path "C:\Users\Public\Documents\Hyper-V\Virtual Hard Disks\SRV-A-data.vhdx"

ComputerName : HOST4
Path : C:\Users\Public\Documents\Hyper-V\Virtual Hard Disks\SRV-A-data.vhdx
VhdFormat : VHDX
VhdType : Dynamic
FileSize : 4194304
Size : 536870912000
...

Next you can use the Add-VMHardDiskDrive cmdlet to attach the new data disk to location 1 on IDE controller 0 as follows:

PS C:\> Add-VMHardDiskDrive -VMName SRV-A `
-Path "C:\Users\Public\Documents\Hyper-V\Virtual Hard Disks\SRV-A-data.vhdx" `
-ControllerType IDE -ControllerNumber 0 -ControllerLocation 1

You can then use the Get-VHD cmdlet as before to verify the result:

PS C:\> Get-VM -VMName SRV-A | Select-Object VMId | Get-VHD | `
Format-List Path,VhdFormat,VhdType,Size

Path : C:\Users\Public\Documents\Hyper-V\Virtual Hard Disks\SRV-A.vhdx
VhdFormat : VHDX
VhdType : Dynamic
Size : 536870912000

Path : C:\Users\Public\Documents\Hyper-V\Virtual Hard Disks\SRV-A-data.vhdx
VhdFormat : VHDX
VhdType : Dynamic
Size : 536870912000

Alternatively, you can use the Get-VMHardDiskDrive cmdlet to display all disks connected to the IDE controllers on the virtual machine:

PS C:\> Get-VMHardDiskDrive -VMName SRV-A | `
Format-List ControllerNumber,ControllerLocation,Path

ControllerNumber : 0
ControllerLocation : 0
Path : C:\Users\Public\Documents\Hyper-V\Virtual Hard Disks\SRV-A.vhdx

ControllerNumber : 0
ControllerLocation : 1
Path : C:\Users\Public\Documents\Hyper-V\Virtual Hard Disks\SRV-A-
data.vhdx

Viewing the IDE 0 Controller page and its subpages in the Settings dialog box for the virtual machine also confirms that the procedure was successful.

 
Others
 
- Windows Server 2012 : Deploying and configuring virtual machines (part 2) - Creating virtual machines
- Windows Server 2012 : Deploying and configuring virtual machines (part 1) - Planning virtual machine deployment
- Sharepoint 2013 : Manage Tags and Notes
- Sharepoint 2013 : Follow Colleagues to See What They Are Posting
- Sharepoint 2013 : Use Microblogging to Let Others Know What You Are Doing or Thinking
- Sharepoint 2013 : Get Started with Social Features
- Windows 8 : Working with backup and restoration (part 4) - Two new methods of restoration and recovery
- Windows 8 : Working with backup and restoration (part 3) - Restoring an entire computer, Using System Restore for less invasive troubleshooting
- Windows 8 : Working with backup and restoration (part 2) - Protecting files and data by using File History
- Windows 8 : Working with backup and restoration (part 1) - Backing up Windows 8, Creating additional images
 
 
Top 10
 
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
Technology FAQ
- Is possible to just to use a wireless router to extend wireless access to wireless access points?
- Ruby - Insert Struct to MySql
- how to find my Symantec pcAnywhere serial number
- About direct X / Open GL issue
- How to determine eclipse version?
- What SAN cert Exchange 2010 for UM, OA?
- How do I populate a SQL Express table from Excel file?
- code for express check out with Paypal.
- Problem with Templated User Control
- ShellExecute SW_HIDE
programming4us programming4us