Pinterest Stumbleupon Whatsapp
Advertisement

How many SD cards do you use with your Raspberry Pi? One? Two? Perhaps you don’t even have an SD card, and rely instead on a microSD with an adaptor to boot your Pi into Raspbian or whatever your preferred OS is.

Using multiple SD cards is more convenient than using just one, enabling you to easily switch between different operating systems for different projects. For instance, you might have an SD card dedicated to running your RaspBMC media centre How To Make Your Raspberry Pi Into a Home Theater System How To Make Your Raspberry Pi Into a Home Theater System Four weeks on and I’ve been playing with my Raspberry Pi in various ways, from using it to browse the web and standard day-to-day computing tasks to playing around with the various configurations that are... Read More and one for your RetroPie gaming system Retro Gaming on the Raspberry Pi: Everything You Need to Know Retro Gaming on the Raspberry Pi: Everything You Need to Know Indeed, who in their right mind would have guessed that the little Raspberry Pi could prove so vital as a platform for so-called retro gaming, offering support for a vast array of emulators and different... Read More . A third SD card may be just the basic Raspbian Optimize The Power Of Your Raspberry Pi With Raspbian Optimize The Power Of Your Raspberry Pi With Raspbian As befits a man with too much tech on his hands, I’ve been playing with my Raspberry Pi recently, configuring the device so that it works to its fullest potential. It continues to run as... Read More , optimised to handle other types of projects or for learning the Scratch development language.

Whether you have one SD card or several, one thing that you will need in each scenario is the ability to back up your cards to avoid the problems that occur when your Raspberry Pi fails to boot.

Cloning Your SD Card? Here’s What You’ll Need!

