public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
From: Dale <rdalek1967@gmail.com>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] Testing a used hard drive to make SURE it is good.
Date: Thu, 18 Jun 2020 04:14:25 -0500	[thread overview]
Message-ID: <91bbab90-88b1-47ac-3c80-a8a842b5b48f@gmail.com> (raw)
In-Reply-To: <20200615231836.xje3kkkihsxrvhaz@grusum.endjinn.de>

[-- Attachment #1: Type: text/plain, Size: 2040 bytes --]

David Haller wrote:
> Hello,
>
> On Mon, 15 Jun 2020, Dale wrote:
> [..]
>> While I'm at it, when running dd, I have zero and random in /dev.  Where
>> does a person obtain a one?  In other words, I can write all zeros, I
>> can write all random but I can't write all ones since it isn't in /dev. 
>> Does that even exist?  Can I create it myself somehow?  Can I download
>> it or install it somehow?  I been curious about that for a good long
>> while now.  I just never remember to ask. 
> I've wondered that too. So I just hacked one up just now.
>
> ==== ones.c ====
> #include <unistd.h>
> #include <stdlib.h>
> #include <stdio.h>
> static unsigned int buf[BUFSIZ];
> int main(void) {
>     unsigned int i;
>     for(i = 0; i < BUFSIZ; i++) { buf[i] = (unsigned int)-1; }
>     while( write(STDOUT_FILENO, buf, sizeof(buf)) );
>     exit(0);
> }
> ====
>
> Compile with:
>     gcc $CFLAGS -o ones ones.c
> or
>     gcc $(portageq envvar CFLAGS) -o ones ones.c
>
> and use/test e.g. like
>
>     ./ones | dd of=/dev/null bs=8M count=1000 iflag=fullblock
>
> Here, it's about as fast as
>
>     cat /dev/zero | dd of=/dev/null bs=8M count=1000 iflag=fullblock
>
> (but only about ~25% as fast as 
>     dd if=/dev/zero of=/dev/null bs=8M count=1000 iflag=fullblock
> for whatever reason ever, but the implementation of /dev/zero is
> non-trivial ...)
>
> HTH,
> -dnh
>

I got it to compile, at least it created a file named ones anyway.  What
I'm unclear about, where is the if= for dd in the command?  All the
commands I've seen before has a if= and a of=.  The if for input and of
for output or target.  I'm assuming that if I want to target sdb, I'd
replace null with /dev/sdb. 

As I've posted before, even my scripting skills are minimal.  Surprised
I got it to compile even.  lol  Just trying to make sure I don't mess up
something.  I placed all this in the /root directory.  I'm assuming I
can copy paste the commands above while in /root to make it work?  I'm
asking because I haven't tried it yet. 

Thanks.

Dale

:-)  :-) 



[-- Attachment #2: Type: text/html, Size: 2556 bytes --]

  parent reply	other threads:[~2020-06-18  9:14 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-15 16:07 [gentoo-user] Testing a used hard drive to make SURE it is good Dale
2020-06-15 19:20 ` Spackman, Chris
2020-06-15 19:54 ` Mark Knecht
2020-06-15 20:00   ` Rich Freeman
2020-06-15 20:04     ` Mark Knecht
2020-06-16  7:34   ` Dale
2020-06-16  8:22     ` Wols Lists
2020-06-16  9:04       ` Dale
2020-06-16 11:02         ` Wols Lists
2020-06-16 11:26           ` Dale
2020-06-16 11:36             ` Michael
2020-06-16 12:25               ` Rich Freeman
2020-06-16 23:38                 ` antlists
2020-06-17  9:47                   ` Rich Freeman
2020-06-23 16:14                 ` Sid Spry
2020-06-23 17:20                   ` Rich Freeman
2020-06-23 18:44                     ` Sid Spry
2020-06-16 13:14               ` Dale
2020-06-16 23:24             ` antlists
2020-06-17  4:47               ` Dale
2020-06-17 12:32                 ` Wols Lists
2020-06-17 12:04                   ` Rich Freeman
2020-06-16  8:29     ` Neil Bothwick
2020-06-16  8:52       ` Dale
2020-06-15 19:54 ` [gentoo-user] " Grant Edwards
2020-06-15 20:04   ` Grant Edwards
2020-06-15 23:03 ` [gentoo-user] " madscientistatlarge
2020-06-15 23:18 ` David Haller
2020-06-16  7:17   ` Dale
2020-06-16  7:32     ` William Kenworthy
2020-06-16  7:37       ` Dale
2020-06-17 15:27     ` David Haller
2020-06-18  8:07       ` Dr Rainer Woitok
2020-06-23 16:08     ` Sid Spry
2020-06-23 16:38       ` [gentoo-user] " Grant Edwards
2020-06-23 16:41         ` Sid Spry
2020-06-23 17:26           ` Dale
2020-06-23 18:32             ` Sid Spry
2020-06-23 19:37               ` Dale
2020-06-23 20:03                 ` Rich Freeman
2020-06-24  4:26               ` Wols Lists
2020-06-18  9:14   ` Dale [this message]
2020-06-22  1:52     ` [gentoo-user] " Pengcheng Xu
2020-06-22  2:15       ` Dale
2020-06-22 19:10     ` David Haller
2020-06-22 20:29       ` Dale
2020-06-22 22:59         ` David Haller
2020-06-23  4:18           ` Dale
2020-06-17  6:02 ` Dale
2020-06-20  9:50 ` Dale

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=91bbab90-88b1-47ac-3c80-a8a842b5b48f@gmail.com \
    --to=rdalek1967@gmail.com \
    --cc=gentoo-user@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox