Cloning a USB stick in Linux or MacOS is really simple. This How To Clone A USB Stick On Mac Or Linux leverages on the MacOS Terminal, but you could easily do the same in a Linux Terminal. To get the USB stick you like to clone cloned, we execute 4 simple commands on the command line. That’s it!
First of all, you like to start your terminal. To start and find your terminal on Mac, simply type “Terminal” into Spotlight Search or leverage on Siri. Depending on your Linux, you either are already on the Terminal or you will find it with your preferred Linux search option.
1. The first step is to check which devices you have available. You like to do this before you plug the USB sticks. On a Mac you do this by leveraging on the “diskutil” comment. In Linux you use “fdisk -l” instead. Depending on the size of your USB stick, as well as on the speed of your Mac or Linux Computer, this takes a while, hence please be patient with your computer.
2. Clone now your USB stick to an image file which we save temporary as usb.img. In step 1 we have identified that in this case the usb stick is on /dev/disk5, hence we will be using this in the following dd command.
sudo dd if=/dev/disk5 of=usb.img bs=4096
3. Once we cloned the USB stick to the image file called usb.img as described in step 2, we now plug the destination USB stick into the USB port and execute once again the diskutil command. Same as in step one. This will help to identify the destination USB stick.
3. Clone now your image file (usb.img) on your destination USB stick (in this case its on /dev/disk4). NOTE: You like to double check whether you plugged and selected the correct source USB stick, otherwise you risk to lose all data stored on the USB stick! As before in step one, depending on the size of your USB stick, as well as on the speed of your Mac or Linux Computer, this takes a while, hence please be patient with your computer.
sudo dd if=usb.img of=/dev/disk4 bs=4096
4. Mount or stick the newly cloned USB stick in your target system, or keep it as a backup or use it for whatever is your use case 🙂 Enjoy!
What was used for the above scenario
I used in the above How To Clone A USB Stick On Mac or Linux scenario a Mac mini 512GB. It however should also work on any other Mac computer. Also it should work on any Linux computer. I used a very fast USB stick, which is the Corsair Flash Voyager GTX 128GB USB 3.1 Premium Flash Drive and one that is a little bit less fast which is the SanDisk 64GB Extreme PRO USB 3.1 Solid State Flash Drive.
More details on the executed commands
When executing the command on step 2, which was “sudo dd if=/dev/disk5 of=usb.img bs=4096”, than you properly noted the “if” and “of”. In step 2 if means the input file, which is obviously the USB stick you like to clone, whilst “of” is the output file, which in this case is the file we called usb.img that is stored temporary on the hard drive of your of the Mac mini 512GB.
For the next step 3 we typed “sudo dd if=usb.img of=/dev/disk4 bs=4096”. In this case the “if” means the input file, which is usb.img that we stored in step 2, whilst of means the output file, which in this case was the destination USB stick.
The difference between copying and cloning is can be significant. This especially if the destination drive should be bootable. In this case copying is typically not enough. This because the relevant system elements for making the destination USB drive bootable will be missing.
Difference between copy and clone in a simple way explained
Copy means: Creating the exact same file name and content in another location. This will be done on level of a file, hence it focuses on files.
Clone means: Copy all the contents of one disk (incl. system elements) to another disk, including the files needed to start a system