* Re: mount ramdisk rootfs /etc directory to jffs2 filesystem.
2010-01-20 2:32 ` Johnny Hung
@ 2010-01-20 7:12 ` Matthias Kaehlcke
2010-01-20 7:15 ` Ricard Wanderlof
2010-01-20 7:57 ` Marco Stornelli
2 siblings, 0 replies; 20+ messages in thread
From: Matthias Kaehlcke @ 2010-01-20 7:12 UTC (permalink / raw)
To: Johnny Hung
Cc: kernelnewbies, linux-mtd@lists.infradead.org, Ricard Wanderlof,
linuxppc-dev@lists.ozlabs.org, linux-embedded@vger.kernel.org
El Wed, Jan 20, 2010 at 10:32:15AM +0800 Johnny Hung ha dit:
> 2010/1/19 Matthias Kaehlcke <matthias@kaehlcke.net>:
> > El Tue, Jan 19, 2010 at 02:17:22PM +0100 Ricard Wanderlof ha dit:
> >
> >> On Tue, 19 Jan 2010, Johnny Hung wrote:
> >>
> >>> Okay, I think the steps is below if my rootfs is ramdisk and configure
> >>> files in jffs2,
> >>>
> >>> 1. cp /etc/* /mnt/mtd/etc/ (/mnt/mtd is my jffs2 fs)
> >>> 2. rm -rf /etc/*
> >>> 3. make symbolic links from all /etc/xx to /mnt/mtd/etc/xxx
> >>> 4. remake ramdisk rootfs
> >>>
> >>> It seems all files in ramdisk rootfs /etc all links to /mnt/mtd/etc/
> >>> and try to modify these files is effective after reboot.
> >>> But is this a common way in embedded linux ?
> >>
>
> Thanks, I understand.
>
> >> In principle, but it is easier (and cleaner) to make a symbolic link from
> >> (say) /etc -> /mnt/mtd/etc without linking every individual file and
> >> directory.
> >
> > i totally agree with ricard when you want to move the entire directory
> > to jffs2 and not only some selected files
> >
> >> You could also use a jffs2 file system in flash for your rootfs, that way
> >> you wouldn't need a ramdisk at all.
> >
> > 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 could set up a rootfs partition with a read-only file system
(squashfs, jffs2 mounted ro) and a second partition that's writable.
> Another query, does the syslogd/klogd log files also store in jffs2
> rootfs? Write to jffs2 frequently will reduce flash life cycle.
by default the log files will be written to /var/log, if this
directory happens to be on a jffs2 partition writes will go there and
produce wear out. to avoid this you could set up a small tmpfs (in
RAM) and mount it on /var
--
Matthias Kaehlcke
Embedded Linux Developer
Barcelona
We can't solve problems by using the same kind
of thinking we used when we created them
(Albert Einstein)
.''`.
using free software / Debian GNU/Linux | http://debian.org : :' :
`. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4 `-
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: mount ramdisk rootfs /etc directory to jffs2 filesystem.
2010-01-20 2:32 ` Johnny Hung
2010-01-20 7:12 ` Matthias Kaehlcke
@ 2010-01-20 7:15 ` Ricard Wanderlof
2010-01-20 7:17 ` Matthias Kaehlcke
2010-01-22 3:01 ` Johnny Hung
2010-01-20 7:57 ` Marco Stornelli
2 siblings, 2 replies; 20+ messages in thread
From: Ricard Wanderlof @ 2010-01-20 7:15 UTC (permalink / raw)
To: Johnny Hung
Cc: Ricard Wanderlöf, linux-embedded@vger.kernel.org,
kernelnewbies, linux-mtd@lists.infradead.org, Matthias Kaehlcke,
linuxppc-dev@lists.ozlabs.org
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=20
to it, unless you remount it read-write. But you can still reflash that=20
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=20
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=20
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
--=20
Ricard Wolf Wanderl=F6f ricardw(at)axis.com
Axis Communications AB, Lund, Sweden www.axis.com
Phone +46 46 272 2016 Fax +46 46 13 61 30
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: mount ramdisk rootfs /etc directory to jffs2 filesystem.
2010-01-20 7:15 ` Ricard Wanderlof
@ 2010-01-20 7:17 ` Matthias Kaehlcke
2010-01-22 3:01 ` Johnny Hung
1 sibling, 0 replies; 20+ messages in thread
From: Matthias Kaehlcke @ 2010-01-20 7:17 UTC (permalink / raw)
To: Ricard Wanderlof
Cc: Johnny Hung, kernelnewbies, linux-mtd@lists.infradead.org,
linuxppc-dev@lists.ozlabs.org, linux-embedded@vger.kernel.org
El Wed, Jan 20, 2010 at 08:15:01AM +0100 Ricard Wanderlof ha dit:
> 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.)
AFAIK the mtd core doesn't permit changing a partition from ro to
rw. but if you happen to need to reflash the partition anyway, you can
load a tiny kernel modules that changes the flag indicating if a
partition is writable.
i once had to recurr to this solution and it works ;)
--
Matthias Kaehlcke
Embedded Linux Developer
Barcelona
Tant qu'il y aura sur terre des hommes pour qui existe un concept
d' 'honneur national', la menace d'une nouvelle guerre subsistera
(B. Traven)
.''`.
using free software / Debian GNU/Linux | http://debian.org : :' :
`. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4 `-
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: mount ramdisk rootfs /etc directory to jffs2 filesystem.
2010-01-20 7:15 ` Ricard Wanderlof
2010-01-20 7:17 ` Matthias Kaehlcke
@ 2010-01-22 3:01 ` Johnny Hung
1 sibling, 0 replies; 20+ messages in thread
From: Johnny Hung @ 2010-01-22 3:01 UTC (permalink / raw)
To: Ricard Wanderlof
Cc: kernelnewbies, linuxppc-dev@lists.ozlabs.org,
linux-mtd@lists.infradead.org, linux-embedded@vger.kernel.org,
Matthias Kaehlcke
2010/1/20 Ricard Wanderlof <ricard.wanderlof@axis.com>:
>
> 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 writ=
es.
> 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) =A0 =A0 =A0 =A0is a readonly flash device (mtd partition)
> /etc =A0 =A0 =A0 =A0 =A0 =A0is a writable flash device (mtd partition)
> /tmp and /var =A0 are ramdisks (tmpfs), so they are writable, but lost wh=
en
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0power is cycled.
I think it's a good combination for my board. How do I sepcific the
/etc to another mtd part?
The busybox init will parse /etc/inittab after setup signal handler
and initializes console. I only
know to do it is to re-mount etc directory from another mtd to /etc.
Is it right?
Thank your help.
BRs, H. Johnny
>
> /Ricard
> --
> Ricard Wolf Wanderl=F6f =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 ricardw(at)axis.com
> Axis Communications AB, Lund, Sweden =A0 =A0 =A0 =A0 =A0 =A0www.axis.com
> Phone +46 46 272 2016 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=
Fax +46 46 13 61 30
>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: mount ramdisk rootfs /etc directory to jffs2 filesystem.
2010-01-20 2:32 ` Johnny Hung
2010-01-20 7:12 ` Matthias Kaehlcke
2010-01-20 7:15 ` Ricard Wanderlof
@ 2010-01-20 7:57 ` Marco Stornelli
2010-01-20 10:21 ` Matthias Kaehlcke
2010-01-22 3:07 ` Johnny Hung
2 siblings, 2 replies; 20+ messages in thread
From: Marco Stornelli @ 2010-01-20 7:57 UTC (permalink / raw)
To: Johnny Hung
Cc: Ricard Wanderlof, linux-embedded@vger.kernel.org, kernelnewbies,
linux-mtd@lists.infradead.org, Matthias Kaehlcke,
linuxppc-dev@lists.ozlabs.org
2010/1/20 Johnny Hung <johnny.hacking@gmail.com>:
> 2010/1/19 Matthias Kaehlcke <matthias@kaehlcke.net>:
>> El Tue, Jan 19, 2010 at 02:17:22PM +0100 Ricard Wanderlof ha dit:
>>
> 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.
> Another query, does the syslogd/klogd log files also store in jffs2
> rootfs? Write to jffs2 frequently will reduce flash life cycle.
>
> BRs, H. Johnny
>>
>> --
In general a good splitting for rootfs could be: squashfs for rootfs,
tmpfs for volatile data (/tmp), ubifs (with a flash partition) for
"strong" permanent data (/etc, ....) and pramfs for "light" permanent
data (/var/log, .....).
I think you should "split" your rootfs. Ramdisk is an old approach
with some drawbacks.
Marco
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: mount ramdisk rootfs /etc directory to jffs2 filesystem.
2010-01-20 7:57 ` Marco Stornelli
@ 2010-01-20 10:21 ` Matthias Kaehlcke
2010-01-20 11:54 ` Marco Stornelli
2010-01-22 3:07 ` Johnny Hung
1 sibling, 1 reply; 20+ messages in thread
From: Matthias Kaehlcke @ 2010-01-20 10:21 UTC (permalink / raw)
To: Marco Stornelli
Cc: Ricard Wanderlof, linux-embedded@vger.kernel.org, kernelnewbies,
Johnny Hung, linux-mtd@lists.infradead.org,
linuxppc-dev@lists.ozlabs.org
El Wed, Jan 20, 2010 at 08:57:44AM +0100 Marco Stornelli ha dit:
> 2010/1/20 Johnny Hung <johnny.hacking@gmail.com>:
> > 2010/1/19 Matthias Kaehlcke <matthias@kaehlcke.net>:
> >> El Tue, Jan 19, 2010 at 02:17:22PM +0100 Ricard Wanderlof ha dit:
> >>
> > 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.
> > Another query, does the syslogd/klogd log files also store in jffs2
> > rootfs? Write to jffs2 frequently will reduce flash life cycle.
> >
> > BRs, H. Johnny
> >>
> >> --
>
> In general a good splitting for rootfs could be: squashfs for rootfs,
> tmpfs for volatile data (/tmp), ubifs (with a flash partition) for
> "strong" permanent data (/etc, ....) and pramfs for "light" permanent
> data (/var/log, .....).
if ubifs is a good choice depends on the size of the partition, iirc
it has a significant overhead for very small partitions.
once using ubi it could be interesting to set up the read-only rootfs
partition upon ubi in order to spread the wear out over a maximum of blocks.
--
Matthias Kaehlcke
Embedded Linux Developer
Barcelona
You can chain me, you can torture me, you can even
destroy this body, but you will never imprison my mind
(Mahatma Gandhi)
.''`.
using free software / Debian GNU/Linux | http://debian.org : :' :
`. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4 `-
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: mount ramdisk rootfs /etc directory to jffs2 filesystem.
2010-01-20 10:21 ` Matthias Kaehlcke
@ 2010-01-20 11:54 ` Marco Stornelli
0 siblings, 0 replies; 20+ messages in thread
From: Marco Stornelli @ 2010-01-20 11:54 UTC (permalink / raw)
To: Matthias Kaehlcke
Cc: Ricard Wanderlof, linux-embedded@vger.kernel.org, kernelnewbies,
Johnny Hung, linux-mtd@lists.infradead.org,
linuxppc-dev@lists.ozlabs.org
2010/1/20 Matthias Kaehlcke <matthias@kaehlcke.net>:
> El Wed, Jan 20, 2010 at 08:57:44AM +0100 Marco Stornelli ha dit:
>
>> 2010/1/20 Johnny Hung <johnny.hacking@gmail.com>:
>> > 2010/1/19 Matthias Kaehlcke <matthias@kaehlcke.net>:
>> >> El Tue, Jan 19, 2010 at 02:17:22PM +0100 Ricard Wanderlof ha dit:
>> >>
>> > 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.
>> > Another query, does the syslogd/klogd log files also store in jffs2
>> > rootfs? Write to jffs2 frequently will reduce flash life cycle.
>> >
>> > BRs, H. Johnny
>> >>
>> >> --
>>
>> In general a good splitting for rootfs could be: squashfs for rootfs,
>> tmpfs for volatile data (/tmp), ubifs (with a flash partition) for
>> "strong" permanent data (/etc, ....) and pramfs for "light" permanent
>> data (/var/log, .....).
>
> if ubifs is a good choice depends on the size of the partition, iirc
> it has a significant overhead for very small partitions.
>
> once using ubi it could be interesting to set up the read-only rootfs
> partition upon ubi in order to spread the wear out over a maximum of blocks.
>
I don't know the size constraints of Johnny, so it can be useful to use jffs2.
Marco
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: mount ramdisk rootfs /etc directory to jffs2 filesystem.
2010-01-20 7:57 ` Marco Stornelli
2010-01-20 10:21 ` Matthias Kaehlcke
@ 2010-01-22 3:07 ` Johnny Hung
2010-01-22 8:14 ` Marco Stornelli
1 sibling, 1 reply; 20+ messages in thread
From: Johnny Hung @ 2010-01-22 3:07 UTC (permalink / raw)
To: Marco Stornelli
Cc: Ricard Wanderlof, linux-embedded@vger.kernel.org, kernelnewbies,
linux-mtd@lists.infradead.org, Matthias Kaehlcke,
linuxppc-dev@lists.ozlabs.org
2010/1/20 Marco Stornelli <marco.stornelli@gmail.com>:
> 2010/1/20 Johnny Hung <johnny.hacking@gmail.com>:
>> 2010/1/19 Matthias Kaehlcke <matthias@kaehlcke.net>:
>>> El Tue, Jan 19, 2010 at 02:17:22PM +0100 Ricard Wanderlof ha dit:
>>>
>> 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.
>> Another query, does the syslogd/klogd log files also store in jffs2
>> rootfs? Write to jffs2 frequently will reduce flash life cycle.
>>
>> BRs, H. Johnny
>>>
>>> --
>
It seems there are a lot of file-systems I have to study :P. The same
question is
how to split my rootfs? Re-mount /etc, /var to another file-sysyem mtd part when
system boot up?
Thank your good advice.
BRs, H. Johnny
> In general a good splitting for rootfs could be: squashfs for rootfs,
> tmpfs for volatile data (/tmp), ubifs (with a flash partition) for
> "strong" permanent data (/etc, ....) and pramfs for "light" permanent
> data (/var/log, .....).
> I think you should "split" your rootfs. Ramdisk is an old approach
> with some drawbacks.
>
> Marco
>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: mount ramdisk rootfs /etc directory to jffs2 filesystem.
2010-01-22 3:07 ` Johnny Hung
@ 2010-01-22 8:14 ` Marco Stornelli
2010-01-25 4:09 ` Johnny Hung
0 siblings, 1 reply; 20+ messages in thread
From: Marco Stornelli @ 2010-01-22 8:14 UTC (permalink / raw)
To: Johnny Hung
Cc: Ricard Wanderlof, linux-embedded@vger.kernel.org, kernelnewbies,
linux-mtd@lists.infradead.org, Matthias Kaehlcke,
linuxppc-dev@lists.ozlabs.org
2010/1/22 Johnny Hung <johnny.hacking@gmail.com>:
> 2010/1/20 Marco Stornelli <marco.stornelli@gmail.com>:
>> 2010/1/20 Johnny Hung <johnny.hacking@gmail.com>:
>>> 2010/1/19 Matthias Kaehlcke <matthias@kaehlcke.net>:
>>>> El Tue, Jan 19, 2010 at 02:17:22PM +0100 Ricard Wanderlof ha dit:
>>>>
>>> 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.
>>> Another query, does the syslogd/klogd log files also store in jffs2
>>> rootfs? Write to jffs2 frequently will reduce flash life cycle.
>>>
>>> BRs, H. Johnny
>>>>
>>>> --
>>
>
> It seems there are a lot of file-systems I have to study :P. The same
> question is
> how to split my rootfs? Re-mount /etc, /var to another file-sysyem mtd part when
> system boot up?
>
Simply, you can mount each mount point with the fstab file and a
script, same approach of every linux distribution, nothing more. Even
in the pc world you can mount your /home on a partition with ext3,
/var in a partition with ext4, and so on. A very simple approach to
setup the system, it is to start with NFS for example with "whole" fs,
copy what you need in the right place, setup the start-up script and
reboot.
Marco
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: mount ramdisk rootfs /etc directory to jffs2 filesystem.
2010-01-22 8:14 ` Marco Stornelli
@ 2010-01-25 4:09 ` Johnny Hung
2010-01-25 8:27 ` Chris Simmonds
0 siblings, 1 reply; 20+ messages in thread
From: Johnny Hung @ 2010-01-25 4:09 UTC (permalink / raw)
To: Marco Stornelli
Cc: Ricard Wanderlof, linux-embedded@vger.kernel.org, kernelnewbies,
linux-mtd@lists.infradead.org, Matthias Kaehlcke,
linuxppc-dev@lists.ozlabs.org
2010/1/22 Marco Stornelli <marco.stornelli@gmail.com>:
> 2010/1/22 Johnny Hung <johnny.hacking@gmail.com>:
>> 2010/1/20 Marco Stornelli <marco.stornelli@gmail.com>:
>>> 2010/1/20 Johnny Hung <johnny.hacking@gmail.com>:
>>>> 2010/1/19 Matthias Kaehlcke <matthias@kaehlcke.net>:
>>>>> El Tue, Jan 19, 2010 at 02:17:22PM +0100 Ricard Wanderlof ha dit:
>>>>>
>>>> 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.
>>>> Another query, does the syslogd/klogd log files also store in jffs2
>>>> rootfs? Write to jffs2 frequently will reduce flash life cycle.
>>>>
>>>> BRs, H. Johnny
>>>>>
>>>>> --
>>>
>>
>> It seems there are a lot of file-systems I have to study :P. The same
>> question is
>> how to split my rootfs? Re-mount /etc, /var to another file-sysyem mtd part when
>> system boot up?
>>
>
Yes, I know. So if I want set etc directoyr to /dev/mtd5 not in rootfs
/, I need to add "/dev/mtdblock5 /etc jffs2 defaults
0 0" in /etc/fstab file but rootfs doesn't contain /etc
directory because /etc directoyr is store in /dev/mtdblock5.
Do you know what I mean? The kernel execute /sbin/init after mount
rootfs and /sbin/init is link to busybox, busybox will read
/etc/inittab file to initial. The problem is coming, how busybox to
read /etc in rootfs before mount /dev/mtdblock5 to /etc? There is no
program to mount /dev/mtdblock5 to /etc before busybox init execute.
I think I must mistake some concept, please give me a hint.
Thank you
BRs, H. Johnny
> Simply, you can mount each mount point with the fstab file and a
> script, same approach of every linux distribution, nothing more. Even
> in the pc world you can mount your /home on a partition with ext3,
> /var in a partition with ext4, and so on. A very simple approach to
> setup the system, it is to start with NFS for example with "whole" fs,
> copy what you need in the right place, setup the start-up script and
> reboot.
>
> Marco
>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: mount ramdisk rootfs /etc directory to jffs2 filesystem.
2010-01-25 4:09 ` Johnny Hung
@ 2010-01-25 8:27 ` Chris Simmonds
2010-01-25 8:43 ` Johnny Hung
0 siblings, 1 reply; 20+ messages in thread
From: Chris Simmonds @ 2010-01-25 8:27 UTC (permalink / raw)
To: Johnny Hung
Cc: Ricard Wanderlof, linux-embedded@vger.kernel.org, Marco Stornelli,
kernelnewbies, linux-mtd@lists.infradead.org, Matthias Kaehlcke,
linuxppc-dev@lists.ozlabs.org
Johnny Hung wrote:
> 2010/1/22 Marco Stornelli <marco.stornelli@gmail.com>:
>> 2010/1/22 Johnny Hung <johnny.hacking@gmail.com>:
>>> 2010/1/20 Marco Stornelli <marco.stornelli@gmail.com>:
>>>> 2010/1/20 Johnny Hung <johnny.hacking@gmail.com>:
>>>>> 2010/1/19 Matthias Kaehlcke <matthias@kaehlcke.net>:
>>>>>> El Tue, Jan 19, 2010 at 02:17:22PM +0100 Ricard Wanderlof ha dit:
>>>>>>
>>>>> 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.
>>>>> Another query, does the syslogd/klogd log files also store in jffs2
>>>>> rootfs? Write to jffs2 frequently will reduce flash life cycle.
>>>>>
>>>>> BRs, H. Johnny
>>>>>> --
>>> It seems there are a lot of file-systems I have to study :P. The same
>>> question is
>>> how to split my rootfs? Re-mount /etc, /var to another file-sysyem mtd part when
>>> system boot up?
>>>
> Yes, I know. So if I want set etc directoyr to /dev/mtd5 not in rootfs
> /, I need to add "/dev/mtdblock5 /etc jffs2 defaults
> 0 0" in /etc/fstab file but rootfs doesn't contain /etc
> directory because /etc directoyr is store in /dev/mtdblock5.
> Do you know what I mean? The kernel execute /sbin/init after mount
> rootfs and /sbin/init is link to busybox, busybox will read
> /etc/inittab file to initial. The problem is coming, how busybox to
> read /etc in rootfs before mount /dev/mtdblock5 to /etc? There is no
> program to mount /dev/mtdblock5 to /etc before busybox init execute.
>
> I think I must mistake some concept, please give me a hint.
> Thank you
> BRs, H. Johnny
>
You have two /etc directories: one in the the read-only root file system
and one in the jffs2 fs. In the root fs you have /etc/fstab,
/etc/inittab and any scripts it may call. The init program will mount
/dev/mtdblock5 over the top of the /etc that is in the rootfs, so giving
you the read/write version of /etc. Any files open in the old /etc -
e.g. /etc/inittab - will continue to be open, but any new files opened
in /etc will use the read/write version in jffs2. You can also do some
interesting things with symbolic links... This technique works. I have
used it in several projects.
--
Chris Simmonds 2net Limited
chris@2net.co.uk http://www.2net.co.uk/
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: mount ramdisk rootfs /etc directory to jffs2 filesystem.
2010-01-25 8:27 ` Chris Simmonds
@ 2010-01-25 8:43 ` Johnny Hung
0 siblings, 0 replies; 20+ messages in thread
From: Johnny Hung @ 2010-01-25 8:43 UTC (permalink / raw)
To: chris
Cc: Ricard Wanderlof, linux-embedded@vger.kernel.org, Marco Stornelli,
kernelnewbies, linux-mtd@lists.infradead.org, Matthias Kaehlcke,
linuxppc-dev@lists.ozlabs.org
2010/1/25 Chris Simmonds <chris@2net.co.uk>:
> Johnny Hung wrote:
>>
>> 2010/1/22 Marco Stornelli <marco.stornelli@gmail.com>:
>>>
>>> 2010/1/22 Johnny Hung <johnny.hacking@gmail.com>:
>>>>
>>>> 2010/1/20 Marco Stornelli <marco.stornelli@gmail.com>:
>>>>>
>>>>> 2010/1/20 Johnny Hung <johnny.hacking@gmail.com>:
>>>>>>
>>>>>> 2010/1/19 Matthias Kaehlcke <matthias@kaehlcke.net>:
>>>>>>>
>>>>>>> El Tue, Jan 19, 2010 at 02:17:22PM +0100 Ricard Wanderlof ha dit:
>>>>>>>
>>>>>> 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.
>>>>>> Another query, does the syslogd/klogd log files also store in jffs2
>>>>>> rootfs? Write to jffs2 frequently will reduce flash life cycle.
>>>>>>
>>>>>> BRs, H. Johnny
>>>>>>>
>>>>>>> --
>>>>
>>>> It seems there are a lot of file-systems I have to study :P. The same
>>>> question is
>>>> how to split my rootfs? Re-mount /etc, /var to another file-sysyem mtd
>>>> part when
>>>> system boot up?
>>>>
>> Yes, I know. So if I want set etc directoyr to /dev/mtd5 not in rootfs
>> /, I need to add "/dev/mtdblock5 =A0/etc =A0 =A0 =A0 =A0jffs2 =A0 defaul=
ts
>> 0 =A0 =A0 =A0 0" in /etc/fstab file but rootfs doesn't contain /etc
>> directory because /etc directoyr is store in /dev/mtdblock5.
>> Do you know what I mean? The kernel execute /sbin/init after mount
>> rootfs and /sbin/init is link to busybox, busybox will read
>> /etc/inittab file to initial. The problem is coming, how busybox to
>> read /etc in rootfs before mount /dev/mtdblock5 to /etc? There is no
>> program to mount /dev/mtdblock5 to /etc before busybox init execute.
>>
>> I think I must mistake some concept, please give me a hint.
>> Thank you
>> BRs, H. Johnny
>>
>
I got it. The rootfs contains at least /etc directory, /etc/inittab,
/etc/fstab. Bysybox will read /etc/fstab to mount etc to rootfs's etc
from other partition. Okay, it's reasonable. Another query, how to do
it in many Linux dist as Macro mentioned, use initramfs ? I am sure I
can arrange / to /dev/hda1 and /etc to /dev/hda2.
Thank you so much
BRs, H. Johnny
> You have two /etc directories: one in the the read-only root file system =
and
> one in the jffs2 fs. In the root fs you have /etc/fstab, /etc/inittab and
> any scripts it may call. The init program will mount /dev/mtdblock5 over =
the
> top of the /etc that is in the rootfs, so giving you the read/write versi=
on
> of /etc. Any files open in the old /etc - e.g. /etc/inittab - will contin=
ue
> to be open, but any new files opened in /etc will use the read/write vers=
ion
> in jffs2. You can also do some interesting things with symbolic links...
> This technique works. I have used it in several projects.
>
> --
> Chris Simmonds =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 2net Limited
> chris@2net.co.uk =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 http://www.2net.co.uk/
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-embedded"=
in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at =A0http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 20+ messages in thread