i'm trying to figure out what i can and can't do with 
ram disks, so let me explain what i've found so far, and 
perhaps someone can fill in the gaps.

  by "ram disk", i don't mean the boot-time initrd image.
i mean setting aside an arbitrary amount of RAM, formatting it
as an ext2/3 filesystem, mounting it, filling it with files,
and then having smokin' fast access to those files.

  (as an aside, i wanted to test this by creating a ram
disk big enough for the kernel source directory, to see
just how much faster a kernel build would run.)

  so, under RH 9 and with the 2.5.72 kernel, i can see
the kernel option for "RAM disk support", and a default
size of 4096 (kilobytes, or 4M).

  from what i've read, i can create a number of ram disks
corresponding to /dev/ram[012345...], by doing the following:

  # dd if=/dev/zero of=/dev/ram0 bs=1024 count=16

for a tiny ram disk of 16k (supposedly).  so what actually
happens?

  if i try to create an ext2 filesystem on it:

  # mke2fs /dev/ram0

it works, but it's obvious that it's 4M in size -- the
default.  i didn't *ask* for the default size, i was hoping
i could pick the size myself.  but i get 4M anyway.

  (i can mount that filesystem, and "df" shows the same
thing: 4M).

  the same thing happens no matter what size i use for
"dd", until i try to go over 4M, at which point, at the 4097th
write (just past 4M), i get "No space left on device".

  in short, no matter what i ask for, i'll get a 4M ram disk.
so, the questions:

1) is there any way to create a ram disk of an arbitrary size,
   regardless of the kernel config value for default size?

2) once i create a ram disk, is there an indicator that tells
   me that such a thing exists?  i mean, "free" will show me
   that there's less free space, but that's about it.  is there
   maybe an entry under /proc keeping track of ram disks?
   you know ... maybe /proc/list_of_ram_disks?? :-)

3) once i create one (even if i'm still stuck with 4M), how
   can i manually release it?  and again, is there a way to 
   verify the return of that ram disk space to the OS?



rday

--

Robert P. J. Day
Eno River Technologies
Unix, Linux and Open Source training
Waterloo, Ontario

www.enoriver.com


-- 
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]
https://www.redhat.com/mailman/listinfo/redhat-list

Reply via email to