Testing RAM in Linux
A number of good and mostly free tools are available for testing RAM hardware. However, most of these applications are designed to operate in stand-alone mode that requires shutting down the OS. Still, tare a few ways to run memory integrity checks from inside the operating environment. Here we will look at using dd and memtester.
dd
The idea here is simple: use random input to generate a file equal to the total size of RAM; then run MD5 checksum on the file a few times to see if results match. This method has two drawbacks: it requires disk space and it is slow. The script below will see how much memory your system has; it will then make sure you have sufficient disk space before running dd.
While dd is running in the background, the script will keep you updated about the progress. Once dd has finished, md5sum will be executed three times. Your job is to verify that all three values it produces are identical.
#!/bin/bash # www.krazyworks.com # The script will use dd and md5sum to test integrity of your RAM trap ctrl_c INT configure() { # directory for storing temp files output_dir="/esstress" # temp output file output_file="${output_dir}/dd_memtest.tmp" # available space in $output_dir output_dir_space=$(df -Pk $output_dir | grep -v Filesystem | awk '{print $4}') # maximum percentage of $output_dir space to use fs_limit=90 # total system RAM total_mem=$(free | grep 'Mem:' | awk '{print $2}') total_mem_m=$(free -m | grep 'Mem:' | awk '{print $2}') # file for storing PID pidfile="/tmp/dd_memtest.pid" } preflight() { # check disk space requirements if [ ${total_mem} -gt `echo "scale=0;${output_dir_space}/100*${fs_limit}"| bc -l` ] then echo "Not enough free space in ${output_dir}! Exiting..." exit 1 fi if [ -f "${output_file}" ] then /bin/rm "${output_file}" fi } md5run() { # run three interations of md5 checksum to verify data integrity for i in 1 2 3 do md5sum "${output_file}" done } function ctrl_c() { echo "Killing dd" if [ -f /tmp/pid1 ] then kill -9 `cat /tmp/pid1` /bin/rm -f /tmp/pid1 fi if [ -f "${output_file}" ] then /bin/rm -f "${output_file}" fi exit 1 } dd_memtest() { # run dd to generate the output file from random input if [ -f /tmp/pid1 ] then /bin/rm -f /tmp/pid1 fi (dd if=/dev/urandom bs=${total_mem} of="${output_file}" count=1050 & echo $! > /tmp/pid1)& echo "Starting test..." sleep 5 while [ -e /proc/`cat /tmp/pid1` ] do echo "Written `/bin/ls -lash ${output_file} | awk '{print $1}'` of ${total_mem_m}Mb" sleep 10 done md5run /bin/rm -f "${output_file}" /bin/rm -f /tmp/pid1 } # RUNTIME configure preflight dd_memtest
memtester
Memtester is an open-source utility for testing RAM from inside the OS. Download the source code and untar it; run make; and then run make install. Use the following wrapper script to pre-populate required options based on your system’s free memory. It is important to point out that any memory-locking process is capable of crashing your system. The wrapper script will ensure that memtester does not grab more RAM than you can spare. However, this is not a guarantee of a problem-free run and you should be prepared for the possible need to power-cycle the system in case it locks up.
#!/bin/bash # www.krazyworks.com # Download Memtester source code from http://pyropus.ca/software/memtester/ # Gunzip, untar, run "make" and "make install" # # This script will run memtester using a percentage of your remaining free # physical RAM to avoid a system lockup. Still, be prepared for the # possibility that the system may become unresponsive and may need to be # power-cycled. configure() { MEMTESTER=/usr/local/bin/memtester # memtester location LOOPS=2 # number of memtester runs RAMLIM=90 # percentage of free physical RAM to use for the test } memtest() { "${MEMTESTER}" $(echo "scale=0;`free | grep 'Mem:' | awk '{print $4}'`/100*${RAMLIM}" | bc -l)K ${LOOPS} } # RUNTIME configure if [ ! -x "${MEMTESTER}" ] then echo "Memtester executable not found! Exiting..." exit 1 else memtest fi
I’m a programmer looking to get a new work machine to carry around. Currently I use a desktop replacement laptop but I’d like the option of being able to program and test in all the currently used operating systems (os x, linux, windows). So I need to get a mac. I don’t care if it can play games (well, maybe a bit of WoW). So what would you recommend? The 2.4 ghz macbook or the base model macbook pro? Thanks.
Where do I go to get Linux? Is it more beneficial to buy it? Can anyone give me step by step instructions on how to uninstall Windows 98 and install a linux os?
Thanks
I got a crucial m4 ssd 128GB 9with 112Gb free. I have 8GB of ram 1333mhz ddr3. Right now I am running Os 10.7.3.
The easy way!
The easy way!
Or I’m wanting to build a Linux platform machine so I can install vmware to run a windows install. What do you think is the best Linux/opensource installer to use for this? I have an older AMD Athlon 2.6ghz 2gb ram asus board. Thanks
I’m starting a new website that is similar in set-up to a dating site. Instead of dealing with web hosting, I was going to but my own equipment. I’m going to be using drupal to design the site. What server do I need and with what kind of ram and disk space? Thanks!
I need a new PC or laptop. I watch HULU TV on it and I want to know the minimum amount of memory and RAM I should get for it to be completely functional. How do I read the numbers for RAM? Any other feature I should be aware of? Thanks!
I have enough money for (an inexpensive) one. I would really like to get as much use out of it as I can. Preferably, I’d like an operating system on it (Linux would be fine).
I would like to use it in my car, but I’m concerned that a keyboard would be cumbersome.
Can one suffice for the other, or are they different enough from each other that you really need both?
If you have both, which one do you wish you would have gotten first?
Your advice is appreciated.