Reduce the size of qcow2 file when taking Android emulator snapshots

731 views
Skip to first unread message

Samuel Rowe

unread,
Dec 7, 2020, 11:13:28 AM12/7/20
to android-platform

Hi there,

We are trying to automate the creation of snapshots for testing our application. We may create up to 10,000 snapshots. For the sake of testing, we created 400 snapshots. We noticed that the `~/.android/avd/Test.avd/userdata-qemu.img.qcow2` file quickly bloated to 32 GB! From what I understand, this is the virtual disk where the files of the AVD are stored.

We tried compresing using the following command:
qemu-img convert -O qcow2 userdata-qemu.img.qcow2 dup.qcow2

But the snapshots fail to load after the compression.

Can someone please answer the following questions? It would be really helpful!

  1. Why is this file bloating?

  2. Is there a way to split this file into multiple parts such that we can pull only the necessary data when loading a snapshot?

Thank you for your time!


Reply all
Reply to author
Forward
0 new messages