0

I have a need to duplicate about 10 USB thumb drives a day from a Dropbox folder that changes slightly each day (about 10GB of data). I considered the $300 "Aleratec 1:10 USB 3.0 Copy Cruiser" but upon study, realized it's no more than a USB 3.0 hub and some basic copying software. I can do this with my own USB 3.0 hub and Terminal in OS X! (Windows 10 is also available if there's an easier way.)

Question: Since the bus is faster than my drives, is there a way I can execute this command to write to all the drives simultaneously? Or any other creative suggestions appreciated. Thanks.

Kara
  • 6,115
  • 16
  • 50
  • 57
CaymanCarver
  • 389
  • 3
  • 14
  • Do you need to reformat the USB drives and overwrite every single byte? Or do you just want to copy file changes? If the latter, I would suggest `rsync` to just copy the differences across. – Mark Setchell Jan 19 '16 at 12:39
  • They are blank formatted drives, I just need to write the data to them once. rsync was my first thought, and it's great for a single destination, but if I had to do all 10 of them serially it would take all day (literally). – CaymanCarver Jan 20 '16 at 00:17

1 Answers1

2

You can format them in parallel quite easily, if you make a little script. Say your drives have the word USB in their names, you could write something like this:

#!/bin/bash

# Don't barf if no drives mounted, or if USB is lowercase
shopt -s nullglob
shopt -s nocaseglob

# Iterate through all mounted USB drives
for drive in /Volumes/*USB* ; do

   # rsync source to USB drive in background
   echo rsync <options> <YOURSOURCE> "$drive" &

done

# wait for all parallel rsyncs to finish
wait

You would save that on your Desktop, as DuplicateUSB and then you make it executable like this in Terminal:

chmod +x "$HOME/Desktop/DuplicateUSB"

Then you can run it by double-clicking it, or going in Terminal and typing:

$HOME/Desktop/DuplicateUSB

At the moment, it only echoes what it would do, but doesn't actually do anything. When it looks to be correct, and you are happy with what it is doing, you can remove the word echo from the line with rsync in it so it actually does the rsync.

Mark Setchell
  • 191,897
  • 31
  • 273
  • 432
  • Sounds like that would do it. Brilliant! Thanks. – CaymanCarver Jan 31 '16 at 20:53
  • Question: In this case all the USB drives are named the same thing, "NO NAME". Will this still work, addressing them by name? – CaymanCarver Jan 31 '16 at 21:04
  • 1
    Start Terminal and run `ls /Volumes` to see the srandard drives. Then insert a memory stick and run the same command again to see what it is called. Then insert another stick and run it again and you will soon see how OSX is naming your drives. – Mark Setchell Jan 31 '16 at 21:12