Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ramdisk: how much mem do they use?

0 views
Skip to first unread message

phil-new...@ipal.net

unread,
Dec 7, 2000, 3:00:00 AM12/7/00
to
On Thu, 07 Dec 2000 18:03:15 GMT Jerome Corre <jerome...@my-deja.com> wrote:

| I have 32Mb of ram on my linuxbox, I sometime use ramdisk (/dev/ram0 or
| /dev/ram1) to store small filesystem, prepare a bootdisk or when my
| system boot usimg initrd.
| I would like to know if it is possible to know how much memory the
| ramdisk are using. I suppose that they don't all use 4Mb as there are 16
| ramdisk i can use and I only have 32 Mb of ram. How can I found out how
| much memory they use? and if I don't need what is left on one of them
| after i unmount it how can I free the memory a ramdisk use?

Take a look in the kernel source at drivers/block/rd.c around the function
called rd_ioctl() and see that there are a few ioctl() calls you could use,
such as BLKGETSIZE. Then take a look at BLKFLSBUF.

I wish all the ioctl() calls were documented in one place. But given that
to not be the case, a couple of techniques to find what facilities are
available include looking in the source, and if you know of a command that
surely must be doing what you need to do, run it via strace and see just
what it really does (or look at it's source). This is one of the many
reasons having source code and open systems is a good thing.

Also, consider upgrading to 2.4 (I'm currently running -test10 on most of
my Linux machines) and trying out ramfs. It won't work for making a
bootdisk, but mounting a loopback file is just as effective, and should
work fine with that file in ramfs.

--
-----------------------------------------------------------------
| Phil Howard - KA9WGN | Dallas | http://linuxhomepage.com/ |
| phil-...@ipal.net | Texas, USA | http://phil.ipal.org/ |
-----------------------------------------------------------------

Jerome Corre

unread,
Dec 7, 2000, 1:03:15 PM12/7/00
to
hi

I have 32Mb of ram on my linuxbox, I sometime use ramdisk (/dev/ram0 or
/dev/ram1) to store small filesystem, prepare a bootdisk or when my
system boot usimg initrd.
I would like to know if it is possible to know how much memory the
ramdisk are using. I suppose that they don't all use 4Mb as there are 16
ramdisk i can use and I only have 32 Mb of ram. How can I found out how
much memory they use? and if I don't need what is left on one of them
after i unmount it how can I free the memory a ramdisk use?

thanks for any help

--
Jerome Corre


Sent via Deja.com http://www.deja.com/
Before you buy.

Peter Pointner

unread,
Dec 9, 2000, 1:13:46 PM12/9/00
to
Jerome Corre <jerome...@my-deja.com> wrote:
> hi

> I have 32Mb of ram on my linuxbox, I sometime use ramdisk (/dev/ram0 or
> /dev/ram1) to store small filesystem, prepare a bootdisk or when my
> system boot usimg initrd.
> I would like to know if it is possible to know how much memory the
> ramdisk are using. I suppose that they don't all use 4Mb as there are 16
> ramdisk i can use and I only have 32 Mb of ram. How can I found out how
> much memory they use? and if I don't need what is left on one of them
> after i unmount it how can I free the memory a ramdisk use?

The ramdisks use ram only as needed. Initially your 16 ramdisks use no
ram, or almost no (there are probably some data structrures in the kernel.
If you use them, you normally create a file system on them. so if you
create a 1 MByte ext2 file system on /dev/ram0, it uses 1 MByte of ram.
AFAIK the 4 MBytes are only a (configurable) upper limit.

If you want to free the memory, you can do that with the tool freeramdisk,
which seems to do some ioctl on the ramdisk device.

Peter

Kasper Dupont

unread,
Dec 15, 2000, 8:01:41 AM12/15/00
to

You can get a quick but not exact information
from top. The memory is allocated using the
buffer system, with this litle memory there
probably will not be many other buffers
allocated. So the buff field is a reasonable
estimation.

--
Kasper Dupont

0 new messages