Gentoo Archives: gentoo-user

From: Pengcheng Xu <i@××××××××.moe>
To: gentoo-user@l.g.o
Subject: RE: [gentoo-user] Testing a used hard drive to make SURE it is good.
Date: Mon, 22 Jun 2020 01:52:26
Message-Id: 00f401d64837$c28efc00$47acf400$@jsteward.moe
In Reply to: Re: [gentoo-user] Testing a used hard drive to make SURE it is good. by Dale
1 I'm wondering that who's email client is broken, yours or mine? I'm seeing a lot of U+FFFD replacement characters in this email, like, behind every stop punctuation ("?", ".", and ")"), but not in your other emails on the list.
2
3 Regards,
4 --
5 Pengcheng Xu
6 https://jsteward.moe
7
8 > -----Original Message-----
9 > From: Dale <rdalek1967@×××××.com>
10 > Sent: Thursday, June 18, 2020 5:14 PM
11 > To: gentoo-user@l.g.o
12 > Subject: Re: [gentoo-user] Testing a used hard drive to make SURE it is good.
13 >
14 > David Haller wrote:
15 >
16 >
17 > Hello,
18 >
19 > On Mon, 15 Jun 2020, Dale wrote:
20 > [..]
21 >
22 > While I'm at it, when running dd, I have zero and random in /dev.�
23 > Where
24 > does a person obtain a one?� In other words, I can write all zeros,
25 > I
26 > can write all random but I can't write all ones since it isn't
27 > in /dev.�
28 > Does that even exist?� Can I create it myself somehow?� Can I
29 > download
30 > it or install it somehow?� I been curious about that for a good
31 > long
32 > while now.� I just never remember to ask.�
33 >
34 >
35 > I've wondered that too. So I just hacked one up just now.
36 >
37 > ==== ones.c ====
38 > #include <unistd.h>
39 > #include <stdlib.h>
40 > #include <stdio.h>
41 > static unsigned int buf[BUFSIZ];
42 > int main(void) {
43 > unsigned int i;
44 > for(i = 0; i < BUFSIZ; i++) { buf[i] = (unsigned int)-1; }
45 > while( write(STDOUT_FILENO, buf, sizeof(buf)) );
46 > exit(0);
47 > }
48 > ====
49 >
50 > Compile with:
51 > gcc $CFLAGS -o ones ones.c
52 > or
53 > gcc $(portageq envvar CFLAGS) -o ones ones.c
54 >
55 > and use/test e.g. like
56 >
57 > ./ones | dd of=/dev/null bs=8M count=1000 iflag=fullblock
58 >
59 > Here, it's about as fast as
60 >
61 > cat /dev/zero | dd of=/dev/null bs=8M count=1000 iflag=fullblock
62 >
63 > (but only about ~25% as fast as
64 > dd if=/dev/zero of=/dev/null bs=8M count=1000 iflag=fullblock
65 > for whatever reason ever, but the implementation of /dev/zero is
66 > non-trivial ...)
67 >
68 > HTH,
69 > -dnh
70 >
71 >
72 >
73 > I got it to compile, at least it created a file named ones anyway.� What I'm
74 > unclear about, where is the if= for dd in the command?� All the commands I've
75 > seen before has a if= and a of=.� The if for input and of for output or target.�
76 > I'm assuming that if I want to target sdb, I'd replace null with /dev/sdb.�
77 >
78 > As I've posted before, even my scripting skills are minimal.� Surprised I got
79 > it to compile even.� lol� Just trying to make sure I don't mess up something.�
80 > I placed all this in the /root directory.� I'm assuming I can copy paste the
81 > commands above while in /root to make it work?� I'm asking because I haven't
82 > tried it yet.�
83 >
84 > Thanks.
85 >
86 > Dale
87 >
88 > :-)� :-)�
89 >
90 >

Attachments

File name MIME type
openpgp-digital-signature.asc application/pgp-signature

Replies

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