1

This is my dd command which I need to modify:

dd if=/tmp/nfs/image.dd of=/dev/sda bs=16k

Now I would like to use pv to limit the speed of copying from NFS server. How can I achieve that? I know that --rate-limit does the job, but I am not sure how to construct pipes.

Pablo
  • 245

2 Answers2

2

If for some reason you must read the block device using a block size of 16K:

dd if=/mnt/nfs bs=16k | pv -L <rate> > /dev/sda

Where <rate> is the maximum allowed amount of bytes per second to be transferred, or the maximum allowed amount of kibibytes, mibibytes, gibibytes, [...] per second to be transferred if K, M, G, [...] is specified.

However if you don't really have to read the file using a block size of 16K, just use pv, which can read block devices:

pv -L <rate> /mnt/nfs > /dev/sda
kos
  • 2,887
2

You don't need dd here. pv already does the job of shoveling its input to its output.

pv -L 1m </tmp/nfs >/dev/sda

Despite what you may have read on some web pages, there is no magic in dd. You don't need to use it to access devices. All the magic is in the /dev/stuff.

Note: this command makes sense if /tmp/nfs is a disk image and you want to write it onto the disk /dev/sda. It is equivalent to the command in your question apart from the rate limiting. No NFS server appears to be involved.