Android 4.4 Virtual Device Internal Storage Will Not Resize

15,137

Solution 1

Now that the emulator file system is ext4 I was able to re-size the userdata.img using standard Linux tools.

# Navigate to AVD
cd ~/.android/avd/Nexus5
# Delete old image
rm userdata-qemu.*
# Re-size the image
resize2fs userdata.img 512M
# Start the emulator and enjoy
emulator @Nexus5

Edit I was also able to re-size userdata-qemu.img directly but I had to run e2fsck first.

 e2fsck -f userdata-qemu.img
 resize2fs userdata-qemu.img 512M

Solution 2

Even above suggestion can cause to android emulator hang on boot logo. The reason is that resize2fs do the changes thats are right in general but considered as broken fs by android and prevent it to mount it in rw mode, that hangs up the boot process.

Examening boot logs shows something like that:

EXT4-fs error (device mtdblock1): ext4_mb_generate_buddy:741: group 2, 32366 clusters in bitmap, 32370 in gd

Event e2fsck does not fix it for android and to workaround it i use tune2fs to change the way how android should continue to mount broken fs.

tune2fs -e continue userdata-qemu.img

Solution 3

Someone13, this is definitely a Bug in Target: "Android 4.4.2 - API Level 19"

I have the same problem- can’t change the size of internal storage of the device in emulator of Android SDK by no way(even with “disk.dataPartition.size=xxxM” in config.ini or with command-prompt arguments “-partition-size xxx”) when using Android 4.4.2 in the Emulator of Android SDK.

The only way is to set custom size is when using as Target: Android 3.0 - API Level 11.

My hardware: Windows 7 Ultimate SP1, RAM 4GB; Core Duo 2.28GHz; GT630

Solution 4

If you are still having this issue in 2016, try deleting the image from AVD manager, and then add back the emulator.

It seemed like I could not resize the emulator no matter what I do, but it worked when I deleted the image and then recreated image with 1GB internal storage.

Solution 5

I was able to create this virtual device, maybe change your device type or something?

enter image description here

Share:
15,137

Related videos on Youtube

Someone13
Author by

Someone13

Computer programmer for Higher Edge Software, LLC

Updated on June 06, 2022

Comments

  • Someone13
    Someone13 almost 2 years

    When creating a new Android 4.4 Virtual Device using the AVD Manager, I cannot get the internal storage to be anything larger than 200MB.

    512MB is the internal storage size I would like to set.

    I've tried:

    • Setting the internal storage of the device in the AVD Manager to 512MB.
    • In Eclipse project Debug Configurations, under the Target tab, setting Additional Emulator Command Line Options to -partition-size 512.
    • In the Eclipse Preferences, under Android, I set the Default emulator options to -partition-size 512.
    • Editing the config file for my virtual device under (User)/.android/avd/(device).avd/config.ini
      • Then setting disk.dataPartition.size to disk.dataPartition.size=512M
      • Also tried setting it to disk.dataPartition.size=512MB
      • Also tried setting it to data.dataPartition.size=512M

    This happens on both ARM and Intel Atom x86 CPUs.

    Now when I switch over to Android 3.0 (ARM), I can resize it simply using the AVD Manager to my hearts content. Is there an issue with Android 4.4? Is there something I missed? Or a possible work around?

  • Someone13
    Someone13 over 10 years
    Didn't work for me. I used that exact same setup that you displayed in the pic. I also tried updating my Android Developer Tools and updated 4.4 to 4.4.2. Still same issues.
  • Akshat Agarwal
    Akshat Agarwal over 10 years
    @Someone13 Have you updated tiy sdk manager as well? Download the latest version and test it out.
  • Someone13
    Someone13 over 10 years
    Unfortunately this is the only way that will work for me. I have to switch into Linux, do this, then switch back into Windows. It's quite a pain.
  • Frohnzie
    Frohnzie over 10 years
    There is a e2fsprogs package available for Cygwin. Maybe there is a MinGW port.
  • nerdinand
    nerdinand about 10 years
    On Mac OS X you can use brew install e2fsprogs when using the homebrew package manager to install these tools. Since they are not being symlinked to /usr/local by default, you should use their full path to run them, e.g. /usr/local/Cellar/e2fsprogs/1.42.9/sbin/resize2fs.
  • nerdinand
    nerdinand about 10 years
    Thanks, this in combination with the accepted answer above worked for me!
  • Kshitij Aggarwal
    Kshitij Aggarwal almost 10 years
    I used the above mentioned commands but now my emulator wont boot :(
  • Andrew Porritt
    Andrew Porritt almost 10 years
    Yeah, I had to do this to get the emulator to boot past the Android boot logo.
  • Matt
    Matt over 9 years
    This, combined with the tune2fs answer below worked, then got my emulator to boot again!
  • Mitch ミッチ
    Mitch ミッチ over 9 years
    Same as Matt, I used this and the tune2fs and it worked just fine. The only thing I had to resize both userdata-qemu.img and also userdata.img.
  • Moonwalker
    Moonwalker about 9 years
    Brilliant! combined with the answer worked for me. Without tun2fs sim was stuck in Android boot image.
  • Moonwalker
    Moonwalker about 9 years
    One thing - choose to fix any FS errors if e2fsck reports them...then run tune2fs
  • gili
    gili about 9 years
    great workaround! it worked on mac. Thanks also to nerdinand to poiting out how to install the missing command for mac.
  • Nate Cook
    Nate Cook over 6 years
    Not sure why this answer had a downvote. +1, worked for me. Here's an example (with Android SDK installed by Xamarin): ~/Library/Developer/Xamarin/android-sdk-macosx/emulator/bin6‌​4/resize2fs ~/.android/avd/avdname.avd/userdata.img 1024M. That's the only command you need if you run after avd create, but before launching the emulator for the first time.
  • Den Drobiazko
    Den Drobiazko over 6 years
    Edit part of answer didn't work for me since it modifies userdata-qemu.img and not userdata.img (the first one did nothing for my AVD). Also: given tools are available in SDK as of september'17, they are in ${MY_SDK_DIR}/emulator/bin64/ folder
  • Faceles
    Faceles almost 6 years
    Path in the anwer is incorrect @NateCook comment helped me to find resize2fs
  • Nate Cook
    Nate Cook almost 6 years
    If you can't find resize2fs, you may also be able to install via homebrew brew install e2fsprogs. More info on that approach here: stackoverflow.com/questions/20579606/…
  • Andrei Verdes
    Andrei Verdes about 5 years
    Also check for this line disk.dataPartition.size=... in config.ini and make sure it's disk.dataPartition.size=512M instead of something else. I created it with a 2048MB config in AS UI and it was created with disk.dataPartition.size=2G instead of disk.dataPartition.size=2048M and it wouldn't work