How to limit speed of file copy

bandwidthfile-copyfileslimitnfs

I am copying huge file from NFS mount using dd:

dd if=/mnt/nfs/image.img of=/dev/sda

I need to limit the speed of reading from NFS. How can I achieve it? The only precondition is to use some easy compilable utility in order to put into my custom ram-only live linux distro.

Best Answer

You could use pv:

</mnt/nfs/image.img pv -L 5m >/dev/sda

The -L flag limits the throughput to 5 megabytes per second. pv also writes to the stdout so you have to redirect to the target with >.

Related Question