Giter Club home page Giter Club logo

Comments (3)

JenniGriesmann avatar JenniGriesmann commented on July 23, 2024

This is really a question of understanding what the libvirt API does: libvirt virConnectGetAllDomainStats. If you scroll down on that page to the section about "VIR_DOMAIN_STATS_BLOCK" , it describes what each of those fields mean.

None of them are going to be filesystem-aware and some will depend on how the device is being attached (i.e. is it being attached as a virtio device? are unmap operations supported?). The way I read that documentation, physical is probably the closest to what you're looking for, but it's aware of the blocks of the device as a whole and not your internally formatted partition. You might also be running into some oddities with how fallocate is virtualized for your disk in particular... maybe see what happens if you create the file using something like dd with /dev/random as input.

Regardless, this isn't related to go-libvirt, but libvirt itself. Hopefully the above information helps, but you could also try follow up there.

from go-libvirt.

nanoandrew4 avatar nanoandrew4 commented on July 23, 2024

Creating a file with /dev/random data did indeed grow the disk size, it seems fallocate won't cut it in VMs. For anyone that ends up here, the only way I have found of accurately measuring disk space used by a VM from the host is through the virt-df command. It's quite computationally costly, and it's not fast, but it outputs the data correctly.

from go-libvirt.

vtolstov avatar vtolstov commented on July 23, 2024

from go-libvirt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.