[Linux] Ram Disks
Kendrick Vargas
linux@flux.org
Tue, 15 Jan 2008 11:28:09 -0500
Peter Capazzi wrote:
> Hello,
> Is anyone familiar with Ram Disks?
I've used them before... but that was a long time ago :-)
> We have a 3rd party application that apparently needs to read from disk
> for every record as it cycles through anywhere to 50-100 million
> records. We're looking to place this applications resources into a ram
> disk insead.
>
> I've read through the only tutorial that I beleive applies to what I'm
> trying to do and I'm not sure I understand it completely:
> http://www.vanemery.com/Linux/Ramdisk/ramdisk.html
The key thing to understand is that the kernel, at boot time, needs to know
how big your ram disks will end up being. It won't actually create any,
you'll do that later. It's just preparing for them. By default it's gonna
expect the ramdisks to be 4 meg in size each, but you can adjust that by
passing the kernel a parameter when it boots up. The example you posted sets
it to 16,000K (16 meg) by passing the argument ramdisk_size=16000 to the
kernel at boot. You'll probably want to change that to 1000000 for a 1 gig
ramdisk, though I'm not sure if there are any size limitations on that sorta
thing. Once you adjust your bootloader config, you'll have to reboot.
It might help to know what distribution you're running. The page you posted
appears to be about RedHat Linux 9 with a 2.4 kernel which is pretty old
(5-6 years?). The docs for Linux 2.6 though seem to indicate that the
options are all the same. If you're not using grub for your boot loader,
you'll have to adjust the instructions for your particular installation
(which is why I asked about the dist, someone here might be able to help
with other dists).
Once you begin to use a ramdisk device, the kernel will allocate the ram for
it. So, steps 3 and 4 are about creating a filesystem on the device and just
mounting it, which you can get from any number of HOWTO's available on the
net. Also, using ext3 would be overkill since it's features over ext2 are
about recovery of the filesystem after a crash. With a ramdisk there is no
recovery, so just use ext2. It'll be faster.
-peace