# Strange behavior with pv and dd. Can't specify count and use pv?



## incorporeal (May 26, 2018)

I am trying to use sysutils/pv with dd to create a simple file.

My intended goal is to create a 1GB file and monitor the progress of it. This seems to not create any data at all because of the use of count=1


```
dd if=/dev/urandom | pv -s 1G | dd of=file bs=1024M count=1
0+1 records in
0+1 records out
65536 bytes transferred in 0.000044 secs (1484394111 bytes/sec)
64.0KiB 0:00:00 [42.5MiB/s] [>
```

If I remove the count=1 then it works but it will continue to write data forever


```
dd if=/dev/urandom | pv -s 1G | dd of=file bs=1024M
43GiB 0:00:12 [ 123MiB/s] [==============================================================================================================================================================] 142% ETA 0:00:00
3096098+0 records in
3096098+0 records out
0+3064118 records in
1+0 records out
1585202176 bytes transferred in 12.406973 secs (127767032 bytes/sec)
1073741824 bytes transferred in 12.406816 secs (86544514 bytes/sec)
```

Is there some obvious reason why I can't use count?


----------



## Eric A. Borisch (May 26, 2018)

I would guess there are some issue with dd(1) trying to write a 1G output block. I would go for (on the source dd side) something like 
	
	



```
dd if=/dev/urandom bs=1m count=1024
```
 You will still want some bs=N other than the default (512b) on the sink dd.

You could also let sysutils/pv to be the cutoff: 
	
	



```
dd if=/dev/urandom bs=64k | pv -Ss 1G | dd of=file bs=64k
```


----------



## incorporeal (May 31, 2018)

This command worked

`dd if=/dev/urandom bs=64k | pv -Ss 1G | dd of=file bs=64k`

Exactly what I wanted thanks.


----------

