LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 04-19-2007, 08:01 PM   #1
Arindam Banerjee
LQ Newbie
 
Registered: Apr 2007
Posts: 2

Rep: Reputation: 0
Installing a File Server on RAM - Is it possible?


Hello,
I would like to know if it is at all possible to create a virtual file system on the Random Access Memory using any utility available in Linux. That is, assign a space on the RAM and use it as a virtual disk - quite the opposite of virtual memory management! This is for efficient message passing between independent processes, that is, processes not created by forking. It is of course possible to use the disk to do this, but I am looking for speed and utilising RAM instead of disk reads.
With regards,
Arindam Banerjee.
adda1234@bigpond.com
 
Old 04-19-2007, 08:32 PM   #2
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian Stable
Posts: 2,546
Blog Entries: 8

Rep: Reputation: 465Reputation: 465Reputation: 465Reputation: 465Reputation: 465
It's easy to do this, using tmpfs. Create a directory at the desired mount point, just like any other mount point. Then, in your /etc/fstab, make an entry like one of these:

none /tmp tmpfs defaults 0 0
none /var/run tmpfs defaults 0 0
none /var/lock tmpfs defaults 0 0
none /var/tmp tmpfs defaults 0 0

That's taken directly from my usual fstab entry. Note that /tmp and /var/tmp are standard temporary file locations, so the directories already exist. I like using these entries because it reduces disc access--a big improvement for diskless workstations where every disc access consumes network bandwidth.

Note that tmpfs file systems always start off empty when mounted. Thus, any reboot will inherently delete the contents. For the above temporary directories, this behavior is actually desirable.
 
Old 04-20-2007, 12:15 AM   #3
Arindam Banerjee
LQ Newbie
 
Registered: Apr 2007
Posts: 2

Original Poster
Rep: Reputation: 0
Thanks. Is tmpfs an utility? I checked my /etc and did not find any /fstab. The "man" command also does not understand tmpfs. How can I install this /fstab - is it free or is there some vendor?

Regards,

Arindam.
 
Old 04-20-2007, 12:55 AM   #4
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian Stable
Posts: 2,546
Blog Entries: 8

Rep: Reputation: 465Reputation: 465Reputation: 465Reputation: 465Reputation: 465
Funny...do you know what sort of version of Linux you're using. There should be a file named "/etc/fstab". It's free...part of the basic file system stuff without which Linux can't really function. I don't know if tmpfs is included in all distributions base systems, but it would surprise me if it weren't included in all of them.
 
Old 04-20-2007, 02:03 AM   #5
Electro
LQ Guru
 
Registered: Jan 2002
Posts: 6,042

Rep: Reputation: Disabled
The only problem using RAM for data storage is the consistency. I suggest using ECC memory because your files will become corrupted if you do not use ECC memory. Hard drives do ECC by default.

You could use Gigabyte's I-RAM but I do not know how well it works at this time. What I read, is Gigabyte did not include a few commands that the kernel uses to see the I-RAM device as a drive.

tmpfs comes from the kernel so the vendor is kernel.org. It is a filesystem that has some limited features. If you type man mount, it should be in there.

The file /etc/fstab should be there. If it is not, Linux will not be able to boot. If you type man fstab, it should give information how it should be written.
 
Old 04-20-2007, 02:13 AM   #6
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian Stable
Posts: 2,546
Blog Entries: 8

Rep: Reputation: 465Reputation: 465Reputation: 465Reputation: 465Reputation: 465
Electro, what Arindam is asking for is actually different from what the subject line says. He's asking for a file system in RAM, for temporary files used locally, rather than a file "server".
 
Old 04-20-2007, 02:27 PM   #7
Electro
LQ Guru
 
Registered: Jan 2002
Posts: 6,042

Rep: Reputation: Disabled
Quote:
Originally Posted by IsaacKuo
Electro, what Arindam is asking for is actually different from what the subject line says. He's asking for a file system in RAM, for temporary files used locally, rather than a file "server".
Dah I read it.

The problems with tmpfs is there is no buffering and it can actually be slower. A filesystem like XFS uses a lot of RAM for cache, so it has instant access and very high throughput. Another filesystem to consider is JFS.

I have used tmpfs for both /tmp and /var/tmp and other tasks like compiling. The speed is not fast as it should be. Choosing a disk node is a lot faster because both caching and buffering can be done. If tmpfs is not limited to a desire size or if the size is twice the RAM and included swap partitions, tmpfs can slow down Linux to a crawl when tmpfs consumes all the space that it was given.

If Gigabyte I-RAM works in Linux, caching and buffering can be done. Also it will be very, very fast accessing data. tmpfs will not even match the performance of I-RAM even though I-RAM is connected to SATA and then to the bus which does increase latency. I predict about 1 millisecond accessing time for I-RAM versus 20 to 30 milliseconds accessing time when using either IDE or SATA.

BTW, you have a flaw in your setup. You will need to provide mode=1777 for /tmp and /var/tmp.
 
Old 04-20-2007, 02:40 PM   #8
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian Stable
Posts: 2,546
Blog Entries: 8

Rep: Reputation: 465Reputation: 465Reputation: 465Reputation: 465Reputation: 465
The application in question is for message passing between some custom application's processes! Obviously the desired size is nowhere near the amount of RAM (if it were, then the original poster wouldn't be asking how to do it in RAM).

Oh, what is the deal with mode=1777? I never bothered checking, but I presumed that the /tmp and /var/tmp directories were already world writeable during the initial setup. Then I manually added those /etc/fstab entries without doing anything special to create those directories for the mount points.
 
Old 04-20-2007, 02:52 PM   #9
lazlow
Senior Member
 
Registered: Jan 2006
Posts: 4,363

Rep: Reputation: 172Reputation: 172
You might take a look at this: http://www.vanemery.com/Linux/Ramdisk/ramdisk.html

It mentions the 2.4 kernel but I check the the /dev/ram* exists on my 2.6.20-1.2312 kernel system.
 
  


Reply



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
How to Access RAM as a page file sathyacrt84 Linux - Software 2 03-13-2005 02:47 PM
installing to ram casimir DamnSmallLinux 6 02-03-2004 07:52 PM
Running a file from ram Bd22 Linux - Software 3 02-01-2004 01:05 AM
.ram file help ll3x4 Linux - Software 2 09-20-2003 08:42 PM
Installing Ram jeempc Linux - Hardware 2 07-14-2003 09:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 05:23 PM.

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