Gentoo Archives: gentoo-user

From: William Kenworthy <billk@×××××××××.au>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Testing a used hard drive to make SURE it is good.
Date: Tue, 16 Jun 2020 07:33:04
Message-Id: ab777ad7-a078-ebf1-8f8e-982c106e7a8e@iinet.net.au
In Reply to: Re: [gentoo-user] Testing a used hard drive to make SURE it is good. by Dale
1 In case no one has mentioned it, check out "stress" and "stress-ng" -
2 they have HDD tests available. (I am going to have to look into that
3 --ignite-cpu option ... :)
4
5 BillK
6
7 On 16/6/20 3:17 pm, Dale wrote:
8 > David Haller wrote:
9 >> Hello,
10 >>
11 >> On Mon, 15 Jun 2020, Dale wrote:
12 >> [..]
13 >>> While I'm at it, when running dd, I have zero and random in /dev.  Where
14 >>> does a person obtain a one?  In other words, I can write all zeros, I
15 >>> can write all random but I can't write all ones since it isn't in /dev. 
16 >>> Does that even exist?  Can I create it myself somehow?  Can I download
17 >>> it or install it somehow?  I been curious about that for a good long
18 >>> while now.  I just never remember to ask. 
19 >> I've wondered that too. So I just hacked one up just now.
20 >>
21 >> ==== ones.c ====
22 >> #include <unistd.h>
23 >> #include <stdlib.h>
24 >> #include <stdio.h>
25 >> static unsigned int buf[BUFSIZ];
26 >> int main(void) {
27 >> unsigned int i;
28 >> for(i = 0; i < BUFSIZ; i++) { buf[i] = (unsigned int)-1; }
29 >> while( write(STDOUT_FILENO, buf, sizeof(buf)) );
30 >> exit(0);
31 >> }
32 >> ====
33 >>
34 >> Compile with:
35 >> gcc $CFLAGS -o ones ones.c
36 >> or
37 >> gcc $(portageq envvar CFLAGS) -o ones ones.c
38 >>
39 >> and use/test e.g. like
40 >>
41 >> ./ones | dd of=/dev/null bs=8M count=1000 iflag=fullblock
42 >>
43 >> Here, it's about as fast as
44 >>
45 >> cat /dev/zero | dd of=/dev/null bs=8M count=1000 iflag=fullblock
46 >>
47 >> (but only about ~25% as fast as
48 >> dd if=/dev/zero of=/dev/null bs=8M count=1000 iflag=fullblock
49 >> for whatever reason ever, but the implementation of /dev/zero is
50 >> non-trivial ...)
51 >>
52 >> HTH,
53 >> -dnh
54 >>
55 >
56 >
57 > Thanks David for the reply and others as well.  I got some good ideas
58 > from some experts plus gave me things to google.  More further down.
59 >
60 > For the /dev/one, I found some which seems to work.  They listed
61 > further down.  I think my google search terms was poor.  Google
62 > doesn't have ESP for sure.  O_o
63 >
64 > I mentioned once long ago that I keep a list of frequently used
65 > commands.  I do that because, well, my memory at times isn't that
66 > great.  Here is some commands I ran up on based on posts here and what
67 > google turned up when searching for things related on those posts.  I
68 > wanted to share just in case it may help someone else.  ;-)  dd
69 > commands first. 
70 >
71 >
72 > root@fireball / # cat /root/freq-commands | grep dd
73 > dd commands
74 > dd if=/dev/zero of=/dev/sd bs=4k conv=notrunc
75 > dd if=/dev/zero of=/dev/sd bs=4k conv=notrunc oflag=direct  #disables
76 > cache
77 > dd if=/dev/zero of=/dev/sd bs=1M conv=notrunc
78 > dd if=<(yes $'\01' | tr -d "\n") of=
79 > dd if=<(yes $'\377' | tr -d "\n") of=
80 > dd if=<(yes $'\xFF' | tr -d "\n") of=
81 > root@fireball / #
82 >
83 >
84 > The target device or file needs to be added to the end of course on
85 > the last three.  I tend to leave out some of the target to make sure I
86 > don't copy and paste something that ends badly.  dd can end badly if
87 > targeting the wrong device. 
88 >
89 >
90 > root@fireball / # cat /root/freq-commands | grep smartctl
91 > smartctl -t long /dev/sd
92 > smartctl -t full  ##needs research
93 > smartctl -c -t short -d sat /dev/sd  ##needs research
94 > smartctl -t conveyance -d sat /dev/sd  ##needs research
95 > smartctl -l selftest -d sat /dev/sd  ##needs research
96 > smartctl -t <short|long|conveyance|select> /dev/sd  ##needs research
97 > smartctl -c /dev/sd  ##displays test times in minutes
98 > smartctl -l selftest /dev/sd
99 > root@fireball / #
100 >
101 >
102 > The ones where I have 'needs research' on the end, I'm still checking
103 > the syntax of the command.  I haven't quite found exact examples of
104 > them yet.  This also led to me wanting to print the man page for
105 > smartctl.  That is a task in itself.  Still, google found me some
106 > options which are here:
107 >
108 >
109 > root@fireball / # cat /root/freq-commands | grep man
110 > print man pages to text file
111 > man <command> | col -b > /home/dale/Desktop/smartctl.txt
112 > print man pages to .pdf but has small text.
113 > man -t <command> > /home/dale/Desktop/smartctl.pdf
114 > root@fireball / #
115 >
116 >
117 > It's amazing sometimes how wanting to do one thing, leads to learning
118 > how to do many other things, well, trying to learn how anyway.  LOL 
119 >
120 > I started the smartctl longtest a while ago.  It's still running but
121 > it hasn't let the smoke out yet.  It's a good sign I guess. I only
122 > have one SATA port left now.  I got to order another PCI SATA card I
123 > guess.  :/  I really need to think on the NAS project. 
124 >
125 > Thanks to all. 
126 >
127 > Dale
128 >
129 > :-)  :-) 

Replies

Subject Author
Re: [gentoo-user] Testing a used hard drive to make SURE it is good. Dale <rdalek1967@×××××.com>