# Resizing the Vmware VMDK Through Ansible script

**URL:** <https://forum.ansible.com/t/resizing-the-vmware-vmdk-through-ansible-script/33124>\
**Category:** Ansible Project\
**Tags:** vmware\
**Created:** [June 9, 2020, 6:18am UTC](https://forum.ansible.com/t/resizing-the-vmware-vmdk-through-ansible-script/33124 "2020-06-09T06:18:15Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![JC\_JC](https://avatars.discourse-cdn.com/v4/letter/j/9fc348/32.png) [@JC\_JC](https://forum.ansible.com/u/JC_JC)\
**Post date:** [June 9, 2020, 6:18am UTC](https://forum.ansible.com/t/resizing-the-vmware-vmdk-through-ansible-script/33124/1 "2020-06-09T06:18:15Z")

</div>

Hi Team,

I’m looking for ansible script to resize my Existing Virtual machine Primary Hard disk (VMDK).

Cheers

Shiva Shankar S

---

<div class="post-metadata">

**Author:** ![Akasurde](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/akasurde/32/230_2.png) [@Akasurde](https://forum.ansible.com/u/Akasurde)\
**Post date:** [June 9, 2020, 11:05am UTC](https://forum.ansible.com/t/resizing-the-vmware-vmdk-through-ansible-script/33124/2 "2020-06-09T11:05:36Z")

</div>

Hi Shiva,

You can do like this -

---

<div class="post-metadata">

**Author:** ![JC\_JC](https://avatars.discourse-cdn.com/v4/letter/j/9fc348/32.png) [@JC\_JC](https://forum.ansible.com/u/JC_JC)\
**Post date:** [June 10, 2020, 5:13am UTC](https://forum.ansible.com/t/resizing-the-vmware-vmdk-through-ansible-script/33124/3 "2020-06-10T05:13:37Z")

</div>

HI Abhijeet,

Thanks a lot for your script, I need one more help that after VM HDD space increased on VM level, we need to perform some task on OS level to see the additional disk space, do you have any ansible script or any help from you.

Cheers  
Shiva Shankar S

---

<div class="post-metadata">

**Author:** ![Akasurde](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/akasurde/32/230_2.png) [@Akasurde](https://forum.ansible.com/u/Akasurde)\
**Post date:** [June 10, 2020, 5:18am UTC](https://forum.ansible.com/t/resizing-the-vmware-vmdk-through-ansible-script/33124/4 "2020-06-10T05:18:02Z")

</div>

What kind of tasks do you need to run on the OS level? You can either use `vmware_vm_shell` to run command or add that VM as ansible host using `add_host` and run command in subsequent plays.

---

<div class="post-metadata">

**Author:** ![Tony\_Wong](https://avatars.discourse-cdn.com/v4/letter/t/3ab097/32.png) [@Tony\_Wong](https://forum.ansible.com/u/Tony_Wong)\
**Post date:** [June 10, 2020, 12:14pm UTC](https://forum.ansible.com/t/resizing-the-vmware-vmdk-through-ansible-script/33124/5 "2020-06-10T12:14:49Z")

</div>

Interested in this too. I got a windows VM with only C drive. I want to resize from 60GB to 70GB

how do i set up the playbook

---

<div class="post-metadata">

**Author:** ![Duy\_Huynh\_D](https://avatars.discourse-cdn.com/v4/letter/d/dbc845/32.png) [@Duy\_Huynh\_D](https://forum.ansible.com/u/Duy_Huynh_D)\
**Post date:** [February 14, 2023, 7:30am UTC](https://forum.ansible.com/t/resizing-the-vmware-vmdk-through-ansible-script/33124/6 "2023-02-14T07:30:28Z")

</div>

Dear Abhijeet Kasurde,

Thanks a lot for your script, the disk upgrade on vcenter was successful but windows os can’t boot again (blue screen) after disk is expanded by script

I am using ansible 2.10.8, vcenter 8  
Please help me !

 ![winboot error.jpg](https://us1.discourse-cdn.com/ansible/original/2X/6/6dd29fb2b8b9d397cc99b00aca330f20eaa2dc1e.jpeg)

Vào lúc 19:15:19 UTC+7 ngày Thứ Tư, 10 tháng 6, 2020, Tony Wong đã viết:

---

<div class="post-metadata">

**Author:** ![Thanh\_Nguyen\_Duc](https://avatars.discourse-cdn.com/v4/letter/t/c89c15/32.png) [@Thanh\_Nguyen\_Duc](https://forum.ansible.com/u/Thanh_Nguyen_Duc)\
**Post date:** [February 14, 2023, 8:50am UTC](https://forum.ansible.com/t/resizing-the-vmware-vmdk-through-ansible-script/33124/7 "2023-02-14T08:50:31Z")

</div>

I don’t think vmware support to resize the disk by decrease the volume size directly. Likely the disk shrink already removed some file systems from OS and cause the OS not able to boot up.

Thanks and Best Regards,

Thanh.
