[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 453
  • Last Modified:

KVM allocates entire storage on virtual disk

Hi, I create a virtual machine originally though PXE, and for some reason the virtual disk size becomes the full size. That is, when I do a df inside the virtual machine it shows only 1.2gb used; however, on the host machine it shows the file size as 8gb. Why is that? How do I force the size of the image on the host machine to be the size actually used on the guest

Thanks
0
BrianGEFF719
Asked:
BrianGEFF719
  • 2
  • 2
2 Solutions
 
torimarCommented:
Could it be the virtual disk was created as "dynamically expanding"?
In that case, the complete maximum size of space may be reserved on the host, but the actual size that the guest uses and sees is only as much disk space as is actually claimed by the virtual machine. In time, this will grow up to the maximum 8 GB.

I'm not sure about KVM, but other virtualization technologies offer this dynamical storage option.
0
 
BrianGEFF719Author Commented:
So, I resolved the problem. As it turns out I was using a raw image format instead of a "copy on write," or QCOW as it's called in KVM. So that forced the fulled allocation. Creating a new image as qcow2 now only uses on the host exactly what the VM is using.
0
 
torimarCommented:
Congratulations.

However, there is no reason to delete a question just because it has been solved. This is even counter-productive to the idea of an EE solution database. Just select your own answer as the solution, and request a closure.

Also, QCOW is kind of a "disk space on demand" technique, which is not unrelated to the concept of dynamically allocated storage. Can you exclude that it may have been my comment which pointed you to right direction for solving the issue? If you can't, it would only be fair (and standard procedure on EE) to grant me some assist points.
0
 
BrianGEFF719Author Commented:
Request my own comment.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now