On Tuesday 14 September 2004 16:17, Luke Albers wrote:> I would like to have two compressed ext2 filesystems on my CF card, one
> for the root fs and the other smaller one to be mounted at /opt/XXX
> where I can compress what is in ram after modification and write it back
> to disk at regular intervals of time.
>
> can anyone tell me how I can do this?
>
> Thanks
Oooh, that's a hard one. Well, first thing that comes to mind is good old
cron, but you're facing a big problem regardless of how you do it: what
shall
the routine that compresses the FS do when the FS changes while it is
compressing ? You'll surely run into corrupted FS's sometime, I think.
The other thing to think about is that you should minimize writing to CF's
because the more often you write to them the sooner they'll fail (thus if
you
have a FS on a CF you should mount it with the "noatime" option so
that the
FS driver doesn't write timestamps). This means writing to the CF in regular
intervals is propably a bad idea.
I have an idea on how to solve this, maybe it suits you:
I guess that the stuff in /opt/xxx can be summarized into two categories:
stuff that changes and stuff that's static. If the static stuff is taking up
the majority of space you could do the following:
The root fs is a compressed image. It contains a compressed file trees (I'd
use .cpio.bz2 for this). This compressed file tree gets extracted into a
ramdisk and holds all your static stuff, let's say that this ramdisk is
mounted at /static.
Then you have a normal, uncompressed partition which has symlinks into the
/static tree.
Let's say your /opt/xxx looks like this:
/opt/xxx/etc/config.conf
/opt/xxx/etc/...
/opt/xxx/bin/ -> /static/bin/
/opt/xxx/mixed/anotherconfig.conf
/opt/xxx/mixed/anotherstatic -> /static/mixed/anotherstatic
I hope you understand what I mean. This way all you're dealing with is
read-only compressed data and uncompressed read/write data.
C'ya,
Marc
--
Marc Haisenko
Linux Solutions
Be O.K. service group GmbH
R?desheimer Stra?e 7
D-80686 M?nchen
Tel: +49 (0)89 - 54 84 99 73
Fax: +49 (0)89 - 54 84 99 28
e-mail: haisenko at be-ok.com
http://www.be-ok.com