Using Linux in RAM... - Networking
This is a discussion on Using Linux in RAM... - Networking ; I've got Fedora 9 on my pc, and I want to run it out of RAM, essentially
making the disk read-only. Can anyone point me to some instructs for this?
Thanks....
-
Using Linux in RAM...
I've got Fedora 9 on my pc, and I want to run it out of RAM, essentially
making the disk read-only. Can anyone point me to some instructs for this?
Thanks.
-
Re: Using Linux in RAM...
Christian Williamson wrote:
> I've got Fedora 9 on my pc, and I want to run it out of RAM, essentially
> making the disk read-only. Can anyone point me to some instructs for this?
>
> Thanks.
well making a ramdisk and using it for swap is not hard..
I am less sure about other processes that use disk..I guess you could
have a /tmp in ramdisk as well..and log files..well a patch to syslog to
make it either junk log files or write them to somewhere else would be
called for.
I take it this is for a very stripped down specific application?
-
Re: Using Linux in RAM...
Hello,
The Natural Philosopher a écrit :
>
> well making a ramdisk and using it for swap is not hard..
And is definitely totally useless.
PS : what does this have to do with networking ?
-
Re: Using Linux in RAM...
The Natural Philosopher wrote:
> Christian Williamson wrote:
>> I've got Fedora 9 on my pc, and I want to run it out of RAM, essentially
>> making the disk read-only. Can anyone point me to some instructs for
>> this?
>>
>> Thanks.
> well making a ramdisk and using it for swap is not hard..
>
> I am less sure about other processes that use disk..I guess you could
> have a /tmp in ramdisk as well..and log files..well a patch to syslog to
> make it either junk log files or write them to somewhere else would be
> called for.
>
>
> I take it this is for a very stripped down specific application?
I haven't stripped it down. I ran a script to see how many files were
changed from boot, and it ended up being over 34,000 files, 26,000 of
them in /proc. See
http://www.mydigitallife.info/2006/0...e-ago-in-unix/
for the find command.
I'd like to boot from the disk as if it's read-only, then run everything
out of ram.
-
Re: Using Linux in RAM...
The Natural Philosopher wrote:
> Christian Williamson wrote:
>> I've got Fedora 9 on my pc, and I want to run it out of RAM, essentially
>> making the disk read-only. Can anyone point me to some instructs for
>> this?
>>
>> Thanks.
> well making a ramdisk and using it for swap is not hard..
>
> I am less sure about other processes that use disk..I guess you could
> have a /tmp in ramdisk as well..and log files..well a patch to syslog to
> make it either junk log files or write them to somewhere else would be
> called for.
>
>
> I take it this is for a very stripped down specific application?
I haven't stripped it down. I ran a script to see how many files were
changed from boot, and it ended up being over 34,000 files, 26,000 of
them in /proc. See
http://www.mydigitallife.info/2006/0...e-ago-in-unix/
for the find command.
I'd like to boot from the disk as if it's read-only, then run everything
out of ram.
-
Re: Using Linux in RAM...
Pascal Hambourg wrote:
> Hello,
>
> The Natural Philosopher a écrit :
>>
>> well making a ramdisk and using it for swap is not hard..
>
> And is definitely totally useless.
>
Why? if the OS wants to see swap, give it some..it may be happier that
way than simply removing swap altogether.
> PS : what does this have to do with networking ?
no idea. I fund it in linux group..ah - cross posted.
Sorry about that.
I didn;t notice.
-
Re: Using Linux in RAM...
Pascal Hambourg wrote:
> Hello,
>
> The Natural Philosopher a écrit :
>>
>> well making a ramdisk and using it for swap is not hard..
>
> And is definitely totally useless.
>
> PS : what does this have to do with networking ?
I could boot over the network and place everything in ramdisk.
-
Re: Using Linux in RAM...
On Thu, 2008-09-18 at 09:58 +0000, Christian Williamson wrote:
> The Natural Philosopher wrote:
> > Christian Williamson wrote:
> >> I've got Fedora 9 on my pc, and I want to run it out of RAM, essentially
> >> making the disk read-only. Can anyone point me to some instructs for
> >> this?
> >>
> >> Thanks.
> > well making a ramdisk and using it for swap is not hard..
> >
> > I am less sure about other processes that use disk..I guess you could
> > have a /tmp in ramdisk as well..and log files..well a patch to syslog to
> > make it either junk log files or write them to somewhere else would be
> > called for.
> >
> >
> > I take it this is for a very stripped down specific application?
>
> I haven't stripped it down. I ran a script to see how many files were
> changed from boot, and it ended up being over 34,000 files, 26,000 of
> them in /proc. See
> http://www.mydigitallife.info/2006/0...e-ago-in-unix/
> for the find command.
>
> I'd like to boot from the disk as if it's read-only, then run everything
> out of ram.
The only things that need to be read/write are /tmp, /var/tmp, /var/run
and /var/log. They can be ramdisks. /dev, /proc and /sys are pseudo
filesystems: they have no real existence; the kernel will create them
out of thin air. You should configure your system to do almost no
logging, as that is normally a space hog.
You do not need swap provided that all your programs will fit in RAM. If
the do not fit then you will need real swap on a real external device.
That device can, in theory, be network mounted but will be incredibly
slow (for a swap device).
I run all my servers with most of the file space mounted
read-only. /var, as the name implies, is variable and I therefore have
it on a separate partition. /tmp I put on a smallish (10Mb) loop-back
file system inside /var/tmp. Swap space I normally configure to twice
the RAM size.
/home may be read-only or read/write, depending on what your machine is
doing.
However /root, /bin, /etc, /usr, /lib, /sbin, /opt and /boot are all on
one read-only partition.
-
Re: Using Linux in RAM...
The Natural Philosopher a écrit :
>>
>>> well making a ramdisk and using it for swap is not hard..
>>
>> And is definitely totally useless.
>
> Why? if the OS wants to see swap, give it some..it may be happier that
> way than simply removing swap altogether.
Why would the system want to see swap ? Linux does not need swap to
operate. AFAIK, swap space may be used for two reasons.
1) Free some RAM for processes or disk cache. Obviously, creating swap
space in RAM won't free any RAM. On the contrary, it will consume some
RAM even though swap is not needed.
2) Suspend-to-disk. Obviously again, swap space in RAM cannot be used
for this.
-
Re: Using Linux in RAM...
Raphael Mankin a écrit :
>
> /dev, /proc and /sys are pseudo filesystems
Not /dev. It may be a tmpfs, but it may also just be (part of) a regular
filesystem.
-
Re: Using Linux in RAM...
Christian Williamson a écrit :
>
> I could boot over the network and place everything in ramdisk.
If you want to boot over the network then say it explicitly because it
is a specific matter.
If you want to boot from a local read-only medium, you may want to
consider UnionFS . It allows to
merge read-only (local medium) and read-write (ramdisk or tmpfs)
filesystems into one read-write filesystem. This is used by some Live
CDs in order to save RAM.
-
Re: Using Linux in RAM...
Pascal Hambourg wrote:
> Christian Williamson a écrit :
>>
>> I could boot over the network and place everything in ramdisk.
>
> If you want to boot over the network then say it explicitly because it
> is a specific matter.
>
> If you want to boot from a local read-only medium, you may want to
> consider UnionFS . It allows to
> merge read-only (local medium) and read-write (ramdisk or tmpfs)
> filesystems into one read-write filesystem. This is used by some Live
> CDs in order to save RAM.
Thanks. BTW, Pascal, which group do you think I should I have posted the
original in?
-
Re: Using Linux in RAM...
"Christian Williamson" wrote
> The Natural Philosopher wrote:
>> Christian Williamson wrote:
>>> I've got Fedora 9 on my pc, and I want to run it out of RAM, essentially
>>> making the disk read-only. Can anyone point me to some instructs for
>>> this?
>>>
>>> Thanks.
>> well making a ramdisk and using it for swap is not hard..
>>
>> I am less sure about other processes that use disk..I guess you could
>> have a /tmp in ramdisk as well..and log files..well a patch to syslog to
>> make it either junk log files or write them to somewhere else would be
>> called for.
>>
>>
>> I take it this is for a very stripped down specific application?
>
> I haven't stripped it down. I ran a script to see how many files were
> changed from boot, and it ended up being over 34,000 files, 26,000 of
> them in /proc. See
Um .... I thought files in /proc were not actually stored on the disk??
-
Re: Using Linux in RAM...
Magnate wrote:
> "Christian Williamson" wrote
>> The Natural Philosopher wrote:
>>> Christian Williamson wrote:
>>>> I've got Fedora 9 on my pc, and I want to run it out of RAM,
>>>> essentially
>>>> making the disk read-only. Can anyone point me to some instructs for
>>>> this?
>>>>
>>>> Thanks.
>>> well making a ramdisk and using it for swap is not hard..
>>>
>>> I am less sure about other processes that use disk..I guess you could
>>> have a /tmp in ramdisk as well..and log files..well a patch to syslog to
>>> make it either junk log files or write them to somewhere else would be
>>> called for.
>>>
>>>
>>> I take it this is for a very stripped down specific application?
>>
>> I haven't stripped it down. I ran a script to see how many files were
>> changed from boot, and it ended up being over 34,000 files, 26,000 of
>> them in /proc. See
>
> Um .... I thought files in /proc were not actually stored on the disk??
I dont think they are..
-
Re: Using Linux in RAM...
Pascal Hambourg wrote:
> The Natural Philosopher a écrit :
>>>
>>>> well making a ramdisk and using it for swap is not hard..
>>>
>>> And is definitely totally useless.
>>
>> Why? if the OS wants to see swap, give it some..it may be happier that
>> way than simply removing swap altogether.
>
> Why would the system want to see swap ? Linux does not need swap to
> operate. AFAIK, swap space may be used for two reasons.
>
Well if it doesn't then of course that is a useless suggestion..I
thought it needed it there, even if it didn't use it.
-
Re: Using Linux in RAM...
-
Re: Using Linux in RAM...
On Thu, 18 Sep 2008 08:31:57 +0000, Christian Williamson wrote:
> I've got Fedora 9 on my pc, and I want to run it out of RAM, essentially
> making the disk read-only. Can anyone point me to some instructs for this?
>
> Thanks.
>
This works in theory. Practical limits may be another matter, though.
Certain rescue environments work in RAM because they are small enough to
fit while leaving enough free memory for the OS to use as RAM. The problem
comes with the magnitude of a full install of a modern GNU/Linux. I
do not use FC 9, but I assume a full install consumes over 4G of hard
disk space. If that is written to RAM, then it might work (in theory) if
your box has 5G or more RAM (leaving 1G for the OS itself). In addition to
the full amount of RAM, you also need a motherboard capable of using
the RAM, and a PAE enabled kernel (for a 32-bit kernel), or if you have
compatible hardware then a 64-bit kernel be used.
Other options...
1. If you have the RAM, then I guess your initrd can be your root
filesystem. There will be some delay as the initrd is read into RAM at
boot. There could also be some size limits for the initrd which I am not
aware of. I have only used initrd's which were less than 256M.
2. You can have a root filesystem on tmpfs. IIRC, tmpfs uses half of
available RAM by default. There is an IBM article written by Robbins on
the topic.
http://www.ibm.com/developerworks/library/l-fs3.html
3. An easier "performance" solution is to get the fastest read media
available. 8G of flash memory is very affordable now. It has the
advantage over your method (AIUI) in that the storage is local and does
not need not be transmitted for each new boot. Only the portions of the
filesystem which are used are ever placed in memory at all, etc.
--
Douglas Mayne
-
Re: Using Linux in RAM...
On 2008-09-18, Christian Williamson wrote:
> I've got Fedora 9 on my pc, and I want to run it out of RAM,
> essentially making the disk read-only. Can anyone point me to
> some instructs for this?
What you're describing is generally referred to as a "livecd".
If you're interested in building one of your own, then Google
for "build linux livecd".
If you just want to download one and run from it, then just go
to distrowatch and download one.
--
Grant Edwards grante Yow! I like the way ONLY
at their mouths move ... They
visi.com look like DYING OYSTERS
-
Re: Using Linux in RAM...
Christian Williamson writes:
> I've got Fedora 9 on my pc, and I want to run it out of RAM, essentially
> making the disk read-only. Can anyone point me to some instructs for this?
Once I did something similar but with Debian. The machine was a
diskless box, and it booted over the network. Then it mounted a
root partition through nfs, created a local filesystem (AFAIR
it was tmpfs), copied the root to this new fs in ram, pivot
root, umount nfsroot, etc. It even ran X out of ram.
The good thing about this is that it is very easy to add a cloned
machined to the network. (which is very useful in a regulated
environment). There is no worry about backing up root partitions
and restoring if a machine/disk fails. The nfs server can be
a simple default linux install with dhcp/nfs enabled, and all
you need to worry about is the backup of some config files and
the exported root directory structure. Very easy to restore in
case of a disaster.
The downside is that ram is wasted. However, today ram is
cheap, and after a good pruning, I cut down the root partition
to a very reasonable size.
Another downside is that you will go through a lot of misery,
and it is not something that somebody can really help you
from a remote location at the beginning, when help is actually
needed. The upside is that you will learn a lot.
Vilmos
-
Re: Using Linux in RAM...
"Magnate" writes:
>
> Um .... I thought files in /proc were not actually stored on the
> disk??
That's correct. Every piece of hardware in UNIX is accessed through a
filename. In particular, /proc is a special filesystem:
#
proc /proc proc defaults 0 0
See proc(5)
The proc filesystem is a pseudo-filesystem which is used as an inter-
face to kernel data structures. It is commonly mounted at /proc. Most
of it is read-only, but some files allow kernel variables to be
changed.