Re: Read only Disk and Ram-Drive

From: Karsten Kruse (tecneeq_at_tecneeq.de)
Date: 06/18/04


Date: Fri, 18 Jun 2004 00:45:36 +0200


On Wed, 16 Jun 2004, Oded wrote:

> Can a Linux system, running just X, a simple window-manager, and a
> Java application be completly read-only ( use the disk as Read-only) ?

Yes.

> If it does have to write to the disk ( like maybe the to /var ), how
> can I set up a ram-drive so that it will write to ram while thinking
> it's writing to disk ( like is done in Live CD's )?

You simply mount tmpfs to /var, /home, /tmp and everywhere else you need
rw access and populate it with the needed stuff at boottime.

Another solution is the translucency overlay filesystem:

Example (/tmp is the only rw filesystem, for example tmpfs):

#> cat /etc/foo
batz
#> echo "bar" >> /etc/foo
bash: /etc/foo: Read-only file system
#> insmod translucency
Using /lib/modules/2.4.18/kernel/fs/translucency.o
#> echo "/ -> /tmp" > /proc/sys/translucency/0
#> echo "bar" >> /etc/foo
#> cat /etc/foo
batz
bar
#> echo > /proc/sys/translucency/0
#> rmmod translucency
#> cat /etc/foo
batz
#> cat /tmp/etc/foo
batz
bar

You can grab Kernelpatches for overlay-fs here:
  http://translucency.sourceforge.net/

Karsten

-- 
         Homepage, Mac68k, A/UX-Links und Shorties: www.tecneeq.de
   ()    Linux/NetBSD-Anleitungen, Forum  und Chat: www.newbie-net.de
  <\/>
  _/\_   Slowly and surely the unix crept up on the Nintendo user ...