Planning to clone your SD card? It makes sense, especially if you’ve experienced a Raspberry Pi that refuses to boot because the operating system has become corrupt (something that usually happens after you fail to shutdown correctly 3 Reasons Why Your Raspberry Pi Doesn't Work Properly 3 Reasons Why Your Raspberry Pi Doesn't Work Properly I've been living with the Raspberry Pi for several months now, and have found this astonishing little computer to be even more amazing than expected. Despite its diminutive dimensions, the Raspberry Pi is as fruity... Read More ).

Fortunately, cloning is quick, simple and uses the same utility you used to image the SD card with your Raspberry Pi OS, Win32DiskImager.

muo-rpi-apps-card

Advertisement

You’ll also need plenty of hard disk space. When you create an image of the SD card, the image includes the empty space as well as the portion of the file system that holds the data. We’ve previously told you how using a larger SD card will extend its lifespan, but cloning means that your will be creating an image of the card that is the same as its capacity. So for an 8GB card, you’ll need 8GB on your hard disk drive to save the image to.

However, you can get around this by zipping the file to save space. Uploading to cloud storage will also take the strain off your hard disk drive.

Creating A Disk Image Of Your Raspberry Pi OS

As mentioned, you should be familiar with the Win32DiskImager utility already. To download a fresh copy, head to Sourceforge.

muo-rpi-clone-read

To create an image of your Raspberry Pi, insert the media into your card reader, and launch Win32DiskImager. In the Image File field, enter the file path and name to the location you’ll be saving the image to, and give it a name.

Select your SD card drive letter in the Device box, and when you’re ready click Read to begin the process. After the image is created, safely eject your SD card and replace it into your Raspberry Pi.

When Is The Best Time To Clone Your SD Card?

As with any operating system imaging process, the best time to clone your SD card is when it is configured exactly how you want it. Only then will it be perfect as a backup that you can easily revert to following disaster.

muo-oldsdcard-adaptor

For instance, rather than installing RaspBMC and creating a clone of the media centre operating system right away, it would be a much better idea to install RaspBMC, boot it up, download all of the updates and get the configuration right. It is only when this is done should you create an image of the SD card.

When the operating system refuses to boot, you can then re-image the card with the cloned version, and get back up and running in minutes.

Restoring Your Raspberry Pi Image To SD Card

If disaster strikes your Raspberry Pi operating system, restoring your image file is a case of inserting the SD card in the reader, then using Windows’ Disk Management tool (you could search for this via the Start screen in Windows 8, or in all versions use the quicker WIN+R > diskmgmt.msc) identify and right-click the device, using Delete to remove all partitions on the card. This will prevent the device becoming corrupted.

muo-rpi-clone-write

With your card cleaned up, load Win32DiskImager again and browse for the image file, selecting it. Next, set the drive letter for the Device and click Write to begin reimaging.

After completion, the your cloned Raspberry Pi OS image will be written to the SD card and ready to use!

Raspberry Pi: Keep It Sweet!

Despite being a wonderful and versatile piece of hardware, the Raspberry Pi is occasionally frustrating, usually when a bad shutdown has corrupted the file system.

Using this method of cloning your cards will help to keep this problem to a minimum, enabling quick restores rather than endless repeats of the slow setup process.

Have you tried cloning an SD card, or plan to? Let us know, especially if you have any tips for storage and indexing your Raspberry Pi images.

Leave a Reply

Your email address will not be published. Required fields are marked *

  1. Michael Tanner
    February 8, 2017 at 11:11 am

    Hi thanks for the guide. I have a 128GB Micro SD card which I have cloned to a 200GB Micro SD Card so I would have more room to add additional roms. However using this method it has cloned the 128GB card onto the new card but made the rest of the memory unused. Is there a way to add this memory?

  2. Kai Nilakari
    January 10, 2017 at 6:53 pm

    Hey man, the sd is not recognized by the program! LInux sees it but not windows 7.
    How to cope with that?

  3. art crooke
    December 20, 2016 at 1:46 am

    Why do you use windows instaed linux for cloning. I'm not sure of the procedure for using dd for cloning. Any suggestions

    • Christian Cawley
      December 20, 2016 at 12:34 pm

      Windows was used due to the fact that it remains the widest-used operating system.

      The section on dd in this article should help you out: http://www.makeuseof.com/tag/backup-data-ubuntu-distros/

    • Ekaitz
      January 23, 2017 at 4:05 am

      Change directory to the SD mounted. As root, do:
      # tar -czvf /root/filename.tar.gz *
      This, archive and compress the sdcard data, and save the file in the root directory with the name 'filename.tar.gz'
      To restore in other sdcard, use file-roller, engrampa, etc, as root. For example run 'gksu file-roller'. Or use the command 'tar -xzvf /root/filename.tar.gz', from the directory where the new card is mounted.
      Simple and secure!

  4. Richard
    December 15, 2016 at 6:51 am

    Hi, nice post.
    However it seems there is a problem when i re-install the image to another sd card and use it on my second Pi, the configuration of the program is then not the same. It boots without the standard layout and configuration. The config i made is gone. What can i do?

  5. Remy K
    December 11, 2016 at 11:09 am

    You really need to put a disclaimer in this article about the fact that SD cards do NOT necessarily have the same sizes even across the same manufacturer, brand, speed, even lot. And a card with a bad sector can make an image fail to copy EVEN TO THE SAME CARD.

    So, thanks. I wasted about 90 minutes messing around with cards of the same brand (SanDisk Ultra, 16GB, Class 10) before I realized that images created using your tutorial wouldn't necessarily copy over like they would on regular disk drives. Even an image from the source card won't copy back to the same card. Windows 7, 8, 10 - all the same.

    Here's the thing - you learned this. Look at the comments. People tell you. I would have really appreciated it if you could have just put amended a single line to this article where you say "Hey, this may not work reliably across different cards or brands unless the target card is LARGER than the source card." You spent the time to say "Well, I haven't had this issue" repeatedly, but can't add in a single line disclaimer? Look at all the comments, look at all the time wasted.

    I could have wasted 15 minutes instead of an hour and a half with that one disclaimer. Awesome editing, paisan.

    • Christian Cawley
      December 12, 2016 at 1:37 pm

      Thanks for your feedback, which the section editor will consider.

      It's a shame you wasted your time. However, there is really no need to make your comment personal. On ONE occasion did I state I'd never had the same problem, and in others, attempted to engage the commenter to see if we could find the fault together.

  6. Michael Jackson
    August 5, 2016 at 4:24 pm

    I am trying to clone my SDcard using Win32DiskImager. It keeps raising the error, "Not enough space for specified image." I am using the same exact SD card size to clone my old SD card. What gives?

    • Christian Cawley
      September 13, 2016 at 6:59 pm

      As you don't state at which point you're getting the error, it could be one of two things:

      1. Not enough space on your HDD partition
      2. The SD card you're cloning to doesn't have enough capacity.

    • David S
      November 12, 2016 at 8:40 am

      I had this issue when using the same brand, size, and model SD card. It seems that even though it should be the same size, it only takes a small difference to get his error. Re-partitioning the disk size is an option.. but I just found that when I came across a smaller card I just used that one as my "primary, testing, building" card and when I imaged it I knew it would always be smaller than the new one that was the same model etc..

  7. Lethal
    April 10, 2016 at 2:10 pm

    works just fine under windows 7

  8. ctbram
    April 1, 2016 at 11:10 pm

    Win32DiskImager read DOES NOT WORK ON WIN7!!!!!!!!!!!!

    You get error 5 disk locked. There is no GD way around this and I am about to blow a GD blood vessel after spending the last F-ing 3 hours trying to clone the GD sd card!!!!!!

    • Ahmed Sharaf
      April 12, 2016 at 8:13 pm

      Check for a small tab on your SD Card. Slide it towards the other direction and your SD will unlock.

    • Christian Cawley
      April 12, 2016 at 9:25 pm

      Win32DiskImager should work fine on Win 7. Try Ahmed's solution :)

    • Christian Cawley
      April 12, 2016 at 9:29 pm

      It does work .Just take a look at Ahmed's suggestion, you'll be fine (or your card is corrupt).

      • Jens Hansen
        June 20, 2016 at 6:03 pm

        the name Jens,

        I have been trying to clone a rasbian os to a new sd card. I can save it off but when i go to write it to the new SD card i am informed that the SD card does not have enough memory. It is a 16 gig SD card and the file in properties shows it is twice the size of the SD card capacity. I am using Win32DiskImager to both read and write. and both the SD cards are 16 gig.

        What am i doing wrong.

        Thank you

    • Lolz
      September 29, 2016 at 4:35 pm

      salty!

  9. chfakht
    January 16, 2016 at 4:10 pm

    I have used the dd command in Ubuntu:

    sudo dd bs=4M if=/dev/mmcblk0 of=raspbian.img
    In the new SD card

    df -h
    umount /dev/mmcblk0p1
    sudo dd bs=4M if=raspbian.img of=/dev/mmcblk0
    I get the following error when connecting the pi 2 with a HDMI cable to a laptop : end kernel panic - not syncing : VFS : Unable to mount root fs on unknown-block (179.2) Is there any method to clone SD cards with possibility to use and connect both after the cloning operation?

    Note : the two sd cards have the same size : 32 GB . But they are from different types (manufacturers), the cloned one is a samsung class 10 32 gb --> cloned to kingston 32 gb class 4

  10. Glen E.
    December 5, 2015 at 9:21 pm

    Hello,

    I attempted to use this procedure to clone 1 16GB card onto another 16GB card.

    I received an error trying to write the image onto the card I was copying to. It's as if that card is too small to receive the image!

    However, they are both 16GB SD cards.

    • Christian Cawley
      December 5, 2015 at 9:38 pm

      Are both devices from reputable manufacturers? Cheaper cards often include software to fool the computer as to how big they really are. Also, hidden partitions will possibly impact the available size.

      Best to use identical cards in this situation

      • Claudio
        February 23, 2016 at 3:44 pm

        I used two identical micro sd kingston 32 gb
        yet I have received the message that the space is not enough ...
        someone happened?
        there a solution?

    • Ben
      April 7, 2016 at 11:29 am

      If an SD card has a bad sector or two (most well used SD cards do) then that will shrink the amount of available space. If the target card is more worn than the source one then it'll be a few kb smaller and it won't copy. PITA.

  11. Anonymous
    November 8, 2015 at 3:50 pm

    I cloned my SD card, everything seems to work, except my network, I add my wep key password and it keeps failing. Any ideas? Thanks for your help in advance.

    • Christian Cawley
      November 8, 2015 at 9:21 pm

      Odd, I haven't heard of this. Have you tried switching to WPA?

  12. Richard Mackney
    March 6, 2015 at 1:28 pm

    I used Win32DiskImager but when trying to write the image back to another same brand 16GB micro SD card it is telling me there is not enough space. There seems to be a lot of discussion about shrinking partitions etc, but I was hoping that Win32DiskImager was going to be the only tool I needed.

    • Christian Cawley
      March 8, 2015 at 1:38 pm

      if something like this happens, it is probably worth using the SD Card Formatter tool: https://www.sdcard.org/downloads/formatter_4/

    • Richard Mackney
      March 9, 2015 at 5:22 pm

      Thanks Christian, unfortunately I have used that tool and have the same problem. Apparently others have said that not all SD cards have the same amount of sectors - even same brand :(

    • Christian Cawley
      March 12, 2015 at 6:21 pm

      Oh that is disappointing. Sorry Richard.

    • Count Montecristo
      June 24, 2015 at 2:08 am

      The EXACT same thing happened to me!!! The New SD Card is around 1Gig short of the Image file. What a Crock! :-/

      • Christian Cawley
        June 24, 2015 at 7:18 am

        What brand is your SD card?

        • Count Montecristo
          June 24, 2015 at 7:28 am

          SanDisk

        • Christian Cawley
          June 25, 2015 at 8:16 am

          Hmm. I only ever use SanDisk, never had this problem. What's the rating?

  13. David
    February 24, 2015 at 6:34 pm

    dd or any USB image tool is now definitely second choice to rpi-clone.sh. This has the advantage that an automatic resize is performed, wherev dd has proböems with a smaller SD card.

    Follow the link:

    https://github.com/billw2/rpi-clone

  14. Gabriel
    June 28, 2014 at 10:13 am

    On linux it's even easier!

    Copy
    sudo dd if=/dev/mmcblk0 of=/home/{myaccount]/desktop/myfile.bin
    Copy it back!
    sudo dd if=/home/{myaccount]/desktop/myfile.bin of=/dev/mmcblk0

    if = input file, of = output file
    You may need to change mmcblk0 to another thing.

    I do it when I upgrade a computer with a new (SSD) disk too :)

  15. Dodutils
    June 25, 2014 at 10:19 am

    You also have USB Image Tool http://www.alexpage.de/usb-image-tool/