Mounting JFFS2 Filesystem in RAM

From Buici

Jump to: navigation, search

The MTD subsystem includes a RAM driver that can be used to (sort-of) loopback mount a JFFS2 filesystem for testing. In order to use it, you must load mtdram module as well as the mtdblock module. It is best to load mtdram when you need it so that you can set the proper total size and eraseblock size.

First, load the mtdram module. The total_size and erase_size parameters are in units of !KiB.

modprobe mtdram total_size=24576 erase_size=128

You can verify that it is loaded by looking in proc.

# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 01800000 00020000 "mtdram test device"

Then load the mtdblock device, copy the jffs2 filesystem into it, and mount it.

modprobe mtdblock
dd if=filesystem.jffs2 of=/dev/mtdblock0
mount -t jffs2 /dev/mtdblock0 ./root

--Elf 17:00, 6 April 2006 (PDT)

Personal tools