Ubuntu – How to mount a yaffs2 filesystem


I have a .img file that uses the yaffs2 filesystem (an Android partition image) that I want to mount. I can't seem to do it with the mount command. How can I do this? I'm using Ubuntu 12.04.

Also, I don't want to extract it (I know how to do that using unyaffs). I want to mount it.

Best Answer

Ubuntu currently does not support YAFFS2. There is a feature request to package the YAFFS2 kernel module, which would provide mount support for the filesystem: [needs-packaging] yaffs2.

Kernel support

Thus, currently, if you need mount support you will have to compile it yourself. The YAFFS website has instructions for compiling a Linux kernel with YAFFS support (using Precise 32-bit):

The Ubuntu wiki also has general information on compiling your own kernel.

Extract and rebuild

Alternatively, try using yaffs2utils to extract and rebuild the image.

Note that due to a bug, you must specify the --yaffs-ecclayout option or it will silently fail. So to extract, try something like

git clone https://code.google.com/p/yaffs2utils/
cd yaffs2utils && make && cd ..
./yaffs2utils/unyaffs2 --yaffs-ecclayout system.img tempdir

Theoretically you can also rebuild the image using mkyaffs2, but I couldn't get it to work (the result wasn't bootable).


I found a program, Yaffey, that lets you edit a YAFFS2 image using a GUI:


While the home page says it's Windows-only, with a trivial change it compiles on Ubuntu Precise. To do so:

  1. Install dependencies: sudo apt-get install qt-sdk
  2. hg clone https://code.google.com/p/yaffey/
  3. In the file yaffey/yaffs2/yaffs_guts.h, change the line

    typedef unsigned loff_t;


    #include <stdlib.h>
  4. Compile: cd yaffey && qmake && make
  5. Run ./yaffey.
  6. Open your image, make your desired changes, and save (it refuses to overwrite; you have to select a different filename).

When I tried it, the resulting image booted successfully in the Android emulator.

Related Question