When I try to resize the internal storage partition size in AVD (Android Virtual Device) manager to anything larger than 200MB, the darn thing stays at 200MB. This mounts to /data
directory. The problem rears it’s head with Android API 19 / KitKat 4.4.x images and possibly others.
Best Answer
This is a known problem. I imagine that nobody has made the investment to fix because it affects an earlier API version/build. But, if you’re on a Mac, here’s your fix.
- Go into AVD and set the Internal Storage size to 1GB (or whatever size you need — I’ve only tested this to 1GB).
- Run the image to make sure that it boots up okay. (this is just to rule out any other problem that might be ailing your image) If you look at the image partitions, it should still be only 200MB.
- Stop the image from running.
- From the command line, run:
gtruncate --size 1g userdata.img
. If you don’t have gtruncate, install it withbrew install coreutils
. - From the command line, run:
tune2fs -e continue userdata.img
. If you don’t have tune2fs, install it withbrew install e2fsprogs
. If you still can’t find it after installing, check/usr/local/Cellar/e2fsprogs/{whateverversion}/sbin/tune2fs
. - If you also have a
userdata-qemu.img
file, you can repeat steps 4 and 5 for that image file. If you get an error, best bet is just to deleteuserdata-qemu.img
and let AVD automatically recreate it. - Run the image. Verify that your partition is 1GB. Celebrate.