I am trying to mount a jffs2 file to /mnt/mtdblock0 but I keep getting errors because mtd is too small.

The commands I run to mount it are:

modprobe mtdblock
modprobe mtdram total_size=49152 erase_size=128
dd if=rootfs.jffs2 of=/dev/mtdblock0
mount -t jffs2 /dev/mtdblock0 /mnt/mtd

The output for the dd command is:

dd: writing to ‘/dev/mtdblock0’: No space left on device
98305+0 records in
98304+0 records out
50331648 bytes (50 MB) copied, 0.295263 s, 170 MB/s

After I mount I do "df -h" and get:

/dev/mtdblock0 48M 48M 0 100% /mnt/mtd

From "mtdinfo /dev/mtd0":

Name:                           mtdram test device
Type:                           ram
Eraseblock size:                262144 bytes, 256.0 KiB
Amount of eraseblocks:          192 (50331648 bytes, 48.0 MiB)
Minimum input/output unit size: 1 byte
Sub-page size:                  1 byte
Character device major/minor:   90:0
Bad blocks are allowed:         false
Device is writable:             true

The size of rootfs.jffs2 is 51280296 and the above command showed that only 50331648 is available, so it makes sense why it is running out of room. What I haven't been able to figure out is how to increase the size of mtd0.

I've been reading articles like this that talk about setting mtdparts, but I don't really understand the process they talk about. I've tried using flash_eraseall, increasing the total_size and erase_size parameters, setting mtdparts from the command line, and setting mtdparts from /usr/src/linux-headers-4.2.0-35/drivers/mtd/Kconfig.

Does anyone know what I can do to increase the size of mtd? Any suggestions or resources would be very appreciated. I am using Ubuntu 14.04 desktop.


I managed to find work around. I'll post it here in case someone else has this problem.

I started running the commands in this article and I noticed that "modprobe nandsim" resulted in /mnt/mtd showing a larger size when I did "df -h". When I tried mounting again it appeared to work. "df -h" still shows /mnt/mtd as 100% full, but it is at 50M which is about the size of rootfs.jffs2. And when I look at the mounted file system, everything is where I expect it to be and there aren't any missing/incomplete directories like there were before.

I can't say I fully understand why this fixed it, but it did. If someone else has more insight into why this works, please comment or make it a new answer and I'll mark it as accepted.

| 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.