Disk shrink does not work on ESXi guestsHow to reclaim disk space on ESXI 5.0vCenter Converter failing to convert Virtual Server 2005 VMResize Ubuntu Linux system to smaller disk inside VMware ESXiHow do I get Busybox Linux/ESXi 4U1 to recognized expanded RAID 5 disk array?Shrinking physical volumes in LVM on a Linux Guest in ESXi 5.0Does ESXi server power down hard drives when no disk activity is detected?ESXi Server is not showing all the available disk spaceLinux on VMware - why use partitioning?Virtual disk expansionPartial clone of virtual machine in VMwareUsed disk space in ESXi and OS are wildly different

What are the advantages of luxury car brands like Acura/Lexus over their sibling non-luxury brands Honda/Toyota?

Hostile Divisor Numbers

Why does sound not move through a wall?

Is an HNN extension of a virtually torsion-free group virtually torsion-free?

A factorization game

Nested loops to process groups of pictures

What is this weird transparent border appearing inside my Smart Object in Photoshop?

Will 700 more planes a day fly because of the Heathrow expansion?

Feasibility of lava beings?

My first c++ game (snake console game)

Is Benjen dead?

Can you use "едать" and "игрывать" in the present and future tenses?

Are the Night's Watch still required?

Can muons decay into quarks?

Seeing 2 very different execution plans for an UPDATE between test & prod environments

Desolate vs deserted

Why aren't nationalizations in Russia described as socialist?

How to view size of map in lightning component controller?

What is a common way to tell if an academic is "above average," or outstanding in their field? Is their h-index (Hirsh index) one of them?

Using Im[] and Re[] Correctly

Why did the Apollo 13 crew extend the LM landing gear?

Why is "breaking the mould" positively connoted?

Why am I receiving the identity insert error even after explicitly setting IDENTITY_INSERT ON and using a column list?

Can my 2 children, aged 10 and 12, who are US citizens, travel to the USA on expired American passports?



Disk shrink does not work on ESXi guests


How to reclaim disk space on ESXI 5.0vCenter Converter failing to convert Virtual Server 2005 VMResize Ubuntu Linux system to smaller disk inside VMware ESXiHow do I get Busybox Linux/ESXi 4U1 to recognized expanded RAID 5 disk array?Shrinking physical volumes in LVM on a Linux Guest in ESXi 5.0Does ESXi server power down hard drives when no disk activity is detected?ESXi Server is not showing all the available disk spaceLinux on VMware - why use partitioning?Virtual disk expansionPartial clone of virtual machine in VMwareUsed disk space in ESXi and OS are wildly different






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








11















EHLO everyone! My first post on the StackOverflow network :)



We're running some ESXi 5.0/vCenter infrastructure to host mainly Debian 6/amd64 guest systems with ext3 partitions and open-vm-tools compiled from source per debian bug 471784.



Got an issue that is seen being raised all around the internet, but without a conclusive answer given anywhere.



When trying to shrink a thin-provisioned disk in independent-persistent mode, with no snapshots, parents, clones whatsoever, I consistently get the following error:



root@linux64:~# vmware-toolbox-cmd disk list
Shrink disk is disabled for this virtual machine.

Shrinking is disabled for linked clones, parents of linked clones,
pre-allocated disks, snapshots, or due to other factors.
See the User's manual for more information.


