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 looking to quickly progress on Raspberry Pi, you can check out my e-book here. It’s a 30-day challenge where you learn one new thing every day until you become a Raspberry Pi expert. The first third of the book teaches you the basics, but the following chapters include projects you can try on your own.
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.
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.
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?).
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
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 command is something like:
- 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:
Just select your backup image, your drive (automatic in theory), and click on “Flash!” to start the copy.
- Etcher is a free tool you can download here.
- 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.
Reminder: Remember that all the members of my community get access to this website without ads, exclusive courses and much more. You can become part of this community for as little as $5 per month & get all the benefits immediately.
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.
- Complete guide to back up a Raspberry Pi
- Benchmark of the best SD cards for Raspberry Pi
- 25 projects ideas to try at home on Raspberry Pi
Not sure where to start?
Understand everything about the Raspberry Pi, stop searching for help all the time, and finally enjoy completing your projects.
Watch the Raspberry Pi Bootcamp course now.
Master your Raspberry Pi in 30 days
Don’t want the basic stuff only? 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.
Download the e-book.
If you just want to hang out with me and other Raspberry Pi fans, you can also join the community. I share exclusive tutorials and behind-the-scenes content there. Premium members can also visit the website without ads.
More details here.
Need help building something with Python?
Create, understand, and improve any Python script for your Raspberry Pi.
Learn the essentials step-by-step without losing time understanding useless concepts.
Get the e-book now.
You can also find all my recommendations for tools and hardware on this page.