RAM Disks in Linux???

Mike dugan at libwais.sonoma.edu
Fri Jul 9 11:26:20 PDT 1999


I can only offer a brief message right now, due to my slow link (I am out
of state)

You may want to examine kernel options:
INITRD, RAMDISK, LOOPBACK, and ISO9660 + FAT (or whatever FS you will be
putting on the CD-ROM) and of course ext2 built into the kernel.

Add all harware support into your kernel that wil be needed by any service
during boot. Modules can be used if you wish, but do not make anything
needed during boot a module.

Then you can go one of many routes:
One for example:
Make your root fs a RAMDISK and mount the CD-rom in an appropriate
location.
Special things to examine and pay attentions to:
 /var/log (and similar /var sub directories)
  daemons and service often like to write things to disk or test to see if
they can write to disk or edit config files, or ....
 /var and /etc contain files that are sometimes modified one way or
another and you may need a network share or hard disk for these if you
plan on ever keeping or examining logs, or changing a password...

how about /tmp ?
/tmp needs some space since many programs use space in temp as a cache or
for storage of file being edited. If you /tmp is not writable or you do
not have enough space in temp for writing, many programs will refuse to
run...

/proc should be no problem

Except for the mounting of it if /etc/ is not writeable then the mtab file
does not get updated and mounting become a little more difficult. You have
to tell mount to not write to /etc/mtab when mounting a fs. This can cause
problems since a "mount" will not show the fs asbeing mounted, and other
problems can exist... 

There are other issues to take into consideration when creating a system
that has a "/" (or special dirs near "/") that are not writeable.

When I get back I will try to offer more reasons, ond things to examine,
but for now, I can only send short messages since the toll charges are
killing me....

-ME

 On Thu, 8 Jul 1999, David Cole wrote:

> Date: Thu, 08 Jul 1999 20:13:49 -0700
> From: David Cole <metalgrow at cds1.net>
> Reply-To: nblug-talk at lists.sonic.net
> To: nblug-talk at lists.sonic.net, Mike <dugan at libwais.sonoma.edu>
> Cc: MetalGrow at cds1.net
> Subject: Re: RAM Disks in Linux???
> 
> Mike,
>   My question comes from two directions,  and if the kernal and 
> all the daimeons use the swap only on ram overflow then one of 
> my reasons is dead.
> 
> But my main reason is:
>   I want to eventually build a diskless Web server out of this 
> PII 400 128Mb.  With it serving its data from a 20Mb ram disk. 
> Booted and Loaded from a CD.
>    Like those wonderful diskless machines you've got going at 
> SSU's Library.  (I drooled when I heard about them :-)..  
>    But not booting off a critical server but off a CD ROM.
> 
>    Because of the thousands of miles of physical distance between 
> me and my servers, and my static content,
> 1) I'm trying to design a server that when I reboot it or it's 
> watch dog timer reboots it,  it gets a fresh copy from a CD which 
> is year to year much more data relyable than a HD.  
> 2) And when I need a volunteer, local to the server, install(rarely) 
> a new version of the site,  I want them to just replace the CD with 
> one I send snail mail,  because my volunteer will most likely be a 
> non-technical college student of that campus. (Shudder)
> 
> 
> My reason for asking was...
>    I have a Standard Red Hat Linux Server NEC Pentium150 w/ 96Mb RAM 
> who's entire site contents is a static 20MB with about 30 test hits 
> per day that goes corrupt after a week...reboot it and it's fine for 
> another week.  I was guessing the HD swap area has bad bits that 
> slowly gives Linux "kernel panic" Or a random speckled colored 
> screen saver and lock up, where there wasn't a screen saver.  I have 
> reasons to suspect the HD, but if what you say is true how could the 
> HD corrupt the kernel in a standard RH 5.2 Server install???
>    I've seen the HD light blink when used when it had no reason to go 
> to HD.  From what you said it must have been a log file updating?  
> unless the kernel is using it to swap between daimeons???
> 
> Thanks
>    David
> 
> 
> Mike wrote:
> > 
> > Swap space is supposed to be for when you run out of memory (RAM) and you
> > need more memory. Why not just set your newly added memory to be part of
> > your OS so that it is available to all of your programs, and then when you
> > exhaust real memory (RAM) your can go into SWAP space....
> > 
> > Are you having problems with the aparent 64Mb limit being autodetected by
> > Linux?
> > 
> > If you knowexactly how much memory you have and none if this memory is
> > shared with your video card (like seom modern machines do) then you can
> > just as an entry to yout /etc/lilo.conf like:
> > append="mem=128M"
> > 
> > so that you TELL your kernel how much memory you have.
> > 
> > What you state can be done, but the reasons seem  ??
> > 
> > If you REALLY want to be cruel to your CPU you could:
> > enable lookpack support,
> > 3DES fs encryption,
> > RAM Disk support, and
> > then create a ramdisk, use dd to write out some block sized fileonto the
> > ramdisk. Setup the file on the loopback interface with encryption. Mount
> > the loopback interface as swap and really consume CPU cycles! (Joke)
> > 
> > What purpose are you trying to solve by enabling RAM to be a SWAP via
> > RAMDisk?
> > 
> > It is possible tha there are reasons for this that I have not thought
> > about, and I am willing to hear them...
> > 
> > -M
> > 
> >  On Thu, 8 Jul 1999, David Cole wrote:
> > 
> > > Date: Thu, 08 Jul 1999 18:44:18 -0700
> > > From: David Cole <metalgrow at cds1.net>
> > > Reply-To: nblug-talk at lists.sonic.net
> > > To: nblug-talk at lists.sonic.net, dustin at sonic.net, vulpia at sonic.net
> > > Cc: MetalGrow at cds1.net
> > > Subject: RAM Disks in Linux???
> > >
> > > Help!!!
> > >   I can use any sugestions, I can't find anything about this online

> > >
> > > With PC100 memory prices as low as $30 for 64Mb,
> > > I want to try a RAM Linux SWAP Drive,
> > > instead of Hard Drive system Linux SWAP Partition.
> > >
> > > Does anyone even have a guess at how I would do it.
> > > I have Red Hat 5.2, Pentium II 400 with 128Mb of PC100SD Ram.
> > > I would like to use about 64Mb for general RAM
> > > and 64Mb Ram System SWAP Drive???
> > > This would be for my CGI web server Linux box.
> > >
> > > I know it’s killing a knat with an elephant gun,
> > > but it sounds hard enough to be fun.
> > >
> > > More stable system:  Long term, Ram doesn’t corrupt bits
> > > like Hard Drives can :)
> > > And oooboy it’d be fast :)
> > > the performance difference between RAM and any HD is huge.
> > > You can run a 486DX2 out of ram faster than you can run a
> > > PII out of a SCSI Hard Drive.
> > > Hard Drives are in milliseconds and RAM is in nanoseconds.
> > >
> > > Thanks
> > >    David Cole
> > > email: MetalGrow at cds1.net
> > >
> 




More information about the talk mailing list