(By the way, what are the "other factors", and which of the ton of white papers and technical manuals is the User's manual?:)



I know that I can stuff the partitions with zeros (in fact, I do use shred -fuzn0 when deleting large files) then shut down the guest in question and use various methods like vmkfstools, cloning or vMotioning disks around in thin-provision mode, etc, but all of them either incur the downtime penalty for the guest being shirnked, or result in an unwarranted moving of data between datastores and/or hosts.




And the answer is: No shrinking under ESX/ESXi (as of version 5).



The documentation reads:



IMPORTANT Shrinking disks is not allowed under the following circumstances:



  1. The virtual machine is hosted on an ESX/ESXi server.
    ESX/ESXi Server can shrink the size of a virtual
    disk only when a virtual machine is exported. The space occupied by
    the virtual disk on the ESX/ESXi server, however, does not change.


  2. The virtual machine has a Mac guest operating
    system.


  3. You preallocated all the disk space to the virtual
    disk when you created it.


  4. The virtual machine contains a snapshot.


  5. The virtual machine is a linked clone or the
    parent of a linked clone.


  6. The virtual disk is an independent disk in
    nonpersistent mode.


  7. The file system is a journaling file system, such
    as an ext4, xfs, or jfs file system.


No wonder there is an option to shrink in VMWare Workstation but not in vSphere client connected to an ESXi or vCenter instance.










share|improve this question



















  • 2





    could you show a value of the isolation.tools.diskShrink.disable key which can be found on the vmx file?

    – cikuraku
    Jun 13 '12 at 9:28






  • 1





    It wasn't there. Adding isolation.tools.diskShrink.disable="false" didn't change anything.

    – NekojiruSou
    Jun 13 '12 at 9:43

















11















EHLO everyone! My first post on the StackOverflow network :)



We're running some ESXi 5.0/vCenter infrastructure to host mainly Debian 6/amd64 guest systems with ext3 partitions and open-vm-tools compiled from source per debian bug 471784.



Got an issue that is seen being raised all around the internet, but without a conclusive answer given anywhere.



When trying to shrink a thin-provisioned disk in independent-persistent mode, with no snapshots, parents, clones whatsoever, I consistently get the following error:



root@linux64:~# vmware-toolbox-cmd disk list
Shrink disk is disabled for this virtual machine.

Shrinking is disabled for linked clones, parents of linked clones,
pre-allocated disks, snapshots, or due to other factors.
See the User's manual for more information.


(By the way, what are the "other factors", and which of the ton of white papers and technical manuals is the User's manual?:)



I know that I can stuff the partitions with zeros (in fact, I do use shred -fuzn0 when deleting large files) then shut down the guest in question and use various methods like vmkfstools, cloning or vMotioning disks around in thin-provision mode, etc, but all of them either incur the downtime penalty for the guest being shirnked, or result in an unwarranted moving of data between datastores and/or hosts.




And the answer is: No shrinking under ESX/ESXi (as of version 5).



The documentation reads:



IMPORTANT Shrinking disks is not allowed under the following circumstances:



  1. The virtual machine is hosted on an ESX/ESXi server.
    ESX/ESXi Server can shrink the size of a virtual
    disk only when a virtual machine is exported. The space occupied by
    the virtual disk on the ESX/ESXi server, however, does not change.


  2. The virtual machine has a Mac guest operating
    system.


  3. You preallocated all the disk space to the virtual
    disk when you created it.


  4. The virtual machine contains a snapshot.


  5. The virtual machine is a linked clone or the
    parent of a linked clone.


  6. The virtual disk is an independent disk in
    nonpersistent mode.


  7. The file system is a journaling file system, such
    as an ext4, xfs, or jfs file system.


No wonder there is an option to shrink in VMWare Workstation but not in vSphere client connected to an ESXi or vCenter instance.










share|improve this question



















  • 2





    could you show a value of the isolation.tools.diskShrink.disable key which can be found on the vmx file?

    – cikuraku
    Jun 13 '12 at 9:28






  • 1





    It wasn't there. Adding isolation.tools.diskShrink.disable="false" didn't change anything.

    – NekojiruSou
    Jun 13 '12 at 9:43













11












11








11


5






EHLO everyone! My first post on the StackOverflow network :)



We're running some ESXi 5.0/vCenter infrastructure to host mainly Debian 6/amd64 guest systems with ext3 partitions and open-vm-tools compiled from source per debian bug 471784.



