Pages

Tuesday, October 8, 2013

Linux Running out of Memory for buffers/cache


Recently our systems guys got some Nagios warnings on one of our servers that it is running out of RAM. When we were logged in to the system yes it is... it was something like this,

$ free -m
             total       used       free     shared    buffers     cached
Mem:          1504       1491         13          0         91        764
(not actual data)

But what are these buffers and cached, They over consumes my RAM. But what are the details below that...!!

-/+ buffers/cache:        635        869
Swap:         2047          6       2041
Swap of course about your disk swap space.. Buffers/cache ..?? After I google it i just found this post that talks everything about this matter...


Disk caching makes the system much faster! There are no downsides, except for confusing newbies. It does not take memory away from applications in any way, ever! If your applications want more memory, they just take back a chunk that the disk cache borrowed. Disk cache can always be given back to applications immediately! You are not low on ram! “

So it says it is not a problem at all... But for the purpose of removing warnings on Nagios I wanted to clear this cache memory. So this is the command for that;

sync; echo 3 > /proc/sys/vm/drop_caches

explanation of this command as follows; Ref: http://www.linuxinsight.com/proc_sys_vm_drop_caches.html

drop_caches

Writing to this will cause the kernel to drop clean caches, dentries and inodes from memory, causing that memory to become free.
To free pagecache:
  • echo 1 > /proc/sys/vm/drop_caches
To free dentries and inodes:
  • echo 2 > /proc/sys/vm/drop_caches
To free pagecache, dentries and inodes:
  • echo 3 > /proc/sys/vm/drop_caches
As this is a non-destructive operation, and dirty objects are not freeable, the user should run "sync" first in order to make sure all cached objects are freed.

Note: All the credits goes to the actual owners of the references... 

Friday, August 30, 2013

Common SAMBA Errors

Recently my SAMBA server started crashing giving bellow errors in logs;

standard input is not a socket, assuming -D option
[2013/08/30 09:06:22.619250,  0] ../source3/smbd/server.c:1280(main)

Google didn't help me as well as my previous SAMBA experiences couldn't come up with a solution. Luckily I found this forum post and yes... he maid my day....

http://www.hkepc.com/forum/viewthread.php?tid=1923469

All the credits goes to the writer...


vim /etc/sysfconfig/samba
and edit;
SMBDOPTIONS="-D"

So according to the man page of smbd -D causes the server to operate as a daemon.