1

I'm new with this so bear with me...

I have this command :

tr '\\0' '\\377' < /dev/zero | dd bs=4096 count=1484095 of=/path/one

Output:

1+1484094 records in
1+1484094 records out
8412124 bytes transferred in 23.670 secs (355391 bytes/sec)

and it doesn't execute for the hole space , meaning bs*count bytes (6078853120 bytes). As you can see it just writes 8412124 bytes. I have added bs and count to fasten the operation.

Where is the issue?

Philippos
  • 13,453
  • Hmm, the byte count isn't even a multiple of bs, and bs is a power of two, so this doesn't look like an integer overflow in display either. Is the target big enough? (It looks like you're onesing out a storage device?) – Ulrich Schwarz Jul 30 '19 at 11:07
  • iflag=fullblock https://unix.stackexchange.com/a/121868/30851 https://unix.stackexchange.com/a/134308/30851 – frostschutz Jul 30 '19 at 11:29
  • i can't use iflag, it doesn't recognize ...I execute this command in a process on an android device – Iulia Barbu Jul 31 '19 at 07:53

1 Answers1

0

As the comments have alluded to, when dd reads a block, it may get an incomplete read. It then writes this out to the destination, only it's incomplete, and so the block only contains partial data.

Basically, dd is not the tool you want to use here. It's rarely the tool to use anywhere, but it's usage is common simply because it's common.

It seems you want to read 6078853120 bytes, so just use head to do this.

tr '\\0' '\\377' < /dev/zero | head -c 6078853120 > /path/one
phemmer
  • 71,831