mount ramdisk rootfs /etc directory to jffs2 filesystem.

Ricard Wanderlof ricard.wanderlof at axis.com
Wed Jan 20 02:15:01 EST 2010


On Wed, 20 Jan 2010, Johnny Hung wrote:

>> i'd also recommend you to consider if you really need the
>> ramdisk. when using a ram disk its entire content is loaded to the RAM
>> occupying space, even if you don't use certain files (or part of
>> them). other filesystems are more efficient in this aspect.
>> if the main purpose is to have a read only rootfs, i'd suggest a look
>> at squashfs.
>
> I consider to use ramdisk as rootfs because worry about wrong
> operation in rootfs (is use jffs2 rootfs) and it will cause system
> boot up failed.

You have a point, however, you could do two things to help:

a) Mount the root file system as read-only. That way you can never write 
to it, unless you remount it read-write. But you can still reflash that 
partition if you need to upgrade.

b) Register the mtd partition holding the root file system as read-only.
This is even more seecure as remounting the file system won't permit 
writes. However, it also means you can't write to it for upgrading. (I
don't think the mtd core permits changing an already registered mtd 
partition from readonly to writable, but I could be wrong.)

> Another query, does the syslogd/klogd log files also store in jffs2
> rootfs? Write to jffs2 frequently will reduce flash life cycle.

I think it is fairly common to have a combination of devices:

/ (root)        is a readonly flash device (mtd partition)
/etc            is a writable flash device (mtd partition)
/tmp and /var   are ramdisks (tmpfs), so they are writable, but lost when
                 power is cycled.

/Ricard
-- 
Ricard Wolf Wanderlöf                           ricardw(at)axis.com
Axis Communications AB, Lund, Sweden            www.axis.com
Phone +46 46 272 2016                           Fax +46 46 13 61 30



More information about the linux-mtd mailing list