make image sd card raspberry pi

How to Create an Image of a Raspberry Pi SD Card? (Win/Linux/Mac)

If you click our links and make a purchase, we may earn an affiliate commission. Learn more

SD cards are small and convenient, which is why they were chosen for the Raspberry Pi. But having your system and data depend on this little piece of plastic isn’t the safest :). In this tutorial, I’ll show you how to make a full backup copy of your SD card (system, configuration, and data).

Insert the SD card into your computer to create a complete image with one of these tools:
– On Windows, use Win32 Disk Imager.
– On Linux, the dd command can do the job.
– And on macOS, ApplePi Baker is the best choice for a graphical solution.

That’s the short answer, but these tools are not easy to use for the first time. So, in this guide I’ll show you step-by-step how to do in each case. Before we start, I’ll give a brief explanation on why it’s so important to do backups from time-to-time.

If you’re new to Raspberry Pi or Linux, I’ve got something that can help you right away!
Download my free Linux commands cheat sheet – it’s a quick reference guide with all the essential commands you’ll need to get things done on your Raspberry Pi. Click here to get it for free!

Why Do You Need to Create a Raspberry Pi Image?

If you found this page, there’s a good chance you already know why you want to create an image of your Raspberry Pi. But you may not have considered all benefits of this procedure. Below is a quick list of reasons or cases to help you.

Your SD Card May Stop Working

The first thing to consider is the storage you are using on Raspberry Pi.
As your system and critical data are on a micro SD card, don’t expect to keep it for life in the same state.

sandisk extreme pro fast sd card

The lifespan of a SD card is expected to be 10 years or more. But, this mostly depends on the model, the usage and how you handle it daily. Even if you use the best SD card with your Raspberry Pi (I tested them), data loss may still happen.

If you use your SD card with caution, always in the same device, with low disk usage on Raspberry Pi, it will probably have a long lifespan. But if you change devices regularly, travel a lot, or let your Raspberry Pi write heavy loads all day, it probably won’t.

(Is it safe to let it run 24/7 by the way? Check my answer).

Also, your system can get corrupted, due to updates, security breaches or mishandling.

Prefer reading without ads and popups?
Members get an ad-free version of every guide, plus exclusive project support.
Join the Community | Sign In

In short, don’t expect your SD card to last forever, and anticipate a malfunction at any time.

A Solid Backup Is Mandatory

Basically, I never expect any storage method to be 100% safe.
That’s why I recommend doing regular backups of them if you keep critical data on your card.

I already have an entire guide on how to back up your Raspberry Pi.
And today, we’ll see how to clone the entire SD card onto your computer.
This is the best way if you have a lot of critical or important data.

Lost in the terminal? Grab My Pi Cheat-Sheet!
Download the free PDF, keep it open, and stop wasting time on Google.
Download now

By the way, even if you have a retro gaming solution like RetroPie on it and think you don’t need to be concerned, think again. If there’s a huge catalog of games on your Raspberry Pi, I really recommend backing up your SD card :).

A copy on your computer or on an external drive (I recommend this one on Amazon) will be worth it if you spend a lot of time with your Pi.

Use This Technique to Save Time

When I first started on Raspberry Pi, I tested 5 to 10 new projects each week (while writing my experiences for RaspberryTips). However, the SD card preparation, updates, and configurations (like Wi-Fi and keyboard layout) wasted a lot of time for me.

My solution was to install a basic Raspberry Pi OS on a small SD card and create a backup image on my computer. This way, I could flash this image instead of the default one, and everything would already be ready to use.

I have learned a lot and generally use the configuration files to do this (or recently, I use more and more Raspberry Pi Imager). I have the files on my computer, and I copy them to each SD card I flash (you can learn how to do this in this article). In the beginning this was very useful.

Even so, there are probably many cases where it makes sense to do this (cluster? Multiple web servers? Many Raspberry Pi deployments?).

Hardware Requirements

Here’s the hardware I recommend to follow this tutorial:

  • A USB SD card reader: If your computer doesn’t have one, you can use that kind of adapter to plug your SD card to it. Here is my top pick on Amazon for this.
  • A fast and reliable spare SD card: The idea here is to create a backup on your computer, but it’s also good practice to always test backups, at least once. I recommend getting a second SD card, where you can put the backup and make sure it’s working.
    Here is the best SD card currently. You can also test with this USB drive if you prefer (it can then be used for other things).

Create an Image on Windows

As most of you are generally on Windows, let’s start with this system.

Win32 Disk Imager

Win32 Disk Imager is a well-known tool on Windows for Raspberry Pi And Linux users.
It’s often used to create SD cards (or USB disk) from an image of an operating system downloaded on the Internet.

You can download it here on SourceForge.
It looks like this:

But the goal today is the opposite: creating an image from an SD card.
Win32 Disk Imager can also do this, let’s see how!

Lost in the terminal? Grab My Pi Cheat-Sheet!
Download the free PDF, keep it open, and stop wasting time on Google.
Download now

Step-by-Step Image Creation With Win32 Disk Imager

Here are the steps to follow to create an image of any SD card on Windows, with Win32 Disk Imager:

  • Insert your SD card in your computer.
    If you don’t have an SD card reader on your computer, you’ll need a USB adapter for this (I explain everything here).
  • Find the partition letter corresponding to your SD card: Open the File explorer and go to “This PC”.

    Take note of the drive letter, you’ll need it later.
  • Open Win32 Disk Imager.
  • Start by choosing an image location and name for your image:

    Make sure to have enough free space on your disk where you want to store the image.
    You can use local storage, or an external USB drive.
  • Then select the device you want to back up:

    You’ll typically only see the “boot” partition, but don’t worry, Win32DiskImager will create an entire image of all partitions on the device.
  • You can now click on “Read” to start the copy:
  • The process will start and it can take some time depending on your SD card size (between 15min and 1h in general for a standard size):

Once done, your image is safe, and we’ll now see how to flash it on another card.

Restoring the Image to Any SD Card

I recommend doing at least one test to recover the SD card from this image before considering you are safe.
I have had too many backups in my life that didn’t work when needed, so we can never be sure if a backup will work in real conditions :).

What you can do, is insert another SD card in your computer and flash it with the image.
To do this, you can use Win32 Disk Imager almost the same way:

  • Choose the image file.
  • Pick the device letter in the list.
  • And click on “Write” to start the copy:

If you prefer, there are other tools to do the same thing. The one I recommend everywhere on this website is Etcher. You can also use Raspberry Pi Imager if you want (official software from the Raspberry Pi Foundation). By the way, you can also install Raspberry Pi Imager on RPI OS if you don’t have a PC.

Create an Image on Linux

If you’re a Linux user on your main PC, let’s see how to do this on your favorite system!
I’ll show you on Ubuntu, but the tool is the same on any distribution.

The dd Command

“dd” is a base command on Unix. The goal is to offer a tool to manage files.
You can use it to erase a partition (filling it with zeros), generate a random file, but also to manage disk images!
I’m also using it for benchmarks (like in this post about SD cards).

As dd can do a complete backup of any disk, it’s really useful for this.
Let’s see how to use it!

Quick note: If you find it hard to remember all these commands, I’ve put them all on a one-page cheat sheet. You can download it for free here so you have it handy whenever you're working on a project.

How to Use dd to Back Up the SD Card

Find the Device Name

Looking for the drive letter on Windows is pretty easy, but on Linux it’s a bit more hidden.
A device name on Linux is something like /dev/sdX (if you use an USB adapter), or /dev/mmcblkX (if your computer has an SD card reader).

On Ubuntu, you can use the Disk Utility to find this information:

Lost in the terminal? Grab My Pi Cheat-Sheet!
Download the free PDF, keep it open, and stop wasting time on Google.
Download now

Read next: Looking for a fun challenge? Start building your first Raspberry Pi robot!

I’m using a 16 GB SD card for this test, so this was listed as /dev/sde.
If you don’t have a similar graphical tool on your system, you can run this command in the terminal:
sudo fdisk -l

This command will output a list of drives on your computer.
You just need to find the device name corresponding to your SD card.
In my case, it looks like this:

So, we have a disk named /dev/sde, with two partitions (/dev/sde1 and /dev/sde2).

Create the Image With dd

Once we know the device name, we need the correct command to create the image of this device:

  • Open a terminal.
  • Type the following command:
    sudo dd bs=4M if=/dev/sde of=/home/username/MyImage.img
  • Don’t forget to replace the device name (/dev/sde) and file destination with yours.
  • You’ll get something like this:

    Expect at least 15 minutes to create the image (depending on the size of the SD card).

Note: In any command that uses “dd,” you can add the option status=progress to watch the live transfer stats. For example:
sudo dd bs=4M if=/dev/sde of=/home/username/MyImage.img status=progress

Image Restoration to the SD Card

Copying the image back onto another SD card involves a similar command.
I recommend trying a restore at least one time, just to be sure that your image is working
(try a restoration on a different SD card!).

To copy your backup image to a new SD card, there are a few ways to go about it:

  • The first one is to use dd again, in the reverse order:
    • The command is something like:
      sudo dd bs=4M if=/home/username/MyImage.img of=/dev/sde
    • Edit this command with your path, image name, and device name.
  • The second way is to use a graphical tool like Etcher:
    • Etcher is a free tool you can download here.
      The good news is that it’s a graphical tool and very intuitive.
      After all, the dd command seems simple because you just used it, but in 6 months, you probably won’t remember the correct options.
    • Etcher looks like this:
      etcher menu
      Just select your backup image, your drive (automatic in theory), and click on “Flash!” to start the copy.
  • And a third method is to flash your backup image with Raspberry Pi Imager.
    Choose “Custom” in the OS list, and when prompted, select your backup image.

Whatever the method you use, it should create an exact replica of the original SD card.
Once done, insert it in your Raspberry Pi and check that everything is working correctly.

Create an Image on macOS

The last operating system is macOS.
I will be quick on this tutorial, as I didn’t test because I don’t have a Mac :).
But I know they are working methods to create an image from your Raspberry Pi.

First Method: Use dd

The first method is to use “dd”, like in the previous part for Linux.
As macOS is based on Unix, dd is also available on it.

Just run a terminal and follow the Linux part :).
However, replace “sudo fdisk -l” with “diskutil list” to see a list of storage device names.

Second Method: Try ApplePi Baker

Lost in the terminal? Grab My Pi Cheat-Sheet!
Download the free PDF, keep it open, and stop wasting time on Google.
Download now

If you prefer a graphical tool, I found ApplePi Baker that seems to do exactly what we need.
You can download it here on Tweaking4All.
Scroll down to the ApplePi-Baker V2 download link, get it and install it:

The tool looks like this:

It’s intuitive, with big symbols for each step.
Start by choosing the disk you want to back up on the left, then click on “Backup” to set the image name and location.
Once done, the process starts, and your image is created as with dd.

Restoration on macOS

It’s best practice to try to restore your backup at least once before considering the job done. What you can do is take a new SD card and flash the image to it, then test it on your Raspberry Pi.

I already explained three ways to do this on a Linux OS: dd, Etcher or Imager.
These same three methods also work perfectly on macOS.
To learn more, jump back to the Linux part and find the “Image Restoration” section.

One final way, if you installed ApplePi-Baker, is to use the “Restore” option on the right.
Pick the disk you want to flash (“1” in my picture), and click “Restore” to select the image to flash.
The process will start immediately. After a few minutes, try to boot this SD card on your Raspberry Pi, and see if your backup loads properly.

