Content of the material
- DD on Windows
- Create an image on Linux
- The dd command
- Find the device name
- Create the image with dd
- Image restoration to the SD card
- Making the image
- Be a NOOB
- Formatting Your Card
- How to Make an Image of an SD Card in Windows
- 1.3.3. Manual upgrade¶
- Using Linux
- Using the GUI
- Using the CLI (Command Line Interface)
- Writing the Disk Image
DD on Windows
WelcomeHi, I'm Patrick. I am a Linux system administrator, and I am passionate about the Raspberry Pi and all projects on this topic. I created this site to share with you what I learned about it.
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).
Master your Raspberry Pi in 30 days Sale: 10% off today. Download the eBook. Uncover the secrets of the Raspberry Pi in a 30 days challenge. Learn useful Linux skills and practice multiples projects. Get it Now!
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.
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.
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.
Making the image
First start a Windows command line as Administrator (hit the start button, type cmd then right click on the cmd.exe that appears and select Run as Administrator). Next change directory to wherever you unzipped the DD tool.
To copy the SD card to an image file (in this case c:\temp\myimage.img) use the following command line:
In this case we’re using DD with 3 simple arguments:
- Input file (if) is the SD card device
- Output file (of) is the image file we’re creating
- Block size (bs) is 1 megabyte
Be a NOOB
As previously stated, RasPi disks are dual partition, a FAT32 header to boot and a Linux partition for data. NOOBS disks give you the option to install a particular OS from a list, and then it installs the software and alters the boot partition to boot just one OS. To prep a NOOBS disk once you have the files is a case of copying the files, but you have to do a special partitioning job. Again this is easy with ApplePi-Baker.
To make a new NOOBS disk for a Raspberry Pi machine, start the Apple-Pi Baker, select a disk to write to, then hit Prep for NOOBS.
You will be warned again not to decimate the wrong disk, and then it will prep the disk.
Once it’s done its work, you can unzip a NOOBS disk zip file and copy all the files to the disk manually.
Formatting Your Card
We are going to start with formatting your SD card. This step is not strictly necessary, but it does help clean off your card. In some cases if something has gone wrong this will help clean up the mess instead of bring the mess with you.
Always be careful when doing this, it will erase everything on your card, so make sure you are OK losing everything on the card. Also, make sure you select the correct drive! Alternately the tools used to change partition size will also format any card or partition. If your card has been partitioned because it already has an image on it, see the last section on resizing and deleting partitions.
The SD Association has a formatter that is designed to work with both Windows and Mac that they recommend, you can try it or use the following directions – SD Card Formatter
Download SD Memory Card Formatter
- Open “My Computer”
- Right click on the drive with the SD card
- Select “Format”
- Select your file system (FAT32 works fine)
- Feel free to name your card in “Volume Label”
- Quick Format is not quite as thorough but a bit quicker, either option is fine
- Select “Start”
The SD Association has a formatter that is designed to work with both Windows and Mac that they recommend, you can try it or use the following directions – SD Card Formatter.
Download SD Memory Card Formatter
- Open the Disk Utility (Applications -> Utilities ->Disk Utility)
- Select the SD Card
- Select the “Erase” tab
- Select your file system – MSDOS(FAT)
- Feel free to name your card in the “Name” field
- Select “Erase”
- Run Gparted (you may need to install it first using
sudo apt-get install gparted)
- Select the correct device from the drop down menu on the top right
- Select Partition → Format to → fat32
- Click Apply
How to Make an Image of an SD Card in Windows
First, download AOMEI Backupper Standard on your computer, install and launch it. If you are a Windows Server user, please turn to AOMEI Backpuper Server. Then connect your SD card to your computer and make sure it can be detected.
Step 1. Click Backup and choose Disk Backup.
Step 2. Name the task and click Add Disk to choose your SD card.
Step 3. Select the destination path and click Start Backup to start.
You can click backup Options > Compression to choose the compression level. It’s also possible to encrypt the image to protect your data from unauthorized access. If you need encryption, you can upgrade to the Professional edition with a discount.
When you need to restore the image, you can go to Home > find the backup image > click Restore to make it.
To restore an image file without booting Windows, you may create recovery environment with AOMEI Backupper in advance.
1.3.3. Manual upgrade¶
Instead of writing the whole SD card image, it is possible to upgrade only the ecosystem.
A manual upgrade allows you to fix a corrupted SD card image (if only the FAT partition is corrupted) or to install older, newer or custom ecosystem zip files.
Download a zip file from our download server.
Insert SD card into card reader.
Delete all files from the FAT partition. Use
Shift + Deleteto avoid placing files into a trash bin on the same partition.
Extract the ecosystem zip file contents onto the now empty partition.
If you wish to keep wireless settings skip deleting the next files:
This walks you through the process of writing the Embedded Plex Media Player disk image to your USB stick or SD Card using Linux.
Using the GUI
Open the folder where you downloaded the file (usually the Downloads folder in your home directory), find the
PlexMediaPlayer-version-build.platform-architecture.img.gz file, then right-click on it and select Extract Files….
Using the CLI (Command Line Interface)
Each distro has a different way of getting to the Terminal, but it is usually called something like Terminal or Term. On Ubuntu it can be found in the Applications menu.
After opening the Terminal, change to the folder where you downloaded the release archive (let’s assume the Downloads folder in your home directory):
Extract the archive. It will be named
PlexMediaPlayer-version-build.platform-architecture.img.gz. We need to use gunzip to extract the archive.
Writing the Disk Image
Warning!: Your USB Stick or SD Card will be erased by this procedure as it installs Embedded Plex Media Player onto it. Please ensure you know the correct
/dev/disk for your SD Card or USB Stick and that there is nothing important on it.
Insert your SD Card or USB Stick. After you’ve inserted it, use
dmesg | tail to find out what
/dev/device it is. (It should be something like
/dev/sdX) You can also use parted or fdisk:
This will output something like:
Now make sure the disk is unmounted.
Next we need to write the disk image. You’ll need superuser privileges to do this, whether you use the root user or sudo. Either way, you need to execute the following command:
Note: Make sure there’s nothing important on your USB stick as the above command will wipe ALL data on it.
Lastly ensure the changes are synced to the USB Stick before removing it by excuting the following command:
You can now safely remove your SD Card or USB Stick and connect to your Embedded Device
This article uses content from the OpenELEC wiki page , which is shared under the Creative Commons Attribution-ShareAlike 3.0 Unported license
Last modified on: February 28, 2019