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 > #include > #include > 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 :-)  :-)