VMware Cloud Community
tdubb123
Expert
Expert

resize hard disk

how can i resize the hard disk on a vm on the vmware side as well as inside the guest os?

get-vm name | get-harddisk -name "Name" | set-harddisk -Capacitykb 10485760 -guestcredential ??

Reply
0 Kudos
7 Replies
AureusStone
Expert
Expert

Hi tdubb.  You can use the Set-Harddisk command.  When you provide credentials for the guest OS it will use VIX to run a batch script to extend the disk on the guest.

http://www.vmware.com/support/developer/PowerCLI/PowerCLI41/html/Set-HardDisk.html


Here is the example provided in the previous link.

Set-HardDisk -HardDisk $harddisk -CapacityKB $extendedCapacity -HostCredential $hostCred -GuestCredential $guestCred

What OS is the guest running.  Some Operating Systems either do not have a extend script, or are not supported by VIX.



If you want to have a look at the scripts go here on any server with PowerCLI installed.

%ProgramFiles%\VMware\Infrastructure\vSphere PowerCLI\Scripts

http://www.amazon.com/VMware-vSphere-PowerCLI-Reference-Administration/dp/0470890797

Reply
0 Kudos
AlbertWT
Virtuoso
Virtuoso

Hi,

IIRC for the WIndows Server 2003 and below it requires restart or not possible. Can you please clarify this if its true ?

on th book page 219 it said that it requires Helper VM, what is that ?

/* Please feel free to provide any comments or input you may have. */
Reply
0 Kudos
tdubb123
Expert
Expert

what is



-HostCredential $hostCred 
-GuestCredential $guestCred?



Reply
0 Kudos
UmeshAhuja
Commander
Commander

Hi,

Kindly go through the below link

very informatory

http://www.geekzilla.co.uk/View18A035DE-06FF-4EA6-BC77-57D431CD50DD.htm

Thanks n Regards
Umesh Ahuja

If your query resolved then please consider awarding points by correct or helpful marking.
Reply
0 Kudos
aravinds3107
Virtuoso
Virtuoso

Login Credentails of your Host and VM

If you find this or any other answer useful please consider awarding points by marking the answer correct or helpful |Blog: http://aravindsivaraman.com/ | Twitter : ss_aravind
Reply
0 Kudos
tdubb123
Expert
Expert

which OS supports the the VIX script? I am trying to resize that on a win7 machine. I was able to change the disk size but the guest os did not resize it

Get-Harddisk -vm name | where {$_.name -eq "Hard disk 2"}| Set-Harddisk -CapacityKB $value -HostCredential $HostCred -GuestCredential $GuestCred -Confirm:$false

Reply
0 Kudos
LucD
Leadership
Leadership

To resize the OS partition you'll need to use the HelperVM parameter on the Set-Harddisk cmdlet.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos