Server 2008 Drives and GUIDs
One of the questions I've been asked a few times is what happens if I want to have lots of disk-volumes on my server - for example I want 50 VMs each with their own volume - I'm going to run out of drive letters. For some time we have been able to use Mount Points where for example a disk is mounted into c:\users - which is not the same as the rest of C:. Server 2008 also exposes disks by GUID and I wanted to show a couple of examples, so which I've done using my memory stick. Normally I'd have a drive letter for my memory stick but if I go into Disk Management I can remove its drive letter and/or mount it into a folder. The MountVol Utility returns the following information.
Possible values for VolumeName along with current mount points are:
\\?\Volume{d1f72a03-d43a-11dc-8bf1-806e6f6e6963}\
C:\ \\?\Volume{d1f72a06-d43a-11dc-8bf1-806e6f6e6963}\
D:\ \\?\Volume{2d018576-d3f9-11dc-9f13-0019b97a962e}\
C:\temp\Kingston\
I can remove the mount point in MountVol with "mountvol c:\temp\kingston /d" (I can add it back in again with mountvol "c:\temp\kingston" [\\?\Volume{2d018576-d3f9-11dc-9f13-0019b97a962e}\](file://\\?\Volume%7B2d018576-d3f9-11dc-9f13-0019b97a962e%7D\) .
If I want to assign a letter to it, the syntax would be mountvol "E:\" "\\?\Volume{2d018576-d3f9-11dc-9f13-0019b97a962e}\" ).
If I remove the all mount points and drive letters then I get this in MountVol
\\?\Volume{2d018576-d3f9-11dc-9f13-0019b97a962e}\
*** NO MOUNT POINTS ***
Either way I can use the device ID in the path for a VHD file in hyper-V (as I understand it clustering is the same - although I haven't checked this)
You can get the information from WMI as well. Here's a quick line of powershell to get and format it.
get-wmiobject -class "Win32_volume" | format-table -autosize name, caption, deviceid
name deviceid
---- --------
C:\ \\?\Volume{d1f72a03-d43a-11dc-8bf1-806e6f6e6963}\
D:\ \\?\Volume{d1f72a06-d43a-11dc-8bf1-806e6f6e6963}\
C:\temp\Kingston\ \\?\Volume{2d018576-d3f9-11dc-9f13-0019b97a962e}\
One of the things I want to is get the volumes which contain VHD files. Using the Get-VMDisk function I showed before, I can use a little more PowerShell (Get-VM, Get-VMDiskList and Get-VMSnapshot have all be explained in earlier posts).
$diskpaths = (get-VMDiskList (get-vm) | foreach {$_.diskpath}) +
(Get-WmiObject -NameSpace "root\virtualization" -class Msvm_VirtualSystemGlobalSettingData |
foreach-object {$_.SnapshotDataRoot ; $_.ExternalDataRoot } | select -unique ) +
(get-vm | get-vmsnapshot| foreach {Get-WmiObject -NameSpace "root\virtualization" -Query "ASSOCIATORS OF {$_} " |
where {$_.ResourceSubType -eq "Microsoft Virtual Hard Disk"} } | foreach {$_.connection})
$vols=&{foreach ($volume in (gwmi Win32_volume)) {if ( (($diskpaths| where{$_ -match $volume.name.replace("\","\\")}) -ne $null) -or
(($diskpaths| where{$_ -match $volume.DeviceID.replace("\","\\")}) -ne $null) ) {$volume} } }
Sooner or later someone is going to take me to task over calling that "Two lines" of powershell. The key piece is that once I know which volumes hold my Hyper-V files I can start thinking about backup...
Technorati Tags: Microsoft,Windows Server 2008,Disk,Storage,Virtualization