LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 02-06-2005, 11:34 PM   #1
ihristov
LQ Newbie
 
Registered: Jun 2004
Distribution: XUbuntu 6.06
Posts: 27

Rep: Reputation: 15
How to reserve fixed amount of memory for ramdisk?


How do I reserve a fixed amount of memory (16 MB) for RAM disk and do not allow the kernel to use it for other stuff?

Any pointers are appreciated. Everything that I find says "the RAM disk
dynamically grows as data is being written into it"

Details:
-----------

I recently installed IPCop on a flash card. I used the LinITX image
<http://linitx.com/support/download.php>

All works well, except after having run for a while I can no longer write
to the ram disk, even though it is not full. This creates all sort of
problems.


> root@ipcop:/var/log # mkdir test
> mkdir: cannot create directory `test': No space left on device

> root@ipcop:/var/log # df -h /ram
> Filesystem Size Used Avail Use% Mounted on
> /dev/ramdisk 16M 5.2M 11M 34% /ram


I can see there is 25M available memory, but it does not want to use it.

> root@ipcop:/var/log # free -k
> total used free shared buffers cached
> Mem: 94872 69216 25656 0 4192 46584
> -/+ buffers/cache: 18440 76432
> Swap:
> 0 0 0

BTW: I have 96 MB or RAM, but can't install more, because it is an old
Pentium 133 motherboard with the old 72 pin SIMM memory.

---
Iassen Hristov

P.S. If this matters the kernel is stock 2.4.27

Last edited by ihristov; 02-06-2005 at 11:36 PM.
 
Old 02-07-2005, 07:50 AM   #2
Oliv'
Senior Member
 
Registered: Jan 2004
Location: Montpellier (France)
Distribution: Gentoo
Posts: 1,014

Rep: Reputation: 36
Hello,

the amount of reserved RAMDISK is defined during kernel selection option stage. I mean when you hit "enable RAMDISK" box there's a box below which appears and ask you the amount you want to reserve (by default 4Mo)

Oliv'
 
Old 02-07-2005, 10:49 AM   #3
ihristov
LQ Newbie
 
Registered: Jun 2004
Distribution: XUbuntu 6.06
Posts: 27

Original Poster
Rep: Reputation: 15
Quote:
Originally posted by Oliv'
the amount of reserved RAMDISK is defined during kernel selection option stage
Oliv' [/B]
That's what I already do.
IPCop is using grub. Here is the /boot/grub/grub.conf

Code:
 
timeout 5
default saved
foreground = 16064e
background = ffffff
splashimage (hd0,0)/grub/ipcop.xpm.gz
title IPCop
  root (hd0,0)
  kernel /vmlinuz root=/dev/hdc4 panic=10 acpi=off ro idebus=33 ide=nodma ramdisk_size=16384
  savedefault
However this just makes a 16 MB RAM disk, but does not "reserve" it explicitly for the RAM disk. Aparently the kernel uses the memory for cache and other stuff and at some point I can't write to the RAM disk, even though df says there are still 11 MB free. This is my problem.
 
Old 02-07-2005, 12:19 PM   #4
Oliv'
Senior Member
 
Registered: Jan 2004
Location: Montpellier (France)
Distribution: Gentoo
Posts: 1,014

Rep: Reputation: 36
Quote:
at some point I can't write to the RAM disk, even though df says there are still 11 MB free

And you'll never be able to do so... 'cause it's RAMDISK so its filesystem is cramfs and that's a read only filesystem
So you must configure it properly, then generate it and you can't modify it anymore when it's in RAM
 
Old 02-07-2005, 04:52 PM   #5
ihristov
LQ Newbie
 
Registered: Jun 2004
Distribution: XUbuntu 6.06
Posts: 27

Original Poster
Rep: Reputation: 15
We are clearly not understanding each other. This disk is not cramfs, it is ext2. This is a ram disk that IS writeable after I boot. All the log files are written to it. Then after the system has ran for a while I can no longer write to it with a message "No space left on device".

I don't know if the RAM disk specified in the grub config is the same as this one.

I think this RAM disk is created at boot time as part of the init process from the file /etc/rc.d/rc.flash.up

Code:
umount -n /dev/ramdisk
mke2fs -b 1024 -m 0 /dev/ramdisk

mount -n /dev/ramdisk /ram/
mkdir -p /ram/{log,tmp}

ln -s /ram/var/log /var/log
ln -s /ram/tmp /tmp

...
create other folders and set permissions on them
....
So the question is: Is there a way to somehow reserve the memory for the ram disk ONLY?

Actually this got me thinking and it appears I am running out of inodes.

Code:
root@ipcop:/ram # tune2fs -l /dev/ramdisk
...
Inode count:              4096
Block count:              16384
Reserved block count:     0
Free blocks:              10525
Free inodes:              0
...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
check amount of memory naijaguy Linux - General 4 10-15-2008 02:11 PM
Increasing the amount of cached memory balteo Linux - General 1 09-16-2005 04:06 PM
Reserve memory region for Cardbus card. grcore Linux - Hardware 0 12-17-2004 06:31 AM
checking amount of free memory sanjith11 Linux - Software 6 05-13-2004 10:11 AM
X uses an excessive amount of memory! ~80Mb kamstrup Linux - Software 3 08-18-2003 06:42 AM


All times are GMT -5. The time now is 07:11 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration