make image sd card raspberry pi

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

Creating an entire image of your SD card can be really useful on Raspberry Pi. The system and your data are on this little piece of plastic, which 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 this.
– And on macOS, ApplePi Baker is the best choice for a graphical solution.

That’s for 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.
But before that, we’ll start by a short explanation on why it’s so important to do this from time-to-time, if you aren’t sure yet.

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!

Want the best experience? Become a premium member for ad-free browsing, access exclusive content, and ask questions in our private forums. Your membership helps support the site!

Why do you need to create a Raspberry Pi image?

If you are on this page, there is 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 years 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), it may still happen.

If you use your SD card with caution, always in the same device, with a low disk usage on your Raspberry Pi, it could have a long lifespan. But if you change devices regularly, travel a lot or let your Raspberry Pi run on heavy load all day, it probably won’t (is it safe to let it run 24/7 by the way? Check my answer).

Also, your system may be corrupted one day, due to updates, security breaches or mishandling.

In short, don’t expect your SD card to work forever, and anticipate a malfunction at anytime.

A solid backup is mandatory

Basically, I never expect a 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 on your computer.
This is the best way if you have a lot of critical or important data.

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 is 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 on your Pi.

Also: Don’t waste money — read this guide before picking your Raspberry Pi.

Download Your Essential Linux Commands Guide!
It's a free PDF guide containing every Raspberry Pi Linux command you should know!
Download now

Use this technique to save time

Small anecdote here, when I started on Raspberry Pi, I tested 5 to 10 new projects each week (while writing my experiences on RaspberryTips).
SD card preparation, update and configurations (like Wi-Fi and keyboard layout) was a waste of time for me.

My solution was to create a basic Raspberry Pi OS installation on a small SD card, and create an image on my computer. This way, I could flash this image instead of the one from the Raspberry Pi Foundation and everything would 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 deployment?).

Hardware requirements

Here is the hardware I recommend, to follow this tutorial in the best conditions:

  • 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

Win 32 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.
Win 32 Disk Imager can also do this, let’s see how!

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 Win 32 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 Win 32 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 (a 64 GB SD card can quickly fill a SSD disk ^^).
    You can use a 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 computer.

Create an image on Linux

If you are a Linux user, 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!

Are you a bit lost in the Linux command line? Check this article first for the most important commands to remember and a free downloadable cheat sheet so you can have the commands at your fingertips.

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:

I’m using a 16 GB SD card for this test, so this is this one (/dev/sde).
If you aren’t on Ubuntu and can’t find a similar tool, you can also jump to the terminal and use the following command:
sudo fdisk -l

Also: Want to install Windows 11 on your Pi? Here's how

Download Your Essential Linux Commands Guide!
It's a free PDF guide containing every Raspberry Pi Linux command you should know!
Download now

It will show you a list of drives on your computer. You just need to find the one 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 (if for input file) and the file destination (of for output file).
  • You’ll get something like this:

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

Note: In any command I give you with “dd”, you can add the option status=progress to see the transfer statistics. Example:
sudo dd bs=4M if=/dev/sde of=/home/username/MyImage.img status=progress

Image restoration to the SD card

Copying back the image to another SD card is almost the same thing.
I recommend trying this at least one time, just to be sure that your image is working (don’t try on the same SD card!).

To copy an image to a new SD card, there are two ways you can use:

  • 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
    • For the first time, you need to edit this command with the correct path, image name and device name.
  • The second way, that I always recommend is to use Etcher:
    • Etcher is a free tool you can download here.
      The good news is that it’s a graphical tool and very intuitive.
      The dd command seems simple now because you just used it to create the image, but in 6 months, you probably won’t remember the correct options.
    • The tool looks like this:
      etcher menu
      Just select your backup image, your drive (automatic in theory), and click on “Flash!” to start the copy.
  • And as mentioned previously, you can also use Raspberry Pi Imager if you have it installed.
    Choose “Custom” in the OS list.

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 :).
The only thing to change is to replace “sudo fdisk -l” with “diskutil list” because fdisk is not working exactly the same way on macOS…

Second method: try ApplePi Baker

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

As on any operating system, it’s mandatory to try your backup at least once before considering the job done.
What you can do, is to take a new SD card and flash the image to it, then test it on your Raspberry Pi

I already explained in the Linux part three ways you can use: dd, Etcher or Imager. They will work perfectly on macOS.
If you want to use these tools, go to the previous part about Linux and find the “Image restoration” section.

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

If everything is OK, you can consider your backup safe.
Redo the same 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.
Download Your Essential Linux Commands Guide!
It's a free PDF guide containing every Raspberry Pi Linux command you should know!
Download now

Video

Download Your Essential Linux Commands Guide!
It's a free PDF guide containing every Raspberry Pi Linux command you should know!
Download now

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

If you are looking for exclusive tutorials, I post a new course each month, available for premium members only. Join the community to get access to all of them right now!

Conclusion

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, if it’s the case, please share it on your favorite social network!

Don’t forget this technique, even if you don’t need it 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 the image at a safe location too (or keep two copies), your computer disk can also break or be formatted :).

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:

The RaspberryTips Community: If you want to hang out with me and other Raspberry Pi fans, you can join the community. I share exclusive tutorials and behind-the-scenes content there. Premium members can also visit the website without ads.

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.

The Raspberry Pi Bootcamp: Understand everything about the Raspberry Pi, stop searching for help all the time, and finally enjoy completing your projects.

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.

How would you rate this article?

Click on a star to rate it!

Average rating / 5. Vote count:

No votes so far! Be the first to rate this post.

As you found this post useful...

Spread the word!

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?

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.