Re: Free memory, include "cached"?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

El Tue, Oct 14, 2008 at 03:44:42PM +0200 Gilles Chanteperdrix ha dit:

> Matthias Kaehlcke wrote:
> > El Tue, Oct 14, 2008 at 03:03:27PM +0200 Gilles Chanteperdrix ha dit:
> > 
> >> Gregoire Banderet wrote:
> >>> Matthias Kaehlcke wrote:
> >>>> El Tue, Oct 14, 2008 at 02:14:46PM +0200 Gregoire Banderet ha dit:
> >>>>
> >>>>> anubhav rakshit wrote:
> >>>>>>> I have to report the amount of FreeMem on my embedded system. The rootfs
> >>>>>>> is in RAM. I use /proc/meminfo.
> >>>>>>> I started by doing : freemem = MemFree + Buffers + Cached
> >>>>>>> But I realized (tell me if I'm wrong) that my rootfs filesystems is
> >>>>>>> counted in "Cached".
> >>>>>>> Part of the memory in "Cached" can be allocated, so I should add it as
> >>>>>>> Free Memory, but part of it is my rootfs (i.e. really used).
> >>>>>>> How should I compute freemem ?
> >>>>>> Have you tried the free command.
> >>>>> Yes. What I need is to know which part of "Cached" is used for RAMFS.
> >>>> to know the size of your ramfs you may execute the following command:
> >>>>
> >>>> du -hx -d 0 /
> >> If you want to get the space occupied on a partition, you should use df,
> >> not du.
> > 
> > depends on the type of the partition. df doesn't work with initramfs,
> > i suppose the reason is that an initramfs image has no partition size,
> > so it doesn't make sense to report free disk space.
> Are you talking about tmpfs or about cramfs ? A mounted tmpfs has a
> maximum size, and df correctly reports the free and occupied size. A
> cramfs filesystem is a read-only filesystem, so df correctly reports 0
> as the free size, and also reports correctly the occupied size.

i talk about initramfs:

output of df on a embedded system using initramfs as root filesystem:

df -h
Filesystem                Size      Used Available Use% Mounted on
tmpfs                     2.0M     16.0k      1.9M   1% /dev
/dev/mtdblock7            1.0M      1.0M         0 100%
/dev/loop0                7.5G    363.6M      6.7G   5% /media/usb_int
/dev/loop1                7.5G      7.3G         0 100% /media/usb_ext

as you can see the free space of the root filesystem is not reported
by df

Matthias Kaehlcke
Embedded Linux Engineer

    I am incapable of conceiving infinity, and yet I do not accept finity
                          (Simone de Beauvoir)
    using free software / Debian GNU/Linux |  : :'  :
                                                                `. `'`
gpg --keyserver --recv-keys 47D8E5D4                  `-

List admin:

[Linux ARM]     [Linux ARM MSM]     [Linux ARM Kernel]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

Add to Google Follow linuxarm on Twitter