[syslinux] mounting other compressed filesystems

Luke Albers gtg940r at mail.gatech.edu
Tue Sep 14 08:28:00 PDT 2004


On Tue, 2004-09-14 at 09:20, Marc Haisenko wrote:
> 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.

I think I could remount the FS in ram as read-only before compressing
it, right?

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

This is why I am considering a separate, probably around 10MB filesystem
when uncompressed.  Basically I only need it to write a few config files
and logs whenever it is turned off, which should not be often
(weeks,months, maybe years).  Although I am thinking I should probably
have it write everything a little more often than that in case of a
power failure or some other event.  But, It wouldn't be a constant
thing.  By "regular intervals" I mean every couple days or every week. 
Since the number of writes should be in the low hundred-thousands, I
thing this should be alright.  Correct me if I am wrong, though.

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

I get your idea and I think I will use parts of it.  I havent thought
about symlinking to an uncompressed partition.  However, space on the CF
card is valuable so I may find out that using a full 10 MB (I may not
even need this much) is out of the question.  It would take the same
amount of space, but it should be easy to do the same thing with another
ext2 image on the FAT16 card.  Compressing it would still be very
helpful, though.

> C'ya,
> 	Marc
Thanks a lot for the suggestions.  If anyone has more please send them
out.  Especially if you can explain to me how to mount another gzipped
filesystem. 
-- 
Luke Albers
Georgia Institute of Technology, Electrical Engineering
Email:  gtg940r at mail.gatech.edu
Web:    www.lukealbers.com





More information about the Syslinux mailing list