VMware Cloud Community
T1berious
Contributor
Contributor

Move-HardDisk Format Change question

Hi,

I hope someone can point me in the direction where I'm going wrong. I've got a few disk moves that I'm trying to automate. For the most part they work fine it's just when changing the Storage Format it's going wrong Smiley Sad

Here's the code:

$DST = Get-Datastore -Name 'DataStore1'

# Define Target VM and Target Disk
$Disk = Get-VM -Name "VM1" | Get-HardDisk -Name "Hard Disk 1"

Move-HardDisk -HardDisk $Disk -Datastore $DST -StorageFormat Thick -Confirm:$false

The disk is currently EagerZeroedThick but via the script I managed to change it from Thick to EagerZeroedThick but it refuses to change back using -StorageFormat Thick.

Where am I going wrong?

Thanks in advance

T1b


Tags (4)
Reply
0 Kudos
6 Replies
RvdNieuwendijk
Leadership
Leadership

You have to move the hard disk to another datastore to change the format. Do you move the disk to another datastore? If you specify the datastore the disk is currently on, then it doesn't change the format.

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition
Reply
0 Kudos
T1berious
Contributor
Contributor

Hi,

Yes, I'm moving a test machine form Datastore1 to Datastore2, the initial move from DataStore1 to DataStore2 I changed the disk format from Thick to EagerZeroedThick just moving back it refuses to change format.

Just a bit stumped as this is something I'd like to run as a scheduled task Smiley Sad

Reply
0 Kudos
LucD
Leadership
Leadership

Are those datastores by any chance NFS datastores with Hardware Acceleration enabled ?

And is this on a ESX 5.0 system ?


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

Reply
0 Kudos
T1berious
Contributor
Contributor

Hi Luc,

All the datastores are VMFS 5.54 on a HP EVA SAN, ESX version is 5.0.0 1117897.

Odd that it went fine from Thick to EagerZeroedThick but not the other way around Smiley Sad

(Fan of the book by the way Smiley Happy)


Reply
0 Kudos
LucD
Leadership
Leadership

Thanks Heart

Strange indeed, I'm afraid I don't have an explanation for that behavior right now.

I can't reproduce it, and I don't have a HP EVA around for further testing :smileycry:


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

Reply
0 Kudos
T1berious
Contributor
Contributor

Not a prob,

I just wanted to check I wasn't going mad. Had to do it manually but just liked the idea of scripting bulk changes and formats.

Many thanks,

T1b

Reply
0 Kudos