VMware Cloud Community
Marcel00M
Contributor
Contributor

growing disk and filesystem of a windows VM (systemdrive)

Hi,

I want to grow the systemdrive of an Windows 2003 VM

I got that example from get-help  :

C:\PS>Get-HardDisk -VM $myVM | Set-HardDisk -Persistence "IndependentNonPersistent"

Extends a hard disk with the specified capacity. The command also extends the disk on the guest OS.


The following Command string rezises the disk but not the filsytem on the Windows 2003 VM.

(It also does not grow the d drives filsystem when i use it. In both cases with no error message. No matter if the VM is powered of or on.)

Get-VM MYVM | Get-Harddisk | where {$_.Name -eq "Hard disk 1"} | Set-Harddisk -CapacityKB 20485760 -HostCredential $hostCred -GuestCredential $guestCred

Also that command (using a helper vm) runs without an error, but also do not grow the filsytem on the Windows 2003 VM.

Get-VM QDEAJJ | Get-Harddisk | where {$_.Name -eq "Hard disk 1"} | Set-Harddisk -CapacityKB 22485760 -HostCredential $hostCred -GuestCredential $guestCred -helpervm MYHelper

Like it is writen here. I have powered of the VM´s http://www.vmware.com/support/developer/PowerCLI/PowerCLI41U1/html/Set-HardDisk.html

But the Helper VM is not powering on, when I run the command. So I tried it with the helper VM powered on and the other VM powered off.

That makes no difference...

What I am doing wrong? Can anyone tell me an code string that works?

I am  sorry But I dont realy understand that credential thing in this context.

GuestCredentialPSCredentialSpecify the PSCredential object that contains the credentials you want to  use in authentication with the guest operating system.

In know   credentials... For example for the VC Login. But I dont realy  understand what kind of object is meant  and  also if I should define  the variable $guestCred elswehre. I found no example in the web. And I  also dont understand wy I  should use a host credential when I am still  connectet to the Virtual  Center VC.

0 Kudos
8 Replies
CRad14
Hot Shot
Hot Shot

To my knowledge I don't think anything done in VMware will extend a disk inside the guest OS

Yes, the guest OS will have a bigger disk, however it won't be able to use it until you actually extend it inside of windows.


I also know that Server 2003 is more difficult than 2008, and I think that if you are extending a existing disk inside of Win 2003 you have to use additional partitioning tools....


However LucD may come along and have a one-liner that will do it...I just thought it could not be done through vmware/powercli....

Conrad www.vnoob.com | @vNoob | If I or anyone else is helpful to you make sure you mark their posts as such! 🙂
0 Kudos
LucD
Leadership
Leadership

Which PowerCLI build are you using ? 5.0.1 ?


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

0 Kudos
Marcel00M
Contributor
Contributor

[vSphere PowerCLI] C:\> Get-VIToolkitVersion

PowerCLI Version

----------------

VMware vSphere PowerCLI 4.0 U1 build 208462

##############

[vSphere PowerCLI] C:\> get-view -ViewType HostSystem -Property Name,Config.Product | select Name,{

}

Name                                                           $_.Config.Product.FullName

----                                                           --------------------------

10.229.191.217                                                 VMware ESX 4.0.0 build-261974

10.229.191.218                                                 VMware ESX 4.0.0 build-261974

10.229.191.213                                                 VMware ESX 4.0.0 build-261974

10.229.191.164                                                 VMware ESX 4.0.0 build-261974

10.229.191.165                                                 VMware ESX 4.0.0 build-261974

10.229.191.182                                                 VMware ESX 4.0.0 build-261974

10.229.191.184                                                 VMware ESX 4.0.0 build-261974

10.229.191.214                                                 VMware ESX 4.0.0 build-261974

10.229.191.215                                                 VMware ESX 4.0.0 build-261974

10.229.191.219                                                 VMware ESX 4.0.0 build-261974

10.229.191.216                                                 VMware ESX 4.0.0 build-261974

10.229.191.183                                                 VMware ESX 4.0.0 build-261974

[vSphere PowerCLI] C:\> get-view -ViewType HostSystem -Property Name,Config.Product | foreach {$_.N

10.229.191.217

Name                  : VMware ESX

FullName              : VMware ESX 4.0.0 build-261974

Vendor                : VMware, Inc.

Version               : 4.0.0

Build                 : 261974

LocaleVersion         : INTL

LocaleBuild           : 000

OsType                : vmnix-x86

ProductLineId         : esx

ApiType               : HostAgent

ApiVersion            : 4.0

InstanceUuid          :

LicenseProductName    : VMware ESX Server

LicenseProductVersion : 4.0

DynamicType           :

DynamicProperty       :

0 Kudos
Realitysoft
Enthusiast
Enthusiast

You can use a tiny application produced by Dell (extpart.exe) it works for OS partition Smiley Happy

Thanks, Jim
Marcel00M
Contributor
Contributor

bingo *g*

Thank You! Works well  (and importand for me: it can be used via command line/script )

0 Kudos
Marcel00M
Contributor
Contributor


I had another idea for an workaoround. Its obsolet with the dell tool. But I testest it and it would also work (but is more complicatet, cost mucch mor time and need a downtime of the vm)


New-HardDisk -VM $HELPERVM-DiskPath  "[Store] ORGVM/ORGVM_c.vmdk"


start-vm $HELPER
##
#Helper VM runs script via sheduled task at each boot that exends drive e: via diskpart
#DiskPart -s C:\temp\diskpart_steuerdatei.txt
#C:\Windows\system32\shutdown.exe -r -f

#content Steuerdatei.txt:

#select disk 3
#select partition 1
#EXTEND
#exit

#
sleep 230

get-vm $HELPERVM | shutdown-vmguest -confirm:$false
sleep 30

Get-VM $HELPERVM  | Get-Harddisk | where {$_.Name -eq "Hard disk 4"} | remove-harddisk -confirm:$false

0 Kudos
Marcel00M
Contributor
Contributor

Thank You all for Your posts. Time to shutdown the notebook and go to bed Smiley Happy

0 Kudos
Realitysoft
Enthusiast
Enthusiast

Sleep is good well done! Smiley Happy

Thanks, Jim
0 Kudos