<rdf:RDF
    xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'
    xmlns:s='http://snipsnap.org/rdf/snip-schema#'
    xml:base='http://bliki.rimuhosting.com/rdf'>
    <s:Snip rdf:about='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/misc/quick+and+dirty+memory+checker'
         s:cUser='retep'
         s:oUser=''
         s:mUser='retep'>
        <s:name>knowledgebase/linux/misc/quick and dirty memory checker</s:name>
        <s:content>1 Unstable System?  It Could Be the Memory&#xD;&#xA;&#xD;&#xA;Do you have a server that &apos;crashes&apos; irregularly?&#xD;&#xA;&#xD;&#xA;Some possible causes:&#xD;&#xA;* A buggy kernel.  It could be you have a bad kernel, try the latest Linux stable kernel.  Or upgrade to your distro vendors default kernel.&#xD;&#xA;* A bad CPU.  We have not hit this problem yet.  So I don&apos;t know how its symptoms would show.&#xD;&#xA;* A bad power supply.  Typically a bad power supply will result in a server that just plain will not power up rather than a machine that crashes intermittently.&#xD;&#xA;* Bad memory&#xD;&#xA;&#xD;&#xA;Bad memory is probably the biggest culprit behind those odd, random server restart errors.&#xD;&#xA;&#xD;&#xA;Symptoms include random crashes.  Inexplicable program segfaults.  And (if you are supporting production systems and have the emergency pager) you will probably have had a few sleep interuppted nights.&#xD;&#xA;&#xD;&#xA;1 Checking Memory&#xD;&#xA;&#xD;&#xA;The gold standard for checking memory is the memtest86 program.  Grab the ISO, burn it, reboot your system with it and wait 6 - 60 hours for a result.&#xD;&#xA;&#xD;&#xA;If you need to get a quick idea if memory is at fault before taking a server off line for that long, try this:&#xD;&#xA;&#xD;&#xA;{code}&#xD;&#xA;#determine the amount of memory in your system&#xD;&#xA;#cat /proc/meminfo&#xD;&#xA;#MemTotal:      2068052 kB&#xD;&#xA;memmb=$(cat /proc/meminfo | grep MemTotal | awk &apos;{print $2}&apos;)&#xD;&#xA;# use a 1050 count so that the created file will be &#xD;&#xA;# a bit bigger than the available memory (1024 or &#xD;&#xA;# maybe 1000 for the actual memory size)&#xD;&#xA;dd if=/dev/urandom bs=$memmb of=large count=1050; md5sum large; md5sum large; md5sum large&#xD;&#xA;&#xD;&#xA;{code}&#xD;&#xA;&#xD;&#xA;dd will create an output file (called large) filled with random (/dev/urandom) bytes.  It will be bs*count big.  Then it will output a checksum (twice) for that file.  &#xD;&#xA;&#xD;&#xA;To output the checksum Linux will have to read the files.  It will cache all the data it can in memory.  Presuming you have less than 10GB of memory the server will use up all its memory during the file read.  And the md5sum will ensure that the same bits can be saved/read from memory consistently.&#xD;&#xA;&#xD;&#xA;If the checksums do not match, you have faulty memory (guaranteed).&#xD;&#xA;&#xD;&#xA;If the checksums match, try running the md5sum commands a couple more times.  If the checksums are consistently the same then you may or may not have faulty memory.  Run memtest86 to be sure.&#xD;&#xA;&#xD;&#xA;The test can return the same checksum and still have bad memory since not all memory is addressable by the kernel.  And because the server will be running software that won&apos;t budge out of its currently position in memory (e.g. the kernel and probably most applications) so that memory won&apos;t be tested (running the test on a server with minimal applications running would therefore be a good way to improve its accuracy).</s:content>
        <s:mTime>2006-04-05 07:41:06.0</s:mTime>
        <s:cTime>2005-10-18 22:24:47.0</s:cTime>
        <s:comments
             rdf:type='http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag'/>
        <s:snipLinks>
            <rdf:Bag>
                <rdf:li rdf:resource='#snipsnap-search'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux'/>
                <rdf:li rdf:resource='#knowledgebase'/>
                <rdf:li>
                    <s:Snip rdf:about='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/misc/quick+and+dirty+memory+checker'>
                        <s:attachments
                             rdf:type='http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag'/>
                    </s:Snip>
                </rdf:li>
                <rdf:li rdf:resource='#snipsnap-index'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/miscapplications/ruby on rails'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/mail/postfixadmin on debian sarge'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/mail/mass emailing best practices'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/misc/disk quotas'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/java/liferay install on tomcat 5.5'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/misc/accessing a vnc server behind a firewall'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/xen'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#SnipSnap/config'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#A sysadmin&apos;s view of VoIP'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/misc/bash'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/misc/ajax autocomplete'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/misc/debootstrap'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/mail/postfix with amavis and mysql'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/miscapplications/svn notes'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/mail/postfix notes'/>
            </rdf:Bag>
        </s:snipLinks>
    </s:Snip>
</rdf:RDF>
