Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 12-07-2007, 06:55 AM   #1
Crack Kid
LQ Newbie
Registered: Dec 2007
Posts: 4

Rep: Reputation: 0
Copying OS entirely to RAM?

This may be a profoundly and blatantly stupid idea; if so, I apologize.

Would it make sense to set things up somehow so that on bootup, the entirety of the OS (and perhaps some common apps) is copied to RAM?

My laptop has 2 GB of ram that are currently very heavily underutilized (I inherited it from a gamer cousin who had much greater needs than my prosaic web-browsing, document editing and media viewing), and it seems to me that hard drive access is the bottleneck to its speed. Also, I figure that this would result in a somewhat longer battery life as the hard drive would have to spin up less on the whole. I realize this will increase the bootup time considerably, but this seems like a reasonable tradeoff.

Would this be a good idea? If so, how would I go about doing it? Also, what would be a good lightweight distro to use? The idea was inspired by Slax's copy2ram feature, but it's creator seems obstinate that it's not to be installed.
Old 12-07-2007, 07:09 AM   #2
Senior Member
Registered: Oct 2005
Location: UK
Distribution: Slackware
Posts: 1,847

Rep: Reputation: 128Reputation: 128
Such a distribution already exists: Puppy Linux

There may be others that load entirely into RAM, but Puppy's the one I've used. Initially it runs as a liveCD, but you can save your current session onto a USB stick, so next time your boot the liveCD, it'll restore your settings (installed applications etc.). I used it on a Duron 750MHz with 512MB RAM and it was blazingly quick Well worth a shot, if nothing else.

Doing this with a preinstalled system would be difficult, but not impossible. I'd suggest trying Puppy first.
Old 12-07-2007, 07:13 AM   #3
LQ Newbie
Registered: Jul 2007
Posts: 21

Rep: Reputation: 15
post deleted

Last edited by Nitram; 12-07-2007 at 07:14 AM.
Old 12-07-2007, 07:13 AM   #4
LQ Guru
Registered: Jan 2004
Location: NJ, USA
Distribution: Slackware, Debian
Posts: 5,852

Rep: Reputation: 361Reputation: 361Reputation: 361Reputation: 361
You are right, removing the HDD from the equation will greatly increase system performance. Setting a system up like this is not uncommon, though you should be prepared to do a lot of manual work to make things perfect.

The basic concept is that you put together a slim install of a distribution (I have used Slackware in the past, it's simplicity prevents some headaches), optimize it and set it up as best as possible, and then compress the whole thing into an image with gzip. Using an appropriate bootloader, you then pass this image to the kernel as the initrd (Initial RAM Disk) and the kernel boots to it as if it were on a normal drive.

Traditionally, initrds are only minimal systems that get the machine booted (think like an emergency failsafe to boot the machine no matter what you did to the filesystem on the HDD), but there is nothing stopping you from building an entire OS into an initrd (besides RAM), indeed, this is the basic concept behind Live CDs.

Here are some pages you might want to check out to familiarize yourself with the concept and specifics. The second link should be especially helpful, even though in this example they are using Compact Flash (of course, you could do that as well).

Linux initial RAM disk overview
Booting Linux from Compact Flash
Linux Live for CD & USB
Old 12-07-2007, 07:22 AM   #5
Crack Kid
LQ Newbie
Registered: Dec 2007
Posts: 4

Original Poster
Rep: Reputation: 0
Well that was fast. Thanks for the quick reply.

Thanks for the suggestion, but I really would like an OS that resides on the hard drive, but gets copied over to RAM on start up; I don't want to be forced to stick in a USB stick every time I turned on my computer (Wouldn't that approach also be slower than saving to a hard drive due to USB's lower data transfer speeds?). Also, I'm a bit averse to a distro that has both a unique package manager and a small user base, as this increases the chance that I'll need some program not in its repositories (it says it can use slackware packages but says only they "may work").

I realize that doing this would be difficult with a pre-existing OS, but I have a separate partition for my OS, so I can change it without losing my files.
Old 12-07-2007, 07:23 AM   #6
Senior Member
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109

Rep: Reputation: 97

Linux already does this to some extent, and your RAM may not be as under-utilised as you think. When a file is accessed, a copy is (usually) kept in RAM in the disk cache. Next time the file is accessed, the RAM copy is used, instead of the disk copy. Application code generally takes priority over disk cache, so if you launch a big app some of the disk cache will be dropped (meaning the files in that part of the cache will have to be read from disk next time), but the system's pretty intelligent about how this operates.

It doesn't copy everything to RAM at boot, but regularly used files will end up in the RAM disk cache in pretty short order, so the speed-up would likely be marginal anyway.

Check the output from 'free' to see what's really going on with your RAM. This is from my mail server:
             total       used       free     shared    buffers     cached
Mem:        485092     463796      21296          0     111228     135512
-/+ buffers/cache:     217056     268036
Swap:      1052248         48    1052200
From this, there's about 250MB of filesystem stuff in RAM available at RAM speeds. Which is nice.

Old 12-07-2007, 07:40 AM   #7
Crack Kid
LQ Newbie
Registered: Dec 2007
Posts: 4

Original Poster
Rep: Reputation: 0
Hmm, two rather contradictory replies. >.<

I guess I'll see what's going on with 'free' when I get back to my own computer and move from there.

That said, I'd love to hear if there are more n00b-friendly ways. If there are, I may try it out just to see any difference there might be for myself.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
FC 6 - missing RAM - Intel S5000PSL Board - 16GB RAM meofcourse Linux - Hardware 11 12-20-2007 03:21 AM
RAM: Does linux require as much ram as Windows XP? hanzj Linux - Newbie 48 04-18-2007 12:14 AM
256 ram shows as 183284 total ram phreakshew Linux - Hardware 6 08-21-2006 02:37 PM
Buying RAM - must match old RAM? slackaddict Linux - Hardware 5 11-12-2005 01:38 PM
Win98SE Pentium166MMX/64MB RAM vs Linux AthlonXP+ 3000/512MB RAM : Lucent LT WinModem t3gah Linux - Software 2 04-22-2005 01:01 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:43 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration