Site Map - skip to main content

Hacker Public Radio

Your ideas, projects, opinions - podcasted.

New episodes every weekday Monday through Friday.
This page was generated by The HPR Robot at


hpr4231 :: Duplicating Multiple USB Flash Drives with DD and Tmux on FreeBSD

Claudio describes his process for mass USB flash drive duplication with FreeBSD, tmux, and dd.

<< First, < Previous, , Latest >>

Thumbnail of Claudio Miranda
Hosted by Claudio Miranda on Monday, 2024-10-21 is flagged as Clean and is released under a CC-BY-SA license.
freebsd, tmux, dd, windows, usb, diskduplication, duplication. 4.
The show is available on the Internet Archive at: https://archive.org/details/hpr4231

Listen in ogg, spx, or mp3 format. Play now:

Duration: 00:15:52

general.

Pre-planning and creating your image:

  1. Create your image with your preferred disk image creation tool. I used USB Image Tool to create an image from my "golden master" Windows 11 installation thumb drive A. USB Image Tool: https://www.alexpage.de/usb-image-tool

Prepare your Tmux session on your Linux or BSD-based system.

  1. 'tmux new -s $sessionName' to create a new Tmux session window with a session name of your choice.
  2. 'Ctrl-B-"' to create a horizontal split, putting one pane over the other.
  3. 'Ctrl-B-%' to create a vertical split, putting one pane next to the other.
  4. 'Ctrl-B-UpArrow' or 'Ctrl-B-DownArrow' to move to the pane you want to split if you split the window with a horizontal line.
  5. 'Ctrl-B-LeftArrow' or 'Ctrl-B-RightArrow' to move to the pane you want to split if you split the window with a vertical line.

https://tmuxcheatsheet.com/

Duplicate 4 USB thumb drives from a disk image within your new, split-paned Tmux session:

  • CHECK DMESG FOR THE CORRECT DEVICE NAME AND WRITE IT DOWN!!!
    • FreeBSD will show dmesg output on TTYv0, or you can use the dmesg command on Linux or BSD. You don't want to end up wiping your system drive!
  • Within your Tmux session:
    • Pane 1: 'dd if=$diskImageName of=/dev/da0 bs=1M status=progress' to begin imaging USB thumb drive #1.
    • Pane 2: 'dd if=$diskImageName of=/dev/da1 bs=1M status=progress' to begin imaging USB thumb drive #2.
    • Pane 3: 'dd if=$diskImageName of=/dev/da2 bs=1M status=progress' to begin imaging USB thumb drive #3.
    • Pane 4: 'dd if=$diskImageName of=/dev/da3 bs=1M status=progress' to begin imaging USB thumb drive #4.
    • 'Ctrl-B-:' to call the Tmux command prompt, followed by 'setw synchronize-panes' to sync the 4 panes to your commands. The primary pane will be highlighted in red, and the secondary panes will copy whatever command it typed into that primary pane.
    • Hit Enter to begin the process on all 4 panes.
    • When the image finishes, you can remove the USB thumbs drives, pop in 4 more, hit the Up arrow on the primary pane to pull up the previous commands on their respective panes, and hit Enter. When in doubt, refer to Step 0!!
    • Repeat as needed.

If you need to de-synchronize your Tmux panes, just type 'Ctrl-:' to call the Tmux command prompt, followed by 'setw synchronize-panes' to toggle pane synchronization on and off (or you can use the up arrow at the Tmux command prompt to bring up that previously-typed command).

The faster your USB ports and USB thumb drives, the better!


Comments

Subscribe to the comments RSS feed.

Comment #1 posted on 2024-10-29 15:16:06 by Gumnos

Getting status of dd in OpenBSD

As mentioned, OpenBSD's `dd` command doesn't support `status=progress`, but it does respond to `SIGINFO`, emitting the current progress/status. So if your shell is configured for it¹, you can use control+t to send SIGINFO and see how `dd` is progressing.



¹ you might have to use "`stty status ^T`" in your startup file since it might not be the default

Comment #2 posted on 2024-10-30 01:11:06 by hairylarry

Similarly

I saw your podcast so I had to listen. Very nice. I actually pretty much followed along in spite of never having used tmux.

I have a similar project using abcde to create 4 audio cds at once. (or even 8) I have two xubuntu systems with 4 optical writers in each. (you have to have a tower)

I have my cds in folders with the numbered audio tracks.

Then I have a shell script to start abcde 4 times, once for each device. Before you know it I have 4 more cds to test. Reload blanks, hit up arrow, and go again.

I don't use it much anymore now that cds have gone out of fashion but it was a cool project that used to save me a lot of time.

Comment #3 posted on 2024-10-31 15:30:40 by ClaudioM

Re: Similarly

That sounds pretty neat and would love to hear a HPR episode about it! I'm sure a number of us still use optical media for some things. Thanks for sharing!

Comment #4 posted on 2024-10-31 15:32:09 by ClaudioM

Re: Getting status of dd in OpenBSD

Thanks for that bit of info! Since you had replied to me on Mastodon about it, I've saved it for future reference and will test it out on my OpenBSD machines when I need to dd something.

Leave Comment

Note to Verbose Commenters
If you can't fit everything you want to say in the comment below then you really should record a response show instead.

Note to Spammers
All comments are moderated. All links are checked by humans. We strip out all html. Feel free to record a show about yourself, or your industry, or any other topic we may find interesting. We also check shows for spam :).

Provide feedback
Your Name/Handle:
Title:
Comment:
Anti Spam Question: What does the letter P in HPR stand for?
Are you a spammer?
Who is the host of this show?
What does HPR mean to you?