VMware vSphere

 View Only
  • 1.  ESXI PreAllocated disks

    Posted Sep 21, 2016 07:58 PM

    Hi Everyone,

    Newbie on ESXI here. I've just installed ESXI 6.0.0 Update 2 (Build 4192238) and I'm running into something I don't understand and I hope someone can explain it to me.

    When I create a new VM and choose a disk size I can see that ESXI per default creates a preallocated disk. In the terminal with "ls -al" is shows the total size and "du -h" shows the actual size it uses, that much I get. What I don't understand is that even if I convert the vmdk to a thin disk, the pre-allocated size remains the same. This is becoming a bit of an issue because when I copy the disk to another datastore (or to a folder on the same datastore) it doesn't copy the real size but the preallocated size.

    e.g. I can create a 200gig disk with no data on it, a copy to a different datastore will create a 200 gig disk.

    Q: Is this expected behavior and is there a way to turn this off? I would like to create a VM with a thin disk that only takes up the space of the data inside, so that it can be used as a template that I can export and import on demand. Having a large disk with nothing in it doesn't make much sense.

    Thanks in advance!



  • 2.  RE: ESXI PreAllocated disks

    Posted Sep 21, 2016 08:22 PM

    Welcome to the Community,

    thin disks are comparable to sparse files in Linux. Although they show the provisioned size, they only consume the allocated size. "ls -lisa" will show you both sizes, the provisioned size as well as the consumed disk space in KB (second column).

    How do you copy the virtual disks? From the command line, the vmkfstools command is what you want to use.

    André



  • 3.  RE: ESXI PreAllocated disks

    Posted Sep 22, 2016 07:18 AM

    Hi Andre,

    Thanks for taking the time to answer! I would normally use cp in a terminal or the web ui to copy the virtual machine or disk. Based on your reply (and my experience) I'm assuming this is not the way to go. Can you give a hint on the command-line that I can use to copy the total vm or just the disk?


    Thanks!

    Michael



  • 4.  RE: ESXI PreAllocated disks

    Broadcom Employee
    Posted Sep 22, 2016 09:11 AM

    vmkfstools -i pathTo/original.vmdk -d thin pathTo/target.vmdk will help to covert the original disk to thin type. After that you could use "du -h your.vmdk" to see the real size.



  • 5.  RE: ESXI PreAllocated disks

    Posted Sep 22, 2016 09:14 AM

    I tried that, creates the same file size, just didn't try to copy it this way to an alternate datastore (like NFS). Will give it a go tonight. Thanks!