The dpmhv-setVMDisk command lets you create a drive or disk on a drive controller. You can use the option to connect/disconnect an image.
This command has the following format:
dpmhv-setVMDisk -host hostname -vm vmname|-vmid vmguid [-path pathname] -drive{HDD,DVD} -type{scsi,ide}[-id id] [-lun lun] [-retval] [-silent]
Specifies the name of the Hyper-V server host.
Specifies the name of the VM.
Specifies the unique ID of the VM.
(Optional) Specifies the path where the drive or disk is created on a drive controller.
Specifies the drive type that you want to assign to the VM. You can assign the following drive types:
Represents the hard drive
Represents the drive of either Compact Disk (CD) or Digital Video Disk (DVD).
Specifies the controller type that you want to attach to the virtual hard disk of the VM. Hyper-V supports the following two types:
Specify the controller type as SCSI.
Specify the controller type as IDE.
(Optional) Specifies the ID of the controller mentioned in the controller type. For controller type IDE, the value is 0 or 1. For SCSI, the value is 0,1,2, or 3 based on the number of SCSI controllers added to the VM. If no id (or -1) is specified the command chooses the first controller of the specified type that has a channel available.
Default:
-1
(Optional) Specifies the logical unit of the controller in the form of <type> and <id>. For IDE, value is 0 or 1, for SCSI it is including the limit [0, 63]. If no unit number (or
-1) is specified, the command chooses the available channel on the specified controller.
Default:
-1
Returns a value for further processing.
Specifies not to direct the output to the screen.
Example: Create a Virtual Drive on a SCSI Controller
This example attaches a virtual hard drive image file to the first channel on the first SCSI controller.
dpmhv-setVMDisk -host hvserver -vm TestVM -type scsi -id 0 -lun 0 -drive HDD -path c:\VHDs\disk.vhd
Example: Attach a DVD to a VM
This example attaches a physical DVD-ROM drive to the VM, "Test VM."
dpmhv-setVMDisk -host hvserver -vm TestVM -type ide -id 0 -lun 1 -drive DVD -path D:
Example: Attach a Physical Host Disk to a SCSI Controller
This example gets the physical host disks and attaches them to the first available SCSI channel.
pd=dpmhv-getPhysDisks -host hvserver -retval -silent
dpmhv-setVMDisk -host hvserver -vm TestVM -type scsi -drive HDD -path (pd[0].Path)
Copyright © 2013 CA. All rights reserved. |
|