LinuxQuestions.org
Visit Jeremy's Blog.
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 08-30-2008, 05:36 AM   #1
MasterOfTheWind
Member
 
Registered: Jul 2004
Distribution: Arch, Debian sid, Kubuntu, Slackware 11
Posts: 324

Rep: Reputation: 30
Running Linux purely from RAM


Hi!

I am planning on upgrading my 4GB RAM machine to 8GB. In connection with this upgrade I got an idea:

Is it possible for me to run Linux purely from RAM? Not in the same way as a live CD, but something like:

1) On boot a ramdisk is loaded from a harddrive into memory. It includes all files you would expect to have in a usual installation.
2) From then on all read/writes happen to RAM, not any physical disk
3) When I shutdown my computer, RAM is copied back to the harddrive to save all changes I did during my work day.

Any suggestions / thoughts?

Thanks in advance
 
Old 08-30-2008, 06:08 AM   #2
arizonagroovejet
Senior Member
 
Registered: Jun 2005
Location: England
Distribution: openSUSE, Fedora, CentOS
Posts: 1,094

Rep: Reputation: 198Reputation: 198
Quote:
Originally Posted by MasterOfTheWind View Post
Hi!

Any suggestions / thoughts?
That even if such a thing is possible then you shouldn't do it because it would ensure that you loose "all changes I did during my work day" in the event of a power failure. Think about it - what happens to stuff in ram when the power is cut unexpectedly? I guess you could use a UPS.

That it would be a pretty much pointless exercise overall. What's the advantage supposed to be? I guess in theory there would be a speed boost to some degree but it would save you, what, maybe a couple of minutes of waiting for applications to load over the course of a day at the very most? And most of that would be negated by the time taken to load the stuff off the harddisk in the first place.
 
Old 08-30-2008, 07:22 AM   #3
pinniped
Senior Member
 
Registered: May 2008
Location: planet earth
Distribution: Debian
Posts: 1,732

Rep: Reputation: 50
The usual practice is to use ramfs (same as running a "live CD") but that seems like a waste of good RAM ... the /home directory is normally still on the HD and r/w.

The only advantage I can see to this, and even this is dubious, is that no system changes are persistent (installed a new system-wide program? Gone on the next reboot!) I guess there may be some advantage on Flash memory like USB sticks, but the 'home' directory will still wear down.
 
Old 08-30-2008, 07:52 AM   #4
huwnet
Member
 
Registered: Jan 2006
Location: England
Distribution: Arch
Posts: 119

Rep: Reputation: Disabled
You could use unionfs with your harddrive and a ramdrive however I believe this would only allow you to keep a copy in memory once it has been modified (copy on write)
 
Old 08-30-2008, 08:08 AM   #5
jimiv
LQ Newbie
 
Registered: Aug 2008
Posts: 3

Rep: Reputation: 0
Puppy linux

Try Puppy linux works for me
 
Old 08-30-2008, 09:54 AM   #6
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1194Reputation: 1194Reputation: 1194Reputation: 1194Reputation: 1194Reputation: 1194Reputation: 1194Reputation: 1194Reputation: 1194
Quote:
Originally Posted by MasterOfTheWind View Post
Is it possible for me to run Linux purely from RAM?
Is there a problem, other than ordinary performance issues, with using the hard drive during normal operation?

Quote:
1) On boot a ramdisk is loaded from a harddrive into memory. It includes all files you would expect to have in a usual installation.
I don't think you really want to take that extra time during boot, vs. having Linux automatically read each item from disk once on first use.

Quote:
2) From then on all read/writes happen to RAM, not any physical disk
If you really have enough extra ram (vs. the work you're trying to make Linux do) that your idea could work, ordinary file caching will occur such that files are only read from disk on first access and then remain in the cache. So the read part takes nothing to accomplish. Linux will just do it if you have enough ram.

For write, I think you can set up the right kind of tempfs (I forget details between tempfs versions) such that most of the physical ram will be allocated (taken away from the caching of read only files) only when actually used.

Then use aufs to mask the entire hard drive (copy on write) so that any file when modified will be moved from the file cache to the tempfs.

Quote:
3) When I shutdown my computer, RAM is copied back to the harddrive to save all changes I did during my work day.
See the aufs documentation (I remember general concepts, not specific details). There is something you could put in a shutdown (or other) script to sync the changes back to the original media.

Quote:
Any suggestions / thoughts?
Others mentioned the obvious risk of all forms of unexpected shutdowns before you get a chance to sync files.

In much of my own computer use, most files created exist for only a short time and have no value past the next reboot, and there is usually plenty of ram to keep them in ram. I'd like to figure out a way to use some tempfs to reduce the work the fs does i creating and deleting those files. But they and the files I want to keep are distributed through the directory tree. I would need a much trickier use of aufs than I described above to accomplish what I want and I haven't figured it out yet.

If your intent is to cut the workload on all the files created and deleted that should never need to be synced to disk, I still think you're taking too much risk with all the files that you do want synced to disk.

If your intent is something else, I don't get it at all.

Last edited by johnsfine; 08-30-2008 at 09:58 AM.
 
Old 08-30-2008, 12:22 PM   #7
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Linux 9 (stretch)
Posts: 3,361

Rep: Reputation: 127Reputation: 127
Would it be possible to have a RAID1 where one drive was on disk, and the other drive was ram created at boot time? Just an idea.

Added:
Nah, I guess that's kind of redundant to normal memory caching, isn't it? Never mind.

Last edited by Quakeboy02; 08-30-2008 at 12:42 PM.
 
Old 08-30-2008, 01:48 PM   #8
j.todd
Member
 
Registered: Feb 2008
Location: Michigan
Distribution: Debian GNU/Linux Unstable
Posts: 144

Rep: Reputation: 16
IssacKuo (sp?) has a howto on how to do this here and at forums.debian.net in the howto section.
 
Old 08-31-2008, 12:12 AM   #9
Micro420
Senior Member
 
Registered: Aug 2003
Location: Berkeley, CA
Distribution: Mac OS X Leopard 10.6.2, Windows 2003 Server/Vista/7/XP/2000/NT/98, Ubuntux64, CentOS4.8/5.4
Posts: 2,986

Rep: Reputation: 45
Sort of... This would work fine with a shared disk, such as a NAS or SAN. All data files would be written through the network onto a shared drive. In fact, this is very common with diskless systems. The only downside is that at every bootup, your machine would use PXE to pull an image from an image server.

So yes, what you ask for is somewhat possible.
 
  


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: Binary blobs mean few apps are purely open source LXer Syndicated Linux News 0 08-27-2006 08:21 PM
Purely Curiosity: access files from one HD partition to another, but not vice versa. beezum88 Linux - Desktop 1 08-14-2006 07:28 PM
any linux distro can running in RAM , not need CD_ROM reading when running. wangcity Linux - General 3 09-18-2003 06:45 AM
EXTREME Success, due purely to the members here. sickboylives LinuxQuestions.org Member Success Stories 4 08-07-2003 11:55 AM
Trying to mount a purely NTFS RAID0 (PDC20276) klasikahl Linux - Hardware 4 08-12-2002 04:19 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

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

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration