6

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.

Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175
Pablo
  • 245
  • 3
  • 15
  • 1
    [Forget about `dd`](http://unix.stackexchange.com/questions/224277/is-it-better-to-use-cat-dd-pv-or-another-procedure-to-copy-a-cd-dvd/224314#224314). It would be simpler, less error-prone and faster to run `cat /mnt/nfs/image.img >/dev/sda` – Gilles 'SO- stop being evil' Aug 25 '15 at 23:48
  • Still I need to limit the speed becauseI have around 40 similar boxes copying from NFS and image is 2GB, thus killing NFS box and network. – Pablo Aug 26 '15 at 05:58

1 Answers1

6

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 >.

Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175
chaos
  • 47,463
  • 11
  • 118
  • 144
  • @Gilles Sure, thanks for the edit. =) Sometimes I think around too many corners, without seeing the obvious.. – chaos Aug 26 '15 at 05:29