Using PowerCLI to Increase VMDK (Virtual disk) in VMware Virtual Machine

Below oneliner commands I recently used to configure multiple VMware Virtual Machines Hard disk, Task was to grow/extend VMDK virtual disk on more than hundreds of the virtual machine. Below is the main techniques and gist of the article and scripts. These one-liner commands also include the commands to get the disk related inventory so I can gather in the excel file, If I need bulk operations. Here I have first command which shows information about Name of the hard disk drive, CapacityGB, FileName, In the list I want to increase the capacity of hard disk 2. 

Get-VM vm01 | Get-Harddisk | Select Name, CapacityGB, FileName

Once I know which hard disk drive I want to increase, There should be enough space on the datastore if you are going to extend VMDK. You can run Get-Datastore and get the information. and running Move-VM can be used to Storage VMotion vm or its disks to another datastore. Here I have enough disk space and I can easily extend the drive on same datastore. To know the the first one datastore with most free disk space.

Get-Cluster Cluster01 | Get-Datastore | Sort-Object -Property FreeSpaceGB -Descending | Select -First 1

Next command is I am listing the Hard Disk from VM which need to be increased.

Get-VM vm01 | Get-HardDisk -Name 'Hard disk 2'

vmware vsphere virtual machine vm extend increase virtual disk hard disk drive vmdk Get-VM Get-Harddisk, get-cluster, get-Datastore .png

Once I verify everything what i need to do and everything is good and I can easily grow the virtual disk, Below command will expand the drive.

Get-VM vm01 | Get-HardDisk -Name 'Hard disk 2' | Set-HardDisk -CapacityGB 8 -Confirm:$false

Although it shows the results but again same result can be verified using cmdlet.

Get-VM vm01 | Get-HardDisk

vmware vsphere esxi virtual machine vm extend increase virtual disk hard disk drive vmdk Get-VM Get-Harddisk, get-cluster, get-Datastore Set-Harddisk datastore.png

Useful Articles
POWERCLI: VMWARE ESXI CONFIGURE (VSWITCH) VMKERNEL NETWORK PORT FOR ISCSI STORAGE
POWERCLI VMWARE: CONFIGURE SOFTWARE ISCSI STORAGE ADAPTER AND ADD VMFS DATASTORE
POWERCLI: VIRTUAL MACHINE STORAGE MIGRATE/SVMOTION AND DATASTORE PORT BINDING MULTIPATHING



via Latest imported feed items on VMware Blogs https://ift.tt/2JuEbEa
RSS Feed

If New feed item from https://blogs.vmware.com/feed, then send me an email at kr

IFTTT

Comments

Popular posts from this blog

Evernote cuts staff as user growth stalls

The best air conditioner

We won't see a 'universal' vape oil cartridge anytime soon