These are good memory test tools I'd like to share with you, they are popular on Centos/RHEL and other linux distributions.

Memtest86+

Memtest86+ is thorough, stand alone memory test for Intel/AMD x86 architecture systems.  BIOS based memory tests are only a quick check and often miss failures that are detected by Memtest86+.

For updates go to the Memtest86+ web page:

        http://www.memtest.org

Installation (Linux Only)

============================
Memtest86+ is a stand alone program and can be loaded from either a disk partition or from a floppy disk.

To build Memtest86+:
   1) Review the Makefile and adjust options as needed.
   2) Type "make"

This creates a file named "memtest.bin" which is a bootable image.  This image file may be copied to a floppy disk or lilo may be used to boot this image from a hard disk partition.

To create a Memtest86+ bootdisk
   1) Insert a blank write enabled floppy disk.
   2) As root, Type "make install"
To boot from a disk partition via lilo
   1) Copy the image file to a permanent location (ie. /memtest).
   2) Add an entry in the lilo config file (usually /etc/lilo.conf) to boot
      Memtest86+.  Only the image and label fields need to be specified.
      The following is a sample lilo entry for booting Memtest86+:
      image = /memtest
      label = memtest
   3) As root,  type "lilo"
      At the lilo prompt enter memtest to boot Memtest86+.

If you encounter build problems a binary image has been included (precomp.bin).

To create a boot-disk with this pre-built image do the following:
   1) Insert a blank write enabled floppy disk.
   2) Type "make install-precomp"

RHEL build in memtest86+

Red Hat Enterprise Linux ships a memory test tool called memtest86+. It is a bootable utility that tests physical memory by writing various patterns to it and reading them back. Since memtest86+ runs directly off the hardware it does not require any operating system support for execution.

This tool is available as an RPM package from Red Hat Network (RHN) as well as a boot option from the Red Hat Enterprise Linux rescue disk.

To boot memtest86+ from the rescue disk, you will need to boot your system from CD 1 of the Red Hat Enterprise Linux installation media, and type the following at the boot prompt (before the Linux kernel is started):

boot: memtest86

Install memtest86+ on the system

If you would rather install memtest86+ on the system, here is an example of how to do it on RHEL

# yum install memtest86+

For the RHEL/CentOS/SL, perform the following command to install memtest86+. Make sure current system has been registered to RHN:

# up2date -i memtest86+

Then you will have to configure it to run on next reboot:

# memtest-setup

After reboot, the GRUB menu will list memtest. Select this item and it will start testing the memory.
Please note that once memtest86+ is running it will never stop unless you interrupt it by pressing the Esc key. It is usually a good idea to let it run for a few hours so it has time to test each block of memory several times.

https://access.redhat.com/site/solutions/15693

 

Memtester

At some condition, memory is the one of the suspcious part, or you just want have a quick test. memtester  is an effective userspace tester for stress-testing the memory subsystem. 

It is very effective at finding intermittent and non-deterministic faults.

It has only few options to play

memtester [-p PHYSADDR] <MEMORY> [ITERATIONS]

   -p PHYSADDR
      tells memtester to test a specific region of memory starting at  physical  address 
PHYSADDR  (given  in  hex),  by  mmap(2)ing /dev/mem. 
This is mostly of use to hardware developers, for testing memory-mapped I/O devices
and similar. 
Note that the memory region will be overwritten during testing, so it is not safe to
specify memory which is allocated for the system or for other applications;
doing so will cause them to crash.
  
MEMORY the  amount  of  memory  to  allocate and test, in megabytes by default.  You can include a suffix of B, K, M, or G to indicate bytes, kilobytes, megabytes, or gigabytes respectively.

      ITERATIONS (optional) number of loops to iterate through.  Default is infinite.

Example:


#memtester 2048 1
memtester version 4.2.1 (64-bit)
Copyright (C) 2010 Charles Cazabon.
Licensed under the GNU General Public License version 2 (only).
pagesize is 4096
pagesizemask is 0xfffffffffffff000
want 2048MB (2147483648 bytes)
got  2048MB (2147483648 bytes), trying mlock ...locked.
Loop 1/1:
  Stuck Address       : ok
  Random Value        : ok
  Compare XOR         : ok
  Compare SUB         : ok
  Compare MUL         : ok
  Compare DIV         : ok
  Compare OR          : ok
  Compare AND         : ok
  Sequential Increment: ok
  Solid Bits          : ok
  Block Sequential    : ok
  Checkerboard        : ok
  Bit Spread          : ok
  Bit Flip            : ok
  Walking Ones        : ok
  Walking Zeroes      : ok
  8-bit Writes        : ok
  16-bit Writes       : ok

Done

NOTE
memtester must be run with root privileges to mlock(3) its pages.  Testing memory without locking the pages in place is mostly  pointless and slow.

EXIT CODE

   memtester’s exit code is 0 when everything works properly.  Otherwise, it is the logical OR of the following values:
   x01    error allocating or locking memory, or invocation error
   x02    error during stuck address test
   x04    error during one of the other tests

Other way:  use dd

This is not an official test too, but I think it makes sense and quicker.

First find out memory site using free command.

# free
             total       used       free     shared    buffers     cached
Mem:      32867436   32574160     293276          0      16652   31194340
-/+ buffers/cache:    1363168   31504268
Swap:            0          0          0

It shows that this server has 32GB memory

dd if=/dev/urandom bs=32867436 count=1050 of=/home/memtest

free reports by k and use 1050 is to make sure file memtest is bigger than physical memory.  To get better performance, use proper bs size, for example 2048 or 4096, depends on your local disk i/o,  the rule is to make bs * count > 32 GB.

run md5sum /home/memtest; md5sum /home/memtest; md5sum /home/memtest

If you see md5sum mismatch in different run, you have faulty memory guaranteed.


The theory is simple, the file /home/memtest will cache data in memory by filling up all available memory during read operation. Using md5sum command you are reading same data from memory.

 

In linux there is module called EDAC(Error Detection And Report) can report memory error detected in running kernel, I have another article shows How to identify detective DIMM from EDAC on Linux.