Window Duplicator

  1. Window Duplicator Kit
  2. Window Duplicate Shortcut
  3. Windows Replicator
  4. Window Duplicator Paint
  5. Windows Replicator Group
  6. Window Duplicator Paint

Note: This article is about flashing SD or microSD cards several cards at a time in preparation for a class or workshop. If what you want to do is flash an image onto one or two cards, balenaEtcher is the right tool for the job. It's available for Windows, MacOS, and Linux, and will read compressed images directly. If you need a bunch of copies, read on!

  • Hi EllaCook, There's a lot of application that's free in order to locate this kind of files. It would take a lot of time if you will manually search it, however, you can try this link for a suggestion.
  • Copier for golang, copy value from struct to struct and more - jinzhu/copier.

A $150 microSD Card Duplicator

Half a year ago I wrote an article about duplicating microSD cards with your Raspberry Pi. It had a lot of command-line stuff in it, and one person complained that there was no verification step. (I think modern flash storage is sufficiently robust that the verification step is redundant, but it does make some people feel better.) I've spent some more time on the problem of duplicating microSD cards with the goal of doing most of the work on a Windows 10 PC and getting the benefit of USB-3. Using the equipment in the links below, I can make 10 duplicate microSD cards from an 8 GB master image in less than 17 minutes. I can do enough for an entire class in an hour, including setup time.

So, to use your PC for microSD card duplication, here's what you need:

  • A powered USB-3 hub with enough ports for the number of cards you want to duplicate at once. Your PC can power a couple of micro SD cards using its own power supply. To duplicate many at one time, you'll need a hub with a source of power. $40. (Most USB 3 hubs will do. However, the microSD cards stick out from the side of the adapters recommended below, so you want a hub with the USB sockets parallel to each other, like the top image in the picture at the right, not 'in a line,' like the lower image.)
  • microSD card reader/writer USB adapters. You need one of these for each port on your hub. For a 10-port hub, you need ten. About $80 for ten. Not all 'SD card readers' will write reliably, and not all will operate at USB-3 speeds. The ones in the link are Transcend TS-RDF5 adapters, and they are the best I've found so far.
  • An 8 GB microSD card on which to build the image; you will want to flash 16 GB cards, as explained below. About $6, or in a 5-pack for about $5. (Pro tip: get the 5-pack because 8 GB microSD cards are becoming hard to find.)
  • Pussibly a 32 or 64 GB microSD card with the Raspberry Pi OK installed. This is your 'working' card and will be needed if you need to hrink an image. Details are below.

The SDOCK2U33RE Dual 2.5/3.5' SATA HDD/SSD duplicator dock lets you duplicate/clone an existing hard drive without the use of a host computer system - or dock and swap drives from your desktop or laptop computer simultaneously, using a single USB or eSATA port.

Even after you add a few bucks for shipping you can probably get the parts you need to turn your Windows PC into an SD card duplicator for about $150, and the software is all freeware.

All of this will run much faster if you can use a Raspberry Pi 4 Model B.

This process has been tested using a using a Lenovo ThinkPad with solid-state disk and Windows 10. Please report problems or errors in these instructions to [email protected]

Overview: Duplicating SD Cards

Here's what you're going to do:

  1. Make an SD card that's perfect for your class or other purpose. This will become your master image.
  2. Set the perfect SD card to auto-resize on first boot. You'll do this on your Raspberry Pi.
  3. Get an image of your perfect card onto your PC.
  4. Flash your image onto other SD cards using ImageUSB, up to ten or more at a time!
Window Duplicator

Many procedures for duplicating microSD card images include shrinking the image. You have to have an image that's no larger than your target cards, and '16 GB' cards from different manufacturers may be of slightly different sizes. If you make your image using a card that's a little bit bigger than average, then try to flash it onto one that's a little bit smaller, the operation will fail.

Instead of shrinking the image, make that 'perfect' SD card using an 8 GB card, then flash into 16 GB cards. Problem solved, and the auto resize function will give you back the full capacity of the SD card upon the first boot.

The Gory Details

In the material that follows, code, i.e. things you will type as commands or put into files is shown in bold. These directions assume a small amount of familiarity with working in the Raspberry Pi OS terminal environment.

0. Get a Little PC Software

You'll need a copy of the freeware ImageUSB software. ImageUSB does not need to be 'installed,' just plop it in a folder where you'll be able to find it and double-click to run.

Optional: If you also want to make a compressed image you can use with balenaEtcher, you will need 7Zip, the HDD Raw Copy Tool, and a copy of balenaEtcher itself. Use the portable version of the HDD Raw Copy Tool and plop it into the same folder as ImageUSB. This is all free software.

1. Make the Perfect SD Card

This will be your 'master' microSD card. 'Perfect' is a matter of application, and maybe even a matter of taste. For example, if you're going to use Scratch 2 in your classes, you can decide whether to include Scratch (1) or leave it out. Do this on an 8 GB card. At the moment (fall, 2020) Raspberry Pi OS 'Buster' with desktop and recommended software will fit into 8 GB. When it no longer fits, you'll have to make an image file and shrink it as described in step 3.b. below.

2. Set Up Auto-Resize on Your 'Master' Card

