How to setup an Android Virtual Device with a data partition larger than 200 MB?

2.3k views Asked by At

Whatever I do, I can't properly setup a virtual android device with a /data partition larger than 200 MB. What's the proper/definitive way to setup or grow the /data partition?

I am assuming there is a bug somewhere in one of the tool, so basically I am looking for a workaround.

Using the AVD tool to creates a new AVD doesn't seems to be properly setup with the value entered in the 'Internal storage' field although the 'disk.dataPartition.size' parameter does get the appropriate value:

$ grep "size" *.ini
config.ini:disk.dataPartition.size=1024M
config.ini:sdcard.size=512M
hardware-qemu.ini:disk.cachePartition.size = 66m
hardware-qemu.ini:disk.systemPartition.size = 550m
hardware-qemu.ini:disk.dataPartition.size = 1g

Just listing the files ...

$ ls -alsh
total 979M
   0 drwxr-xr-x 12 user staff  408 jui 13 11:35 .
   0 drwxr-xr-x  7 user staff  238 jui 13 11:38 ..
 66M -rw-------  1 user staff  66M jui 13 11:38 cache.img
4,0K -rw-r--r--  1 user staff  668 jui 13 11:34 config.ini
4,0K -rw-r--r--  1 user staff 1,8K jui 13 11:35 hardware-qemu.ini
512M -rw-r--r--  1 user staff 512M jui 13 11:38 sdcard.img
200M -rw-------  1 user staff 200M jui 13 11:38 userdata-qemu.img
200M -rw-r--r--  1 user staff 200M jui 13 11:34 userdata.img

Then on lauching the virtual device, disk free says it's only 200MB:

$ adb shell df
Filesystem               Size     Used     Free   Blksize
/dev                   373.7M   128.0K   373.6M   4096
/sys/fs/cgroup         373.7M    12.0K   373.7M   4096
/mnt/asec              373.7M     0.0K   373.7M   4096
/mnt/obb               373.7M     0.0K   373.7M   4096
/system                541.9M   260.8M   281.1M   4096
/data                  197.0M    31.3M   165.7M   4096
/cache                  65.0M     4.1M    60.9M   4096
/mnt/media_rw/sdcard   510.0M    22.0K   510.0M   2048
/storage/sdcard        510.0M    22.0K   510.0M   2048

Then, if I try something proposed in this question: Android 4.4 Virtual Device Internal Storage Will Not Resize

Then the volume ends up mounted read-only which means It's pretty much useless:

$ adb install someApp.apk
pkg: /data/local/tmp/someApp.apk
Failure [INSTALL_FAILED_INSUFFICIENT_STORAGE]
rm failed for /data/local/tmp/someApp.apk, Read-only file system

And also visible at boot time ...

$ adb shell dmesg
...
<2>EXT4-fs error (device mtdblock1): ext4_mb_generate_buddy:741: group 2, 32366 clusters in bitmap, 32370 in gd
<3>Aborting journal on device mtdblock1-8.
<2>EXT4-fs (mtdblock1): Remounting filesystem read-only
<2>EXT4-fs error (device mtdblock1) in ext4_reserve_inode_write:4356: Journal has aborted
<2>EXT4-fs error (device mtdblock1) in ext4_evict_inode:171: Journal has aborted
<4>QEMU Pipe Device:rw, wait_event error
...

My setup:

  • OSX 10.10.3
  • Android SDK (latest as of June 13th 2015)
  • Android SDK Tools 24.3.2
2

There are 2 answers

2
Jafin On

After resetting the device in Android Device Manger I set the DataPartition via the GUI to 2GB. Restarted the device but the dataPartition was still 200mb. (seen in the hardware-qemu.ini).

I noticed the Device Manager wrote to the config.ini the line

disk.dataPartition.size=2 GB

So what I found worked for me was:

  1. Factory Reset the device
  2. Manually edit the config.ini to read 2000m not (not 2 G) I think in my case the GUI configuration was writing an invalid value for dataPartition size.

    disk.dataPartition.size=2000m

  3. Restart the device

0
Suresh On

After modifying disk.dataPartition.size parameter in config.ini , wipe the data of the avd in Android Virtual Device Manager

.enter image description here

Starting the emulator after above step will create the data partition with the size in config.ini.