If everything is OK, you can consider your backup safe.
Redo this same backup process regularly to keep an updated version of the image (if needed).

My Top Picks for Data Storage on Raspberry Pi

  • The best SD card: As mentioned previously, I tested all the most popular SD cards over the years, and this is the ultimate best. It’s not that expensive in comparison to other brands, so I think it’s worth it. Pick two of the same size, so you can keep a full backup if needed.
  • The best external SSD: If you prefer using USB drives instead of SD card, this is the one I recommend. Probably one of the fastest options, just the size of a Raspberry Pi and with a solid case.
  • This NAS: Yes, you can use another Raspberry Pi for your backups on a network folder. But if you really want peace of mind, use at least a 2-bay NAS with redundancy. This way, you’ll never lose your Raspberry Pi image (and other important files). That’s what I use for all my backups.

🛠 This tutorial doesn't work anymore? Report the issue here, so that I can update it!

Want to connect with other Raspberry Pi fans? Join the RaspberryTips Community. Ask questions, share your projects, and learn from each other. Join now.

Video

That’s it, you now know why you should create an image of a Raspberry Pi, and how to do so on any operating system. I hope this guide was useful for you, and if that’s the case, please share it on your favorite social network!

Even if you don’t need this technique yet, it will save you a lot of time in the future if you remember to create images for your most critical systems. By the way, try to keep your backup image in a safe location (or keep two copies), as your PC can also have data loss :).

A good external hard drive (my favorite is this one on Amazon) is probably a good option to consider. Personally, I’m using a NAS at home for all these backups (this one from Synology), but that’s a bit more expensive.

Related links:

Whenever you’re ready, here are other ways I can help you:

Test Your Raspberry Pi Level (Free): Not sure why everything takes so long on your Raspberry Pi? Take this free 3-minute assessment and see what’s causing the problems.

The RaspberryTips Community: Need help or want to discuss your Raspberry Pi projects with others who actually get it? Join the RaspberryTips Community and get access to private forums, exclusive lessons, and direct help.

Master your Raspberry Pi in 30 days: If you are looking for the best tips to become an expert on Raspberry Pi, this book is for you. Learn useful Linux skills and practice multiple projects with step-by-step guides.

Master Python on Raspberry Pi: Create, understand, and improve any Python script for your Raspberry Pi. Learn the essentials step-by-step without losing time understanding useless concepts.

You can also find all my recommendations for tools and hardware on this page.

Similar Posts

5 Comments

  1. Hello,
    Running your software on a MacBook Pro running Big Sur.
    I am trying to back up a Raspberry Pi SD card.
    I tried your software because the previous software, “Balena Etcher” stopped working on my Mac since I upgraded to Big Sur.
    Your software was able to create the image file from the SD card. In order to verify the file, I attempted to burn the image to a new out of the box blank SD card. However when I attempted to image the card, it kept stopping informing me that the card could not be opened with no further details. I checked that the “write protect slider” was in the correct position. Not working. Then I clicked on the option to enable Full Archive Seek, no success. Then I checked the option to do the image resizing. I created another file but then the same problem where it could not write to the SD Card.
    Please help.

    Al

    1. Apologies,
      In the statement above, I thought I was leaving a comment on the site for the software….. I am using “ApplePi Baker 2.2.3”

  2. This is not really helpful because of the free space you save on your hard drive. I’m looking for a way when you are saving only the data to the image, and if you restore the img, the full space is used on your restored sd card.

      1. I was looking for a solution which makes an img file for easy restore. Your tutorial is almost giving the answer, but I had to dig deeper, but I think I found the solution which is dd, but a very important switch is needed not to save free space to the img, which is conv=sparse. I think you should include that to your guide, because it would make it a lot smaller img.
        https://www.digitalocean.com/community/tutorials/how-to-create-an-image-of-your-linux-environment-and-launch-it-on-digitalocean

Comments are closed.