Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make kvm2 driver disk images smaller #3155

Closed
afbjorklund opened this issue Sep 23, 2018 · 10 comments
Closed

Make kvm2 driver disk images smaller #3155

afbjorklund opened this issue Sep 23, 2018 · 10 comments
Labels
area/guest-vm General configuration issues with the minikube guest VM co/kvm2-driver KVM2 driver related issues help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. priority/backlog Higher priority than priority/awaiting-more-evidence. r/2019q2 Issue was last reviewed 2019q2

Comments

@afbjorklund
Copy link
Collaborator

Is this a BUG REPORT or FEATURE REQUEST? (choose one):

FEATURE REQUEST

Please provide the following details:

Environment:

  • Minikube version (use minikube version):
    v0.28.2
  • OS (e.g. from /etc/os-release):
    Ubuntu 16.04
  • VM Driver (e.g. cat ~/.minikube/machines/minikube/config.json | grep DriverName):
    kvm2
  • ISO version (e.g. cat ~/.minikube/machines/minikube/config.json | grep -i ISO or minikube ssh cat /etc/VERSION):
    v0.28.1
  • Install tools:
  • Others:

What happened:

The disk image for the minikube machine is over 5G in size, even though "only" half of that is used.

What you expected to happen:

The size of the disk image should match the contents, like it seem to be doing closer for virtualbox.

How to reproduce it (as minimally and precisely as possible):

minikube start --vm-driver kvm2

Output of minikube logs (if applicable):

Anything else do we need to know:

It could be the swap partition that is bloating the disk image, it could also be temporary files.

The workaround is to "compact" the disk image, by stopping it and using qemu-img convert

@tstromberg tstromberg added the area/guest-vm General configuration issues with the minikube guest VM label Sep 24, 2018
@afbjorklund
Copy link
Collaborator Author

When running Virtualbox (5.1), the minikube.vmdk is 2G for basic Kubernetes + default addons

When running libvirt (kvm2), the minikube.rawdisk is 4G for basic Kubernetes + default addons

@afbjorklund
Copy link
Collaborator Author

Running qemu-img convert on the raw image, shrinks the file size from 4.0G to 1.8G

Possibly the situation can be helped by using discard=unmap, but it remains to be seen...

https://dustymabe.com/2013/06/11/recover-space-from-vm-disk-images-by-using-discardfstrim/

$ sudo fstrim /mnt/vda1
fstrim: /mnt/vda1: the discard operation is not supported

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jan 4, 2019
@tstromberg tstromberg added priority/awaiting-more-evidence Lowest priority. Possibly useful, but not yet enough support to actually get it done. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Jan 23, 2019
@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Apr 29, 2019
@tstromberg tstromberg added the r/2019q2 Issue was last reviewed 2019q2 label May 22, 2019
@fejta-bot
Copy link

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Jun 21, 2019
@afbjorklund
Copy link
Collaborator Author

After the removal of the swap partition, the bloat is smaller but it is still there:

$ qemu-img convert -f raw minikube.rawdisk -O raw minikube.convert
$ du -hs minikube.rawdisk minikube.convert
3.0G	minikube.rawdisk
1.8G	minikube.convert

/remove-lifecycle rotten

@k8s-ci-robot k8s-ci-robot removed the lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. label Jun 22, 2019
@afbjorklund afbjorklund added priority/backlog Higher priority than priority/awaiting-more-evidence. co/kvm2-driver KVM2 driver related issues and removed priority/awaiting-more-evidence Lowest priority. Possibly useful, but not yet enough support to actually get it done. labels Jun 22, 2019
@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Sep 20, 2019
@fejta-bot
Copy link

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Oct 20, 2019
@fejta-bot
Copy link

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

@k8s-ci-robot
Copy link
Contributor

@fejta-bot: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/guest-vm General configuration issues with the minikube guest VM co/kvm2-driver KVM2 driver related issues help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. priority/backlog Higher priority than priority/awaiting-more-evidence. r/2019q2 Issue was last reviewed 2019q2
Projects
None yet
Development

No branches or pull requests

4 participants