LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 05-26-2008, 04:50 AM   #1
v1pEr
Member
 
Registered: Oct 2004
Location: Belgium
Distribution: winxp + suse 10.1 dual boot
Posts: 88

Rep: Reputation: 15
Run Linux in RAM


Hey all!

I hope this is in the right forum, I first wanted to post it in hardware, but this is not really a hardware "issue", as it is not specific to the hardware.

I (think) am an intermediate Linux user (for some I will be a noob, for others an expert) and I was wondering if it is possible to run linux in RAM memory instead of hard disk.

I suppose a script at startup (runlevel 1) could allocate some RAM space, mount it and copy the right directories to it and mount the RAM directories in the initial directories, but this is just an idea.

Is there a general way to do this? (I searched for it but it is hard to find if you don't know which keywords exactly you have to use ;-))

The purpose of all this is that I have 2GB of RAM and I'm only using 30% at top all the time, except when I'm running Virtualbox, so it would speed up my OS, right?
 
Old 05-26-2008, 05:11 AM   #2
SqdnGuns
Member
 
Registered: Aug 2005
Location: Fountain Valley, CA / Thailand
Distribution: Slackware64Ū 14.0
Posts: 981

Rep: Reputation: 88
Why not use a Live CD/DVD?
 
Old 05-26-2008, 06:01 AM   #3
v1pEr
Member
 
Registered: Oct 2004
Location: Belgium
Distribution: winxp + suse 10.1 dual boot
Posts: 88

Original Poster
Rep: Reputation: 15
I would first try it on a virtual machine and eventually convert my existing configuration, switching to a livecd is not the most elegant option imho, unless there really is no other way.

I would have to do quite some customizing anyway so in the end it would be the same amount of work, no?
 
Old 05-26-2008, 06:07 AM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,050

Rep: Reputation: 971Reputation: 971Reputation: 971Reputation: 971Reputation: 971Reputation: 971Reputation: 971Reputation: 971
Have a look here. Should give you the general requirements.
 
Old 05-26-2008, 06:34 AM   #5
v1pEr
Member
 
Registered: Oct 2004
Location: Belgium
Distribution: winxp + suse 10.1 dual boot
Posts: 88

Original Poster
Rep: Reputation: 15
That looks very interesting, I will check it out and let you know if I managed to do it or not
 
Old 05-26-2008, 07:17 AM   #6
Agrouf
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: LFS
Posts: 1,591

Rep: Reputation: 79
You have to enable ramdisk when compiling your kernel and you can mount any mount point as tmpfs.
You can check unionfs and aufs and use the best of both world: use ramdisk for maximum performance and the hard disk for persistence.
Check puppy linux. this distro does run completely from RAM. It loads file from the HD at boot and save them at shutdown. You loose everything in case of powerdown though.
 
Old 05-26-2008, 01:34 PM   #7
v1pEr
Member
 
Registered: Oct 2004
Location: Belgium
Distribution: winxp + suse 10.1 dual boot
Posts: 88

Original Poster
Rep: Reputation: 15
I will also take a look at this as it seems to fit my needs quite close (run in ram but with persistent data)
 
Old 05-26-2008, 01:50 PM   #8
Emerson
Senior Member
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~
Posts: 3,177

Rep: Reputation: Disabled
Linux, and any other OS runs from RAM. That's the whole idea of RAM - not to rely on that slow hard disk drive. Maybe in future they invent some sort of storage as fast as RAM, then RAM won't be needed any more.
 
Old 05-26-2008, 02:07 PM   #9
v1pEr
Member
 
Registered: Oct 2004
Location: Belgium
Distribution: winxp + suse 10.1 dual boot
Posts: 88

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by Emerson View Post
Linux, and any other OS runs from RAM. That's the whole idea of RAM - not to rely on that slow hard disk drive. Maybe in future they invent some sort of storage as fast as RAM, then RAM won't be needed any more.
but there is a difference between caching files you used before and preloading the whole (at least the most of it) OS into RAM, right?

I mean, Windows XP also uses RAM of course, but you can also put the whole OS into RAM, and it runs definately faster that way.

Or am I wrong and wouldn't it speed up anything?

Edit: The best would be to load everything into RAM at boot and when a file changes, write the changes back to the hdd in the background (so the program/tool/whatever doesn't have to wait for it). Next time the changes will be loaded into the RAM also so everything would be persistent

Last edited by v1pEr; 05-26-2008 at 02:31 PM.
 
Old 05-26-2008, 02:12 PM   #10
Emerson
Senior Member
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~
Posts: 3,177

Rep: Reputation: Disabled
It could speed up loading programs - first time. With 2 GB of RAM next time you use a given program it is very likely cached already. IMO - the whole thing is not worth the effort.
 
Old 05-27-2008, 12:18 AM   #11
Agrouf
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: LFS
Posts: 1,591

Rep: Reputation: 79
Quote:
Originally Posted by v1pEr View Post
Edit: The best would be to load everything into RAM at boot and when a file changes, write the changes back to the hdd in the background (so the program/tool/whatever doesn't have to wait for it). Next time the changes will be loaded into the RAM also so everything would be persistent
That's what puppy does BTW.
 
Old 07-20-2010, 03:56 AM   #12
morriset
LQ Newbie
 
Registered: Jul 2010
Posts: 2

Rep: Reputation: 0
Talking SO Linux in RAM

Hello, I'm new also in this forum and found this subject very interesting. First of all, all the software actually run in RAM as they are loaded from the HDD. In fact you can see how the whole RAM memory is being filled in time... This might be a little bit strange to people to get things done only in RAM... maybe we can use a CD drive or even the HDD, but anyway... there are some people who like to try different things, maybe just for fun... Running the whole system in ram, will actually run as fast as the RAM and processor can handle. And also in might have a very useful applications for mobility projects.

This subject is quite a challenge so far. Because I have tried to achieve run only the distro I like in ram.

My goal is to copy and run from an USB flash memory the whole live CD from the distro I usually use.
But well, the trick relays on the INITRD file. You can grab the INITRD image and mount it in order to modify it. The INITRD file is an image of a small Linux OS that always run in RAM in first place before switching the root directory to the HDD or the corresponding device where the Linux system was installed.

What I want to do is to create a TMPFS mount (RAM) while initrd is running and use dd to copy the image into that directory and then switchroot to the RAM. So far I have achieved to run INITRD and stay there only as a shell (some kind of embedded system). Obviously if I exit the shell, the system crash and gives me backtraces since it did not load the real root.

I do not know if someone have reached this step and I would like to discuss this. The goal is
1. Run a personalized initrd
2. mount a temp filesystem in RAM
3. use DD or other method to copy the image into ram
4. have the image available for switchroot
5. continue the boot process, which in theory it will be all in ram

I'm using a LIVECD image to try this since itīs INITRD image is designed to load the necessary devices in an environment of mobility... this INITRD file is the key. Still trying and proving.

Please, this subject is quite interesting, Keep posting!

счастливо
 
Old 12-26-2011, 07:21 PM   #13
romagnolo
Member
 
Registered: Jul 2009
Location: Montaletto
Distribution: Debian GNU/Linux
Posts: 93

Rep: Reputation: 4
Quote:
Originally Posted by morriset View Post
I do not know if someone have reached this step and I would like to discuss this. The goal is
1. Run a personalized initrd
2. mount a temp filesystem in RAM
3. use DD or other method to copy the image into ram
4. have the image available for switchroot
5. continue the boot process, which in theory it will be all in ram
Your point 2 is wrong: you can't swirchroot to a temp filesystem. However, you were nearly perfect.
Read how I achieved this: http://www.linuxquestions.org/questi...700/page2.html
 
Old 12-27-2011, 04:04 PM   #14
jefro
Guru
 
Registered: Mar 2008
Posts: 11,000

Rep: Reputation: 1356Reputation: 1356Reputation: 1356Reputation: 1356Reputation: 1356Reputation: 1356Reputation: 1356Reputation: 1356Reputation: 1356Reputation: 1356
All sorts of mainstream distro's can be booted to ram if you have enough. Phrases like toram, and a few others that I forget now are the boot time option to run completely from ram.

Other options are booting pxe or gpxe/ipxe to some distro made for that. See also netboot.me. I think there is or was a Fedora network boot to live cd someplace too. Dunno what happened to boot.kernel.org.
 
  


Reply


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Looking for a small Linux that will run with a GUI in 4MB of RAM LXer Syndicated Linux News 3 06-03-2007 03:16 PM
Is it possible to make linux run with xwindow on a 32 mb of ram system VIDEB Linux - Newbie 8 08-02-2005 04:01 PM
Which Linux Distro would run nicely on anything from 300Mhz, 128MB RAM best? Havixx Linux - Distributions 4 12-03-2004 03:43 AM
Best Linux to run on i386 laptop with 500mb hd and 16mb ram Eits0 Linux - Distributions 6 08-19-2002 03:04 PM


All times are GMT -5. The time now is 10:40 AM.

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