Got an issue that is seen being raised all around the internet, but without a conclusive answer given anywhere.



When trying to shrink a thin-provisioned disk in independent-persistent mode, with no snapshots, parents, clones whatsoever, I consistently get the following error:



root@linux64:~# vmware-toolbox-cmd disk list
Shrink disk is disabled for this virtual machine.

Shrinking is disabled for linked clones, parents of linked clones,
pre-allocated disks, snapshots, or due to other factors.
See the User's manual for more information.


(By the way, what are the "other factors", and which of the ton of white papers and technical manuals is the User's manual?:)



I know that I can stuff the partitions with zeros (in fact, I do use shred -fuzn0 when deleting large files) then shut down the guest in question and use various methods like vmkfstools, cloning or vMotioning disks around in thin-provision mode, etc, but all of them either incur the downtime penalty for the guest being shirnked, or result in an unwarranted moving of data between datastores and/or hosts.




And the answer is: No shrinking under ESX/ESXi (as of version 5).



The documentation reads:



IMPORTANT Shrinking disks is not allowed under the following circumstances:



  1. The virtual machine is hosted on an ESX/ESXi server.
    ESX/ESXi Server can shrink the size of a virtual
    disk only when a virtual machine is exported. The space occupied by
    the virtual disk on the ESX/ESXi server, however, does not change.


  2. The virtual machine has a Mac guest operating
    system.


  3. You preallocated all the disk space to the virtual
    disk when you created it.


  4. The virtual machine contains a snapshot.


  5. The virtual machine is a linked clone or the
    parent of a linked clone.


  6. The virtual disk is an independent disk in
    nonpersistent mode.


  7. The file system is a journaling file system, such
    as an ext4, xfs, or jfs file system.


No wonder there is an option to shrink in VMWare Workstation but not in vSphere client connected to an ESXi or vCenter instance.










share|improve this question
















EHLO everyone! My first post on the StackOverflow network :)



We're running some ESXi 5.0/vCenter infrastructure to host mainly Debian 6/amd64 guest systems with ext3 partitions and open-vm-tools compiled from source per debian bug 471784.



Got an issue that is seen being raised all around the internet, but without a conclusive answer given anywhere.



When trying to shrink a thin-provisioned disk in independent-persistent mode, with no snapshots, parents, clones whatsoever, I consistently get the following error:



root@linux64:~# vmware-toolbox-cmd disk list
Shrink disk is disabled for this virtual machine.

Shrinking is disabled for linked clones, parents of linked clones,
pre-allocated disks, snapshots, or due to other factors.
See the User's manual for more information.


