I 'm working on a bash script to copy files from a single USB drive to multiple others.
I'm currently using rsync that copies from the source to a single destination, going through all of the output drives in a loop one at a time:
for line in $(cat output_drives_list); do
rsync -ah --progress --delete mountpoints/SOURCE/ mountpoints/$line/
done
I'm trying to optimize the process to get maximum use of the USB bandwidth, avaiding the bottleneck of a single drive write speed.
Is is possible to do something like rsync, but with multiple output directories, that will write to all output drives at once, but read only once from the input?
I guess that some of this is already taken care of by the system cache, but that only optimizes for read.
If I run multiple rsync processes in parallel, this might optimize the write speed, but I'm also afraid it'll butcher the read speed.
Do I need to care about single-read when copying in parallel?
Copying 7,5 GB files with /dev/urandom data to 4 USB devices took 74 minutes in sequential, and 22 minutes in parallel.
Writing 14 devices in parallel - looks like only 7 are active together at each moment - that's the USB 2.0 bottleneck. Still it completed in 28 minutes.
– unfa Mar 09 '17 at 16:08