virtualization - How to get the total allocated size of the files inside a folder on Windows

05
2014-04
  • Lucian Petrut

    I have a SMB share in which I keep a bunch of dynamic VHD and QCOW2 images used as volumes for virtual machines. This share is supposed to be used by Hyper-V as well as KVM nodes.

    I'd like to know the total disk space allocated to those images. Is there any command similar to "du -sb --aparent-size" from Linux to do this on Windows?

    For the moment, I'm using qemu-img and the WMI instrumentation in a Python script to do this but it is kind of slow for large number of images. It takes about a few minutes to do this task.

    The idea is that this status should be reported quite frequently (every 10 minutes for example) so I'd need it done in less than 30 seconds.

    I'd gladly appreciate if someone could give me a better way of doing this, in a shorter time.

  • Answers
  • BowlesCR

    Is using Cygwin an option? That should give you access to du.


  • Related Question

    virtualization - windows 7 rtm vhd file
  • Questioner

    How can I install Windows 7 rtm vhd files in an existing windows xp machine?


  • Related Answers
  • William Hilsum

    If you are talking about VHD files, you do not install this. A VHD image is a complete installation of Windows that is ready to run in a virtual machine.

    The easiest thing you can do in Windows XP is to download Microsoft Virtual PC 2007, and then simply copy all the VHD files to a directory and either create a new virtual machine pointing to the VHD or run the configuration file (It depends what you downloaded).

    You should then be running Windows 7 virtually within your Windows XP installation.