(By the way, what are the "other factors", and which of the ton of white papers and technical manuals is the User's manual?:)



I know that I can stuff the partitions with zeros (in fact, I do use shred -fuzn0 when deleting large files) then shut down the guest in question and use various methods like vmkfstools, cloning or vMotioning disks around in thin-provision mode, etc, but all of them either incur the downtime penalty for the guest being shirnked, or result in an unwarranted moving of data between datastores and/or hosts.




And the answer is: No shrinking under ESX/ESXi (as of version 5).



The documentation reads:



IMPORTANT Shrinking disks is not allowed under the following circumstances:



  1. The virtual machine is hosted on an ESX/ESXi server.
    ESX/ESXi Server can shrink the size of a virtual
    disk only when a virtual machine is exported. The space occupied by
    the virtual disk on the ESX/ESXi server, however, does not change.


  2. The virtual machine has a Mac guest operating
    system.


  3. You preallocated all the disk space to the virtual
    disk when you created it.


  4. The virtual machine contains a snapshot.


  5. The virtual machine is a linked clone or the
    parent of a linked clone.


  6. The virtual disk is an independent disk in
    nonpersistent mode.


  7. The file system is a journaling file system, such
    as an ext4, xfs, or jfs file system.


No wonder there is an option to shrink in VMWare Workstation but not in vSphere client connected to an ESXi or vCenter instance.







virtualization vmware-esxi vmware-vsphere vmware-workstation thin-provisioning






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jun 14 '12 at 3:07







NekojiruSou

















asked Jun 13 '12 at 6:45









NekojiruSouNekojiruSou

280129




280129







  • 2





    could you show a value of the isolation.tools.diskShrink.disable key which can be found on the vmx file?

    – cikuraku
    Jun 13 '12 at 9:28






  • 1





    It wasn't there. Adding isolation.tools.diskShrink.disable="false" didn't change anything.

    – NekojiruSou
    Jun 13 '12 at 9:43












  • 2





    could you show a value of the isolation.tools.diskShrink.disable key which can be found on the vmx file?

    – cikuraku
    Jun 13 '12 at 9:28






  • 1





    It wasn't there. Adding isolation.tools.diskShrink.disable="false" didn't change anything.

    – NekojiruSou
    Jun 13 '12 at 9:43







2




2





could you show a value of the isolation.tools.diskShrink.disable key which can be found on the vmx file?

– cikuraku
Jun 13 '12 at 9:28





could you show a value of the isolation.tools.diskShrink.disable key which can be found on the vmx file?

– cikuraku
Jun 13 '12 at 9:28




1




1





It wasn't there. Adding isolation.tools.diskShrink.disable="false" didn't change anything.

– NekojiruSou
Jun 13 '12 at 9:43





It wasn't there. Adding isolation.tools.diskShrink.disable="false" didn't change anything.

– NekojiruSou
Jun 13 '12 at 9:43










4 Answers
4






active

oldest

votes


















3














http://www.vmware.com/pdf/vmware-tools-cli.pdf
Page 13 :



Shrinking disks is not allowed under the following circumstances:



The virtual machine is hosted on an ESX/ESXi server. ESX/ESXi Server can shrink the size of a virtual disk
only when a virtual machine is exported. The space occupied by the virtual disk on the ESX/ESXi server,
however, does not change.






share|improve this answer























  • Sad but true...

    – NekojiruSou
    Jun 14 '12 at 2:58


















18














Actually, there is a way to shrink a VM on ESXi, although you need to shut down the VM for it. Here's how:




  1. Zero all unused space inside the VM:



    dd if=/dev/zero bs=1048576 of=/zero ; sync ; rm /zero



  2. Do the same with other mount points, swap partitions, etc.


  3. Shut down the VM.



  4. SSH to ESXi, and issue this command:



    vmkfstools -K /vmfs/volumes/volumename/vmname/vmname.vmdk



This will take some time... vmkfstools "punches holes" inside your VMDK, e.g. deallocates all blocks that are filled with zeros, effectively shrinking your VMDK.






share|improve this answer


















  • 6





    For Windows, you can grab a copy of Virtual Server 2005, extract the Precompact.iso file from it, it contains a Procompact.exe program that will zero all the unused disk pace in Windows.

    – Chris S
    Aug 1 '13 at 13:39


















0














The only way to shrink a VMDK in vSphere ESXi would be to export or to migrate/Storage vMotion to another datastore. I do this a lot with live servers that can handle a migration (not SQL or Exchange). A previous server admin built all VMs with Thick Provisioned disks. I migrate the VMs from one datastore to another and change the VMDK to thin-provisioned.



You can also do the vmkfstools if the server is offline.






share|improve this answer






























    0














    Shrinking disks is possible on ESXi.




    1. Find the large file and delete them.



      find / -type f -size +50M




    2. Defragment (no need to un/remount anything). Ignore any errors. Some files like symlinks and device files can't be defragmented.



      sudo e4defrag /




    3. Zero-fill all unused space so VMware knows it's indeed unused:



      dd if=/dev/zero of=wipefile bs=1M; sync; rm wipefile




    4. Run the shrink operation: If 4 fails, proceed to 5.



      sudo vmware-toolbox-cmd disk shrinkonly



    5. Reboot the linux system with try option and edit the partition table with gparted. Shrink the root file system and delete & move swap partition near to root partition.



    6. SSH to ESXi, and issue this command:



      vmkfstools -K /vmfs/volumes/volumename/vmname/vmname.vmdk




    7. We need to edit the *.vmdk file. After the letters RW, defines the size of the VMware virtual disk (VMDK)



      *40 GB = 40 * 1024 * 1024 * 1024 / 512 = 83886080*



    8. Migrate it to another datastore to reflect the new size.






    share|improve this answer

























      Your Answer








      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "2"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader:
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      ,
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );













      draft saved

      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f398162%2fdisk-shrink-does-not-work-on-esxi-guests%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown

























      4 Answers
      4






      active

      oldest

      votes








      4 Answers
      4






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      3














      http://www.vmware.com/pdf/vmware-tools-cli.pdf
      Page 13 :



      Shrinking disks is not allowed under the following circumstances:



      The virtual machine is hosted on an ESX/ESXi server. ESX/ESXi Server can shrink the size of a virtual disk
      only when a virtual machine is exported. The space occupied by the virtual disk on the ESX/ESXi server,
      however, does not change.






      share|improve this answer























      • Sad but true...

        – NekojiruSou
        Jun 14 '12 at 2:58















      3














      http://www.vmware.com/pdf/vmware-tools-cli.pdf
      Page 13 :



      Shrinking disks is not allowed under the following circumstances:



      The virtual machine is hosted on an ESX/ESXi server. ESX/ESXi Server can shrink the size of a virtual disk
      only when a virtual machine is exported. The space occupied by the virtual disk on the ESX/ESXi server,
      however, does not change.






      share|improve this answer























      • Sad but true...

        – NekojiruSou
        Jun 14 '12 at 2:58













      3












      3








      3







      http://www.vmware.com/pdf/vmware-tools-cli.pdf
      Page 13 :



      Shrinking disks is not allowed under the following circumstances:



      The virtual machine is hosted on an ESX/ESXi server. ESX/ESXi Server can shrink the size of a virtual disk
      only when a virtual machine is exported. The space occupied by the virtual disk on the ESX/ESXi server,
      however, does not change.






      share|improve this answer













      http://www.vmware.com/pdf/vmware-tools-cli.pdf
      Page 13 :



      Shrinking disks is not allowed under the following circumstances:



      The virtual machine is hosted on an ESX/ESXi server. ESX/ESXi Server can shrink the size of a virtual disk
      only when a virtual machine is exported. The space occupied by the virtual disk on the ESX/ESXi server,
      however, does not change.







      share|improve this answer












      share|improve this answer



      share|improve this answer










      answered Jun 14 '12 at 2:27









      Li NiLi Ni

      541




      541












      • Sad but true...

        – NekojiruSou
        Jun 14 '12 at 2:58

















      • Sad but true...

        – NekojiruSou
        Jun 14 '12 at 2:58
















      Sad but true...

      – NekojiruSou
      Jun 14 '12 at 2:58





      Sad but true...

      – NekojiruSou
      Jun 14 '12 at 2:58













      18














      Actually, there is a way to shrink a VM on ESXi, although you need to shut down the VM for it. Here's how:




      1. Zero all unused space inside the VM:



        dd if=/dev/zero bs=1048576 of=/zero ; sync ; rm /zero



      2. Do the same with other mount points, swap partitions, etc.


      3. Shut down the VM.



      4. SSH to ESXi, and issue this command:



        vmkfstools -K /vmfs/volumes/volumename/vmname/vmname.vmdk



      This will take some time... vmkfstools "punches holes" inside your VMDK, e.g. deallocates all blocks that are filled with zeros, effectively shrinking your VMDK.






      share|improve this answer


















      • 6





        For Windows, you can grab a copy of Virtual Server 2005, extract the Precompact.iso file from it, it contains a Procompact.exe program that will zero all the unused disk pace in Windows.

        – Chris S
        Aug 1 '13 at 13:39















      18














      Actually, there is a way to shrink a VM on ESXi, although you need to shut down the VM for it. Here's how:




      1. Zero all unused space inside the VM:



        dd if=/dev/zero bs=1048576 of=/zero ; sync ; rm /zero



      2. Do the same with other mount points, swap partitions, etc.


      3. Shut down the VM.



      4. SSH to ESXi, and issue this command:



        vmkfstools -K /vmfs/volumes/volumename/vmname/vmname.vmdk



      This will take some time... vmkfstools "punches holes" inside your VMDK, e.g. deallocates all blocks that are filled with zeros, effectively shrinking your VMDK.






      share|improve this answer


















      • 6





        For Windows, you can grab a copy of Virtual Server 2005, extract the Precompact.iso file from it, it contains a Procompact.exe program that will zero all the unused disk pace in Windows.

        – Chris S
        Aug 1 '13 at 13:39













      18












      18








      18







      Actually, there is a way to shrink a VM on ESXi, although you need to shut down the VM for it. Here's how:




      1. Zero all unused space inside the VM:



        dd if=/dev/zero bs=1048576 of=/zero ; sync ; rm /zero



      2. Do the same with other mount points, swap partitions, etc.


      3. Shut down the VM.



      4. SSH to ESXi, and issue this command:



        vmkfstools -K /vmfs/volumes/volumename/vmname/vmname.vmdk



      This will take some time... vmkfstools "punches holes" inside your VMDK, e.g. deallocates all blocks that are filled with zeros, effectively shrinking your VMDK.






      share|improve this answer













      Actually, there is a way to shrink a VM on ESXi, although you need to shut down the VM for it. Here's how:




      1. Zero all unused space inside the VM:



        dd if=/dev/zero bs=1048576 of=/zero ; sync ; rm /zero



      2. Do the same with other mount points, swap partitions, etc.


      3. Shut down the VM.



      4. SSH to ESXi, and issue this command:



        vmkfstools -K /vmfs/volumes/volumename/vmname/vmname.vmdk



      This will take some time... vmkfstools "punches holes" inside your VMDK, e.g. deallocates all blocks that are filled with zeros, effectively shrinking your VMDK.







      share|improve this answer












      share|improve this answer



      share|improve this answer










      answered Mar 13 '13 at 18:49









      haimghaimg

      541614




      541614







      • 6





        For Windows, you can grab a copy of Virtual Server 2005, extract the Precompact.iso file from it, it contains a Procompact.exe program that will zero all the unused disk pace in Windows.

        – Chris S
        Aug 1 '13 at 13:39












      • 6





        For Windows, you can grab a copy of Virtual Server 2005, extract the Precompact.iso file from it, it contains a Procompact.exe program that will zero all the unused disk pace in Windows.

        – Chris S
        Aug 1 '13 at 13:39







      6




      6





      For Windows, you can grab a copy of Virtual Server 2005, extract the Precompact.iso file from it, it contains a Procompact.exe program that will zero all the unused disk pace in Windows.

      – Chris S
      Aug 1 '13 at 13:39





      For Windows, you can grab a copy of Virtual Server 2005, extract the Precompact.iso file from it, it contains a Procompact.exe program that will zero all the unused disk pace in Windows.

      – Chris S
      Aug 1 '13 at 13:39











      0














      The only way to shrink a VMDK in vSphere ESXi would be to export or to migrate/Storage vMotion to another datastore. I do this a lot with live servers that can handle a migration (not SQL or Exchange). A previous server admin built all VMs with Thick Provisioned disks. I migrate the VMs from one datastore to another and change the VMDK to thin-provisioned.



      You can also do the vmkfstools if the server is offline.






      share|improve this answer



























        0














        The only way to shrink a VMDK in vSphere ESXi would be to export or to migrate/Storage vMotion to another datastore. I do this a lot with live servers that can handle a migration (not SQL or Exchange). A previous server admin built all VMs with Thick Provisioned disks. I migrate the VMs from one datastore to another and change the VMDK to thin-provisioned.



        You can also do the vmkfstools if the server is offline.






        share|improve this answer

























          0












          0








          0







          The only way to shrink a VMDK in vSphere ESXi would be to export or to migrate/Storage vMotion to another datastore. I do this a lot with live servers that can handle a migration (not SQL or Exchange). A previous server admin built all VMs with Thick Provisioned disks. I migrate the VMs from one datastore to another and change the VMDK to thin-provisioned.



          You can also do the vmkfstools if the server is offline.






          share|improve this answer













          The only way to shrink a VMDK in vSphere ESXi would be to export or to migrate/Storage vMotion to another datastore. I do this a lot with live servers that can handle a migration (not SQL or Exchange). A previous server admin built all VMs with Thick Provisioned disks. I migrate the VMs from one datastore to another and change the VMDK to thin-provisioned.



          You can also do the vmkfstools if the server is offline.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Dec 8 '16 at 21:02









          Jarrod L. J. GibsonJarrod L. J. Gibson

          451215




          451215





















              0














              Shrinking disks is possible on ESXi.




              1. Find the large file and delete them.



                find / -type f -size +50M




              2. Defragment (no need to un/remount anything). Ignore any errors. Some files like symlinks and device files can't be defragmented.



                sudo e4defrag /




              3. Zero-fill all unused space so VMware knows it's indeed unused:



                dd if=/dev/zero of=wipefile bs=1M; sync; rm wipefile




              4. Run the shrink operation: If 4 fails, proceed to 5.



                sudo vmware-toolbox-cmd disk shrinkonly



              5. Reboot the linux system with try option and edit the partition table with gparted. Shrink the root file system and delete & move swap partition near to root partition.



              6. SSH to ESXi, and issue this command:



                vmkfstools -K /vmfs/volumes/volumename/vmname/vmname.vmdk




              7. We need to edit the *.vmdk file. After the letters RW, defines the size of the VMware virtual disk (VMDK)



                *40 GB = 40 * 1024 * 1024 * 1024 / 512 = 83886080*



              8. Migrate it to another datastore to reflect the new size.






              share|improve this answer





























                0














                Shrinking disks is possible on ESXi.




                1. Find the large file and delete them.



                  find / -type f -size +50M




                2. Defragment (no need to un/remount anything). Ignore any errors. Some files like symlinks and device files can't be defragmented.



                  sudo e4defrag /




                3. Zero-fill all unused space so VMware knows it's indeed unused:



                  dd if=/dev/zero of=wipefile bs=1M; sync; rm wipefile




                4. Run the shrink operation: If 4 fails, proceed to 5.



                  sudo vmware-toolbox-cmd disk shrinkonly



                5. Reboot the linux system with try option and edit the partition table with gparted. Shrink the root file system and delete & move swap partition near to root partition.



                6. SSH to ESXi, and issue this command:



                  vmkfstools -K /vmfs/volumes/volumename/vmname/vmname.vmdk




                7. We need to edit the *.vmdk file. After the letters RW, defines the size of the VMware virtual disk (VMDK)



                  *40 GB = 40 * 1024 * 1024 * 1024 / 512 = 83886080*



                8. Migrate it to another datastore to reflect the new size.






                share|improve this answer



























                  0












                  0








                  0







                  Shrinking disks is possible on ESXi.




                  1. Find the large file and delete them.



                    find / -type f -size +50M




                  2. Defragment (no need to un/remount anything). Ignore any errors. Some files like symlinks and device files can't be defragmented.



                    sudo e4defrag /




                  3. Zero-fill all unused space so VMware knows it's indeed unused:



                    dd if=/dev/zero of=wipefile bs=1M; sync; rm wipefile




                  4. Run the shrink operation: If 4 fails, proceed to 5.



                    sudo vmware-toolbox-cmd disk shrinkonly



                  5. Reboot the linux system with try option and edit the partition table with gparted. Shrink the root file system and delete & move swap partition near to root partition.



                  6. SSH to ESXi, and issue this command:



                    vmkfstools -K /vmfs/volumes/volumename/vmname/vmname.vmdk




                  7. We need to edit the *.vmdk file. After the letters RW, defines the size of the VMware virtual disk (VMDK)



                    *40 GB = 40 * 1024 * 1024 * 1024 / 512 = 83886080*



                  8. Migrate it to another datastore to reflect the new size.






                  share|improve this answer















                  Shrinking disks is possible on ESXi.




                  1. Find the large file and delete them.



                    find / -type f -size +50M




                  2. Defragment (no need to un/remount anything). Ignore any errors. Some files like symlinks and device files can't be defragmented.



                    sudo e4defrag /




                  3. Zero-fill all unused space so VMware knows it's indeed unused:



                    dd if=/dev/zero of=wipefile bs=1M; sync; rm wipefile




                  4. Run the shrink operation: If 4 fails, proceed to 5.



                    sudo vmware-toolbox-cmd disk shrinkonly



                  5. Reboot the linux system with try option and edit the partition table with gparted. Shrink the root file system and delete & move swap partition near to root partition.



                  6. SSH to ESXi, and issue this command:



                    vmkfstools -K /vmfs/volumes/volumename/vmname/vmname.vmdk




                  7. We need to edit the *.vmdk file. After the letters RW, defines the size of the VMware virtual disk (VMDK)



                    *40 GB = 40 * 1024 * 1024 * 1024 / 512 = 83886080*



                  8. Migrate it to another datastore to reflect the new size.







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Apr 25 at 21:30









                  Patrick Mevzek

                  3,04731226




                  3,04731226










                  answered Apr 25 at 20:05









                  KondapaneniKondapaneni

                  1




                  1



























                      draft saved

                      draft discarded
















































                      Thanks for contributing an answer to Server Fault!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid


                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.

                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f398162%2fdisk-shrink-does-not-work-on-esxi-guests%23new-answer', 'question_page');

                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      How to write a 12-bar blues melodyI-IV-V blues progressionHow to play the bridges in a standard blues progressionHow does Gdim7 fit in C# minor?question on a certain chord progressionMusicology of Melody12 bar blues, spread rhythm: alternative to 6th chord to avoid finger stretchChord progressions/ Root key/ MelodiesHow to put chords (POP-EDM) under a given lead vocal melody (starting from a good knowledge in music theory)Are there “rules” for improvising with the minor pentatonic scale over 12-bar shuffle?Confusion about blues scale and chords

                      What if the end-user didn't have the required library?What is setup.py?What is a clean, pythonic way to have multiple constructors in Python?What does Ruby have that Python doesn't, and vice versa?What is the reason for having '//' in Python?How do I create a namespace package in Python?How to package shared objects that python modules depend on?setuptools vs. distutils: why is distutils still a thing?Navigation in Windows 10 vs code not going to virtualenv library when the same library is installed at user levelPython create package for local usePackaging a project that uses multiple python versionsWhy is permission denied on pip install except for when “--user” is included at end of command?

                      Esgonzo ibérico Índice Descrición Distribución Hábitat Ameazas Notas Véxase tamén "Acerca dos nomes dos anfibios e réptiles galegos""Chalcides bedriagai"Chalcides bedriagai en Carrascal, L. M. Salvador, A. (Eds). Enciclopedia virtual de los vertebrados españoles. Museo Nacional de Ciencias Naturales, Madrid. España.Fotos