I need to do a strange task. I want to move whole android system to external SD card on Android Virtual Device. I need to do this, because android emulator, emulates SD commands, only for external card image. And I want to get SD commands trace, during Android Virtual Device usage.

To be more precise: I want to move at least /system and /data folders to external storage. In such way, that system could still work fine =)

Thank You!


To move some of system folders (/system or /data), to external emulated SD card, you need to do following:

  1. Firstly, /data contents (for example) should be placed on sdcard. Initially they are loaded by emulator from userdata.img file. So you need to copy userdata.img ($EMUPATH/system-images/android-19/armeabi-v7a/userdata.img) contents to sdcard.iso. $> dd if=userdata.img of=sdcard.iso
  2. I assume, that android virtual device is created. To change boot configuration, you will need to change fstab.goldfish file on ramdisk.img. If it is Android 4.4 AVD, then ramdisk.img could also be find at $EMUPATH/system-images/android-19/armeabi-v7a/
    • Create a temporary folder, say ramdisk-ext $ mkdir ramdisk-ext
    • Change directory to ramdisk-ext $ cd ramdisk-ext
    • Extract the ramdisk.cpio in the ramdisk-ext folder $ gunzip -dcv ../ramdisk.img | cpio -idm
    • Modify fstab.goldfish $ gedit fstab.goldfish in such way:
      • String #6 from "/dev/block/mtdblock1 /data ..." to "/dev/block/mmcblk0 /data ..."
    • Create new ramdisk $ find . | cpio -H newc -o | gzip -9 >../ramdisk_new.img
  3. Everything is done, now you need to start the emulator, with your new ramdisk and custom sdcard:$ ./emulator -avd $AVDNAME -sdcard sdcard.iso -ramdisk $EMUPATH/system-images/android-19/armeabi-v7a/ramdisk_new.img

P.S. Notice that in this example you can move only one of such folders (/system or /data). Maybe it could be changed, by creating sdcard image with several partitions.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.