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.

2
  • Have you looked at the man page for pv? The options are all listed there. Commented Sep 20, 2015 at 20:12
  • Actually I am not sure how to use pipes Commented Sep 20, 2015 at 20:13

2 Answers 2

3

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.

1
  • yes, in /tmp/nfs I just missed the image file name. I will give it a try. Commented Sep 20, 2015 at 20:31
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
0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.