15

I feel a bit blind developing on an emulator for Android and not being able to see the file system on the AVD (.img).

Is there a way to mount it in Windows or Linux, so that I could at least see the file listing and maybe contents?

Bonus if it's mounted with write permissions as well.

Thank you.

Artem Russakovskii
  • 21,516
  • 18
  • 92
  • 115

6 Answers6

15

You can just mount the device in Linux:

sudo mount -o loop ~/.android/avd/<myvirt>/sdcard.img <destdir>
Ryan Olson
  • 2,766
  • 4
  • 29
  • 36
  • 1
    Can you write to it with this solution? – Artem Russakovskii Apr 13 '11 at 22:46
  • 2
    Yes, it is writeable after mounting. (I always do it with the virtual device shut down though, I'm not sure how this would interact with a running emulator.) – Ryan Olson Apr 14 '11 at 17:57
  • w.r.t. running emulator, I can almost guarantee file system corruption if both the emulator and your host system write to the sdcard. In fact, if even one writes, the filesystem will probably look corrupted to the other. – Edward Falk May 15 '12 at 23:17
4

How about "adb shell"?

This will give you a root shell (on the emulator)..

Mads Kristiansen
  • 2,604
  • 1
  • 17
  • 15
  • Alright, that's a start (though such a pain in the a$$ on Windows. TAB doesn't work and it is highly primitive). Is there any editor available on it? I tried vi, emacs, nano. – Artem Russakovskii Dec 02 '09 at 08:56
  • Looks like cat is my best friend with this primitive system. Also someone suggested installing busybox which has vi in it, which I may try. – Artem Russakovskii Dec 02 '09 at 09:02
3

For MacOS X users:

$ hdiutil attach ~/.android/avd/Samsung_Nexus_S.avd/sdcard.img
Marco Gasparetto
  • 463
  • 5
  • 10
2

For Windows, I just ran across the ImDisk Virtual Disk Driver

Install this utility, and you can then mount sdcard.img. There's a nice tutorial here

Rahul Sharma
  • 2,867
  • 2
  • 27
  • 40
Alan
  • 3,715
  • 3
  • 39
  • 57
1

Another option would be to use the File Explorer in DDMS (Eclipse SDK), you can see the whole file system there and download/upload files to the desired place. That way you don't have to mount and deal with images. I tried mounting and it's cumbersome, for example if the emulator is running you can't do it. Plus you would need to mount each image if you want to see all contents.

Stefan Malacu
  • 243
  • 1
  • 2
  • 6
1

Yes, they can be mounted. Under Ubuntu you can mount sdcard.img via vfat and system.img and userdata-qemu.img via yaffs2. See also: "Whats Android file system ??".

Note that the file system yaffs2 is not included in the standard Ubuntu kernel. Thus, in case of Ubuntu, you have to build your own kernel with yaffs2 support before you are able to mount the system.img and the userdata-qemu.img. Alternatively, you can also take a look at the yaffs2utils which allow you to extract files from yaffs2 images or to create new image files. The advantage is that you do not have to build your own kernel for using these tools.

Community
  • 1
  • 1
Stefan Endrullis
  • 4,150
  • 2
  • 32
  • 45