Linux ramdisk for temporary files

Linux ramdisk for temporary files

Post by Peter Wec » Mon, 13 Apr 1998 04:00:00



Is there a way to create a large ramdisk (~150 Meg) to store temporary
files?  I'm reading and writing to large number of temporary files and
would like to do it all in RAM rather than on the disk.  I realize that
Linux caches the reads, but the writes are flushed to disk, thus
limiting the performance.

I am running on RedHat 5.0 with a 2.0.33 kernel.

Thanks,
-Peter Weck

 
 
 

Linux ramdisk for temporary files

Post by Peter A Fei » Mon, 13 Apr 1998 04:00:00



> Is there a way to create a large ramdisk (~150 Meg) to store temporary
> files?  I'm reading and writing to large number of temporary files and
> would like to do it all in RAM rather than on the disk.  I realize that
> Linux caches the reads, but the writes are flushed to disk, thus
> limiting the performance.

If you're going to be writing temp files to ram, why not just store
the stuff in variables to begin with?  You don't have the overhead of
going through the ramdisk driver in that case.

--
Peter Fein
1005 E. 60th St.
Chicago, IL 60637
773-834-6206

http://pfein.home.ml.org/

 
 
 

Linux ramdisk for temporary files

Post by Bill Eldridg » Tue, 14 Apr 1998 04:00:00


Yes, you can follow the instructions in
/usr/src/linux/Documentation/ramdisk.*

You may have to edit /usr/src/linux/drivers/block/rd.c
and change a line to:

/*  int rd_size = 32768;            /* Size of the ramdisks */
int rd_size = 163840  /* Five times 32 Megs */

or there may be a way to pass in the ramdisk size
from LILO.

Bill



> Is there a way to create a large ramdisk (~150 Meg) to store temporary
> files?  I'm reading and writing to large number of temporary files and
> would like to do it all in RAM rather than on the disk.  I realize that
> Linux caches the reads, but the writes are flushed to disk, thus
> limiting the performance.

> I am running on RedHat 5.0 with a 2.0.33 kernel.

> Thanks,
> -Peter Weck


 
 
 

Linux ramdisk for temporary files

Post by Peter Wec » Tue, 14 Apr 1998 04:00:00




>> Is there a way to create a large ramdisk (~150 Meg) to store temporary
>> files?  I'm reading and writing to large number of temporary files and
>> would like to do it all in RAM rather than on the disk.  I realize that
>> Linux caches the reads, but the writes are flushed to disk, thus
>> limiting the performance.

> If you're going to be writing temp files to ram, why not just store
> the stuff in variables to begin with?  You don't have the overhead of
> going through the ramdisk driver in that case.

I'm going to be exporting the ramdisk as an NFS mount and multiple
machines are going to be sharing the temporary space.  Right now, using
a regular ext2 partition, the performance is very slow.

-Peter Weck

 
 
 

Linux ramdisk for temporary files

Post by Christopher Michael Coon » Wed, 15 Apr 1998 04:00:00


:
: I'm going to be exporting the ramdisk as an NFS mount and multiple
: machines are going to be sharing the temporary space.  Right now, using
: a regular ext2 partition, the performance is very slow.
:

Then you need more ram. Or you've got bad rsize, wsize parameters.
8k should get 5-600k over ethernet (from a 386 even)
--

Walking through the ba*t of Fuller Labs wearing futuristic body
armor and pushing a variable-geometry motorcycle raises eyebrows.  
Telling students that this is the true power of UNIX doesn't help. -UF

 
 
 

1. Linux ramdisk for temporary files

I created a 140M ramdisk on my Slackware 3.4 box (2.0.3 Kernel) with
Loadlin 1.6 serveral month
ago. The RamDisk is supposed to hold the video data for broadcasting (
write/read frequently ),
but I switch to mmap after the test for some other reasons. Here are
some of my notes.

1. Set the size(K) of RamDisk in Config.sys for Loadlin.  (I am using
Multi-boot for 95/NT/Linux.)

[linux]
shell=c:\loadlin\loadlin.exe c:\loadlin\zimage root=/dev/hda3 ro
mem=192M ramdisk_size=150000

/*
If you use LILO, I think you can set the same kernel command line
parameters in /etc/lilo.conf

In linux kernel image file, 2 bytes (ox01F8, ox01F9) are used to
represent the size of RAMDISK,
so there is a 64M limit for "rdev -r image_file ram_disk_size".

I checked init/main.c, devices/rd.c and LoadLin source code. Size of
Ramdisk is passed as char *
without length limit, and it's eventually converted to int. Until now
I do not find any limit for
using ramdisk_size with loadlin.
*/

2. Reboot, if you are asked for a linux kernel image floppy, press
enter to skip.

3. Zero out ramdisk
pc1849:~# more /proc/meminfo
pc1849:~# dd if=/dev/zero of=/dev/ram0 bs=1k count=140000
140000+0 records in
140000+0 records out

4. Write inode tables, superblocks and filesystem accounting
information in ramdisk.
pc1849:~# mke2fs -m 0 /dev/ram0

5. Mount the RamDisk
pc1849:~# mount -t ext2 /dev/ram0 /mnt/ram1

6. Check it
pc1849:~# df
Filesystem         1024-blocks  Used Available Capacity Mounted on
/dev/hda3             517145  281654   208779     57%   /
/dev/hda1             717472  558160   159312     78%   /nt
/dev/ram0             145230      13   145217      0%   /mnt/ram1

pc1849:~# cp Giant /mnt/ram1/

Because I tried it on an old machine with 64M limit of L2cache
cacheable,
I did not run a performance test. But I think it should be much better
than
mmap( ... MAP_SHARED ... ).

Happy Hacking.

Junyi Sun
Computer Science & Engineering Dept.
Arizona State University

2. Atlanta Sun Job 62K to 124K

3. To use temporary files or not to use temporary files?

4. fix IKCONFIG compile in 2.5.10-dj1 for non-modular kernels

5. Adding text to the top of a file without using temporary files

6. Problem: Matrox G200 AGP 2X (from Vectra PIII vei8) onboard | Xfree 3.3.6 | RedHat 6.2 | HP Monitor 15' D8895A

7. IE's Temporary Internet Files: rescue or converting to Linux?

8. Trouble with Apache2.0.43 on FreeBSD4.3

9. ramdisk for linux: mount /ramdisk

10. secure temporary file creation/usage

11. Temporary files?

12. Temporary Password File

13. qpopper: "Can't open temporary file, do you own it?"