3

I recently bought a second-hand laptop and I have installed Ubuntu 20.04 LTS on it. Everything appears on the surface to be working fine, but before I switch over to using this laptop as my main computer I wanted to run some tests to see how well the hardware is holding up.

I'm looking for a Linux command-line tool that will go through and test the different hardware and give me some kind of report about how well it's working. If the tool returns a binary working/not working for each component that would be helpful, and I'm sure this kind of tool exists. I'm wondering if it would be possible to go further than that and return some kind of estimation of the wear on each component, eg. I don't know if this information is accessible, but for the storage you could estimate wear by number of GB written. Is there a test that would return some kind of estimation of wear like this for different components?

I tried installing Phoronix Test Suite, but it looks incredibly complex, there's a zillion different options and I don't know where to start with it. So, any advice on either what tool I can use, or how to use PTS for this purpose would be greatly appreciated.

Joe
  • 131
  • 3

3 Answers3

1

I don't think there is a single tool that can easily do everything you are wanting.

To pull the specs of the hard drive/ssd (eg what it thinks of itself, how much use it has had), you can use S.M.A.R.T - The smartmontools package contains smartctl - so you can use a command like

 smartctl -a /dev/devname

Beyond this, you can test the memory using memtest86 or similar and use something like stress/stress-ng to test the CPU.

davidgo
  • 68,623
  • 13
  • 106
  • 163
  • I ran `smartctl -a` and it gave me quite a long output. Can you suggest how to pick out the key figures from this to give an estimation of wear on the drive? – Joe Aug 12 '21 at 12:23
0

You can use stress-ng. Useful stressing flags include: (Here, N represents the number of stressors.)

  1. –cpu N
  2. –io N
  3. –vm N
  4. –hdd N

You can run a command like this:- sudo stress-ng --cpu 4 --io 3 --vm 2 --vm-bytes 512M --timeout 30s. Take the values up to see if it starts causing problems. Then see the system load in the past 5 min using uptime command, or for detailed system load use glance command. For more info on uptime and glance refer to this.

uptime command gives output something like this :- 17:20:24 up 7:51, 2 users, load average: 5.14, 2.88, 2.17. The value that comes in the place of 5.14 is the value you must be concerned with. High values establish how good is your computer.

Note that you will need to install stress-ng before you can use it. Install using sudo apt-get install stress

Saaransh Garg
  • 2,596
  • 14
  • 27
  • OK I ran this with your settings and I got 3.53, 1.08, 0.54. I understand this is giving me some measure of CPU performance during the 30 seconds stress test is that correct? Can I use this performance measure as an estimate for wear over the laptop's lifetime somehow? How would I do that? What do the values 4 3 and 2 that you chose as the parameters refer to? How and why would I increase these numbers? – Joe Aug 12 '21 at 12:59
  • Yes, what you are doing gives you the performance of CPU. This doesn't necessarily show the wear of the laptop, it varies from processor to processor. – Saaransh Garg Aug 12 '21 at 13:10
  • 1
    You can take stress-ng as a manual benchmarking tool. You need to increase the parameters until it causes problems. This program creates artificial load by using functions. 4, 3, 2 represents the number of instances running the same function side by side. For an example, the `--cpu` uses sqrt() function. The parameter '4' means that the computer is executing 4 sqrt() function at a time – Saaransh Garg Aug 12 '21 at 13:16
  • I see. You've chosen to test everything simultaneously, is there an advantage to doing this rather than testing first cpu then ram etc.? What kind of problems am I expecting to occur when I increase the parameters? Also, the 3.53 value that I got on my laptop doesn't mean anything to me as there is no scale. What can I compare this number against to give it some meaning? – Joe Aug 12 '21 at 13:33
  • How many stressors you want to use is a matter of choice. By "problems" I refer to heating, lagging system and crashing of programs etc. As for the value of 3.5, you get a value of 4-5 on a decent system. – Saaransh Garg Aug 12 '21 at 13:46
  • Stress-ng isn't exactly a benchmarking tool, but is a stress-test tool. – Saaransh Garg Aug 12 '21 at 13:59
0

You can also use sysbench. Install by sudo apt install sysbench

CPU Benchmarking:
sysbench --test=cpu run
value on a decent computer-

  1. avg = 40 to 50 ms

MEMORY Benchmarking:
sysbench --test=memory run
Value on a decent computer-

  1. Transfer speed = 3500 to 4000 MBPS
  2. Avg = 0.0ms
  3. Max ≈ 0.15ms

IO Benchmarking:
sysbench --test=fileio --file-test-mode=seqwr run
Value on a decent computer-

  1. Transfer speed = 100-200 MBPS on HDD, 500-600MBPS on SSD
  2. Avg = 0.01ms
  3. Max ≈ 10-12ms
Saaransh Garg
  • 2,596
  • 14
  • 27