dd: write to multiple disks?

You could try dcfldd
It's an enhanced version of gnu dd and it can output to multiple files or disks at the same time:

dcfldd if=masi.img of=/dev/disk2 of=/dev/disk3 of=/dev/disk4

  1. Borrowing from don_crissti's answer using tee, but without dd or bashisms:

    sudo tee /dev/disk2 /dev/disk3 > /dev/disk4 < masi.img
    
  2. Using pee from Debian's moreutils package:

    sudo dd if=masi.img | \
      pee "dd of=/dev/disk2"  "dd of=/dev/disk3"  "dd of=/dev/disk4"
    

    With bash, ksh, or zsh, that can be abbreviated to:

    sudo dd if=masi.img | pee "dd of=/dev/disk"{2..4}
    

    Or even, (if there's no need for dd's useful functions):

    sudo pee "dd of=/dev/disk"{2..4} < masi.img
    

    pee is useful; if required one may include, (within each quoted argument), additional distinct dd options, and even other pipes and filters, individually tailored to each output device.

With either method the number of output disks can be extended indefinitely.


Also this is possible with tee and process substitution:

dd if=/dev/sda | tee >(dd of=/dev/sdb) >(dd of=/dev/sdc) | dd of=/dev/sdd

Tags:

Output

Dd

Files