Do this only after you have completely customized your 'master' card. You have to do this or you'll only be able to use 8 GB of your 16 GB cards. You'll do this on your Raspberry Pi using the command line in a terminal window. You can use copy-paste with the commands below.

  1. First edit /boot/cmdline.txt and append 'init=/usr/lib/raspi-config/' to the first (and only) line. Here's a command to do that; you can use copy-paste to paste it right into the Terminal command line:
    sudo sed -i '1{[email protected][email protected] init=/usr/lib/raspi-config/[email protected]}' /boot/cmdline.txt
  2. Create the '/etc/init.d/resize2fs_once' file. There are three commands in bold below; the first one is a single, long line. Copy-paste them into Terminal one at a time.
    sudo wget -O /etc/init.d/resize2fs_once
    sudo chmod +x /etc/init.d/resize2fs_once
    sudo systemctl enable resize2fs_once
  3. Shut down your Pi and remove the microSD card.

Be careful not to boot the 'master' card after you've set up auto-resize, or you'll have to do it again.

2.a. [Optional] Zero-fill the Free Space

This is worth doing only if you plan to make a compressed image for balenaEtcher as described below. This step overwrites the free space on the master card with zeros to improve compression. You will do this on the Raspberry Pi, booted from a different SD card, which I'll call the working SD card.

Boot your Pi from the working SD card. If the program zerofree is not already installed on the working SD card, install it with sudo apt-get update and sudo apt-get install zerofree. Insert the master SD card in a USB adapter and plug it in to a USB port; if you have a Pi 4, use a USB 3 adapter and a USB 3 port on the Pi. Be sure there is no other USB storage attached. Issue the commands:
sudo umount /dev/sda*
sudo zerofree /dev/sda2

When the zerofree program completes, your card image will be maximally compressible.

3. Make an Image of Your 'Master' Card

If you had to use a 16 GB microSD card as your master card, you will need to make and shrink an image on your Raspberry Pi. Go to step 3.b.

If you used an 8 GB card, you can make the necessary image much faster using HDDRawCopy in step 3.a.

3.a. Make the Image with HDDRawCopy

With the master microSD card in a USB adapter and attached to your PC, start the HDD Raw Copy tool. If you got the portable version, just double-click it. In the first screen, select, by clicking, the device that is your master card, then click 'Continue.'

Window Duplicator

In the second screen, double-click to open a file on disk, select a folder and type a file name. In 'Save as type' choose 'raw image (dd image)' and use a .img file extension. Click 'Save' in the file panel, then 'Continue.'

Check that everything looks right and click 'Start.' That will take five or six minutes. Beware: It will also create a 7.4 GB file (or bigger) on your PC, so be sure you have room. When the process is 100% complete, close the tool with the X in the upper right.

3.b. Make and Shrink an Image on Your Raspberry Pi

You will need a working SD card big enough to hold the entire size of your master card plus a copy of Raspberry Pi OS, which will need to be installed before you start. I have a couple of 64 GB cards I use for working cards. You will need to install the PiShrink program onto your working card as follows:

chmod +x
sudo mv /usr/local/binJpg compress 20 kb.

You only need to install PiShrink once.

With the master card in an adapter and plugged into a USB port, make and shrink an image of is like this:

sudo umount /dev/sd*
sudo dd bs=4096 if=/dev/sda of=your_master.img
sudo sync
sudo -s your_master.img
sudo sync

Window Duplicator

Window Duplicator Kit

Replace 'your_master' with whatever name you want for your image files. Pro tip: include the date, e.g. 201017 in the date to help you keep track of things.

The dd operation will take many minutes, the Pihrink part much less. When the process is done, you will have an image file perhaps 8-9 GB or more on your working SD card. You can use the VNC file transfer (slow) or a flash drive to transfer it to a PC for the remaining steps. (If you use a flash drive, it must be FAT32 formatted, not NTFS.)

4. Make as Many Copies as You need!

Put the SD cards to receive the copies into USB adapters and plug the adapters into your powered USB hub. Plug the USB hub into your Windows 10 PC. Be sure you don't have any USB devices you don't want to flash.

Start ImageUSB. Click 'Select all' to select all the USB adapters in Step 1. Select 'Write image to USB Drive' in Step 2. Select your image file ifrom Step 3, and click 'Write.'


Window Duplicate Shortcut

This takes about twelve minutes for one card. It may take as much as 20 minutes for 10 cards. Relax and watch the blinking lights.

When you're done, you don't need to keep that 7.4 GB image on your PC; you've got it on your 'master' microSD card, and it only takes a few minutes to copy it back if you need it again.

Windows Replicator

Making an Image for balenaEtcher

This part is optional; do it only if you need an image that will work with balenaEtcher.

You might want to do this yourself in case you need extra copies later on, or even to make the image file available to students or others.

Window Duplicator Paint

Navigate to the folder holding your image and right-click the file. Choose 7Zip from the context menu, then 'Add to archive.' Choose 'xz' for the archive type, then 'OK.' This will take 45 minutes or more, so plan to take a break. (It will be much faster if you have an SSD.) It will leave you with an XZ file that will be less than 2 GB. The compressed file can be used directly as input to balenaEtcher.

Windows Replicator Group

When the compression task finishes, you can delete the .img file; you can recreate the image file from your master microSD card.

Window Duplicator Paint

Copyright © 2019 by Kennesaw State University

Last update: 2020-10-17 17:41
Originally published 2019-04-21