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.

  • Have you looked at the man page for pv? The options are all listed there. – roaima Sep 20 '15 at 20:12
  • Actually I am not sure how to use pipes – Pablo Sep 20 '15 at 20:13
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
|improve this answer|||||
  • The question has /dev/sda as the output, not the input. – Gilles 'SO- stop being evil' Sep 20 '15 at 20:29
  • @Gilles Thanks, that was indeed dangerous. – kos Sep 20 '15 at 20:32
1

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.

|improve this answer|||||
  • yes, in /tmp/nfs I just missed the image file name. I will give it a try. – Pablo Sep 20 '15 at 20:31

Not the answer you're looking for? Browse other questions tagged or ask your own question.