I recently found myself needing to switch micro SD cards in my Raspberry Pi 3, not necessarily because it needed a storage upgrade, but more because I had a different device that needed the exact memory card that the Raspberry Pi was using. The problem was that I had already done a lot of work on the Raspberry Pi that I didn’t necessarily want to have to do again. This made me wonder. Could I just clone the micro SD card and be good to go? The answer was yes, and it really wasn’t difficult to do.
We’re going to take a look at how to clone or copy a Raspberry Pi memory card to a new one with potentially more space than the previous.
When I switched memory cards, I switched from a 32GB micro SD to a 64GB micro SD. In my scenario this was a storage upgrade. Going forward you must be using a Mac or Linux computer with appropriate memory card readers. I am not a Windows user so I really don’t know how to do this via a Windows machine.
Plug in both SD cards to your Linux or Mac computer. It doesn’t matter if you insert them via an SD card port or via a USB converter. We’ll need to list out the available drives once they are connected. On a Mac, execute the following via a Terminal:
The above command should list out all the drives and their partitions. It will look something like this:
Pay close attention to the drives and names. I know that my two drives in the above example are /dev/disk7 which is 8GB and /dev/disk5 which is 32GB. When I did this for real, my other drive was really 64GB. Taking note of the wrong drives will definitely result in data loss.
On Linux, to determine the connected drives, execute the following from the Terminal:
The same rules apply as did on a Mac computer.
Once you’ve determined which disks to work with, it is time to start the copy process. The following command will work for both Mac and Linux:
sudo dd if=/dev/rdisk7 of=/dev/rdisk5 conv=notrunc bs=1m
Based on the information earlier, my source disk, the smaller one, was /dev/disk7. The destination disk was /dev/disk5. For purposes of speed, we are prefixing the disk name with an r. This will allow the copy to be significantly faster than if we chose not to include it.
When I copied my 32GB micro SD to 64GB, it took roughly fifteen minutes to complete.
In my scenario, the Raspberry Pi received a storage upgrade. It may not be the same scenario for you, but if it is, you probably want to take advantage of the extra space.
Most Debian flavors of Raspberry Pi Linux include a tool already installed called raspi-config. This tool lets us do a variety of things including the resizing of the SD card. To use it execute the following after having connected to the Raspberry Pi, whether that be through SSH or a screen:
You’ll get a screen that looks like the following:
Follow the steps and reboot your Raspberry Pi. You should be good to go when you’re done. You can validate that the storage upgrade took place by executing the following while connected to the Raspberry Pi:
My storage available was roughly 64GB, which is exactly as it should have been.
You just saw how to copy or clone your Raspberry Pi micro SD card. To finish my story, I have an original GoPro Hero. I went and ordered a 64GB micro SD card for it, but found out after it arrived that the GoPro only supported up to 32GB. Luckily my Raspberry Pi had a 32GB card I could use to prevent me from having to order another one. By cloning the 32GB card I was not only able to take advantage of a storage upgrade, but it also prevented me from needing to reconfigure my Raspberry Pi.
Unsubscribe at any time without hassle.