5

How can I transfer an .iso file to an USB in parallel to the download of this file so that downloaded data gets directly on my USB without passing through my hard drive.

user123456
  • 4,758
  • 11
  • 52
  • 78

1 Answers1

11

I wouldn't try it on a CD (although it might well be that my old buffering fears are outdated), but it works fine on a USB key; for example:

curl -L http://cdimage.debian.org/debian-cd/8.6.0/amd64/iso-cd/debian-8.6.0-amd64-netinst.iso | sudo dd of=/dev/sdf

downloads the current Debian network installer and writes it to the sdf key.

This works because dd reads by default from its standard input, if no if parameter is given. The -L parameter to curl tells it to follow redirections.

In fact there's no need to use dd; as root,

curl -L http://cdimage.debian.org/debian-cd/8.6.0/amd64/iso-cd/debian-8.6.0-amd64-netinst.iso > /dev/sdf

works fine too.

(Make sure you get the device right! You can easily destroy the wrong drive with this kind of command...)

Stephen Kitt
  • 411,918
  • 54
  • 1,065
  • 1,164