[Linux-aus] Re: Bootable CD-based Linux Hardware Tester

Matthew Palmer mpalmer at hezmatt.org
Fri Nov 11 11:35:02 UTC 2005


On Fri, Nov 11, 2005 at 08:03:38AM +1100, Avi Miller wrote:
> > is there a program you have in mind?
> 
> No, I'm ignorant about Linux-based hardware testing tools, with the
> exception of memtest86, where my entire knowledge consists of knowing it
> exists. :) I'm essentially looking for a testing suite that will hammer the
> hardware over and over again looking for problems. Ideally, something that
> will testing CPU, Memory and Hard Drive, at least.

A few very simple shell scripts and/or C programs will do that for you.

To test the hard drive:

dd if=/dev/hda of=/dev/null bs=1

To test the CPU:

int main()
{
	int i;
	
	while (1)
	{
		i = i*2;
	}

	return 0;
}

To test the RAM:

#define BLKSIZE 1048576

int main()
{
	char *s;
	char c;
	int i;
	
	while ((s = malloc(BLKSIZE * sizeof(char)))
	{
		for (i = 0; i < BLKSIZE; i++)
		{
			s[i] = c;
			c++;
		}
	}
	
	return 0;
}

Remember, when running that last program, to turn off memory overcommits by
running something like "echo 2 > /proc/sys/vm/overcommit_memory" otherwise
the OOM killer will eat random processes when the program eats all RAM. 
Probably also good not to have any swap space defined.

Note that these programs are very, very basic, and probably don't exercise
the components as well as they *could* be exercised, and (for instance) only
hard drive reading (not writing) is exercised by the first shell script. 
The tricky bit with trying to test HDD writes is that you have to make sure
you don't wipe anything useful -- but, if that's not a problem, you could do
something like:

dd if=/dev/urandom of=/dev/hda bs=1

(for ghods sake don't use it *anywhere* near a machine you want to keep
anything on the HDD of)

To make it all work, you could put all of these little programs onto a CD,
have them all run in the background when the CD booted, and then you can sit
back and watch your machine turn into a pool of slag on the floor.

- Matt
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.linux.org.au/pipermail/linux-aus/attachments/20051111/a8fc43cb/attachment-0001.pgp 


More information about the linux-aus mailing list