VMware Cloud Community
StardustECR
Contributor
Contributor

How to change disk setting 'thick lazy zeroed' to 'eager zeroed thick' by command line (Linux) or API (pyvmomi) from outside of an ESX ?

Hi,

I use Ansible 2.6 and pyvmomi 6.7.0 to create some vm via vSphere 6.0.0.

When I resize disk, I loose 'eager zeroed thick' disk setting.

What is the simplest way to get back to this setting remotly (not from esx server) via API or a Linux command line ?

I prefer another solution than ssh to esx server, then using 'vmkfstool -d zeroedthick...'

Regards.

3 Replies
dbalcaraz
Expert
Expert

And why when you don't create the VM you create the new disk with the right size?

-------------------------------------------------------- "I greet each challenge with expectation"
0 Kudos
continuum
Immortal
Immortal

Step 1 - ESXi:
expand vmdk with guest powered off
Step 2 - ESXi

dd if=/dev/zero of=name-flat.vmdk  bs=1M seek=$(( old size in MB + 1 ))  conv=notrunc
Step 3 - inside Linux-guest after reboot
resize partition
Step 4 - ESXi with powered off Linux
edit vmdk descriptor and remove thin provisioning flag

maybe not necessary : unregister VM and reregister
done

That effectively converts lazy zeroed to eager zeroed:
Original part of the VMDK was already wiped and you just wiped the new part.
Will  vCenter and ESXi  notice it immediatly after the next boot ? - not sure. When ever I did that ESXi had noticed it after a while.
In case you already resized the partition this easy approach will no longer work.
DISCLAIMER: dangerous commands - make sure you know what you are doing !!!!

Ulli


________________________________________________
Do you need support with a VMFS recovery problem ? - send a message via skype "sanbarrow"
I do not support Workstation 16 at this time ...

StardustECR
Contributor
Contributor

I think this is a better way :

Can't run vmkfstools remotly, vSphere 6.0.0

vmkfstools -X 15G -d eagerzeroedthick  /vmfs/volumes/LUN_100/VMNAME/VMNAME.vmdk

But can't figure out the way to do it remotly

0 Kudos