I have used Etcher to write the Raspbian image from a file to an SD card. Now I want to duplicate the SD card by reading from the card into a file on my Windows PC, then using Etcher to copy the image to other cards. Warning: the SD card will be totally over-written, so that this SD card will be used only for the Raspberry Pi. Insert your SD card into the computer. Etcher will select it automatically. Etcher won’t write to your hard drives by default, but check that the SD card is listed correctly. Now click Flash! To write the image file to the SD card.
We put USB sticks and SD cards through a lot of work (and abuse), and sometimes it leaves them in a state where they’re unreadable. Learn how to determine if this happens to your tiny data drive and get some tips on how to make it usable again.
As you can probably guess by the types of projects we build and the contents of our blog posts, we are big fans of the Raspberry Pi, Jetson Nano, and similar single board computers here at balena.
Flash OS images to SD cards & USB drives, safely and easily. Etcher is a powerful OS image flasher built with web technologies to ensure flashing an SDCard or USB drive is a pleasant and safe experience. It protects you from accidentally writing to your hard-drives, ensures every byte of data was written correctly and much more. Thankfully there is a very easy way to ‘burn’ or ‘etch’ the image to our SD card. There are several ways to do this and one way is to use Terminal. The benefit of this is no additional software is required, however it is operating system specific and really requires a separate tutorial for each.
Our team flashes hundreds of SD Cards a week while experimenting and deploying devices. We use Etcher, our open source image flashing utility, that’s quite popular in the community. Etcher can write Raspbian to an SD Card for a Raspberry Pi, flash Ubuntu, Fedora, and other popular Linux distributions to USB drives to boot a PC, or write out the contents of an existing disk image for archival purposes.
Etcher is used millions of times per month to successfully write USB sticks and SD Cards. Unfortunately, there are some rare exceptions where a flash is unsuccessful, or, more commonly, a user flashes a Linux image but then does not realize that their Windows or Mac PC can’t read its contents. I see that scenario play out quite a bit on our Forums, so I thought I’d take a few minutes to explain the process of recovering a “broken” device.
![Etcher sd card Etcher sd card](https://www.balena.io/etcher/avatar.png)
The basics
First and foremost, Etcher is completely incapable of “bricking” or killing a drive-- it just doesn’t have that kind of functionality. The application can only write the contents of the provided image file byte-by-byte to the storage medium on the chosen device.
Unfortunately, SD Cards and USB drives absolutely can wear out, and have limited write cycles that they can sustain. Once the storage blocks on the device begin to fail, the drive may certainly become unusable if it does not have some wear leveling built in that can compensate for the failing blocks and move the data to healthy blocks.
To be more precise, Etcher attempts to write data, the drive accepts the data to be written, but the storage bins responsible for keeping all the 1’s and 0’s don’t do their job and permanently hold the data. Two things can occur here:
The flash fails (either during the “writing stage,' or later, in the “verification” stage): Etcher reports that the flash was unsuccessful. If the flash fails during the “writing” stage, the drive is probably dying, and it may be time for a new one. Verification stage errors likely indicate faulty sectors on the device. Windows users may get a false-positive result here on occasion though, as Windows creates a folder on the drive in between the writing and verification stages.
The drive doesn’t realize that the data did not persist or get safely stored in each cell, and happily reports that things completed successfully! But when you go to use the drive later and Ubuntu, Raspbian, or another operating system expects to find data in a specific location, and then that data isn’t there, it’s not going to be very happy. The installation process could halt, the Raspberry Pi might not boot, or other types of system crashes could occur. Again, it’s likely that you might be in need of a new drive, though sometimes re-flashing can help, and data that didn’t stick the first time might just stick the second time.
Alternatively, as mentioned earlier, the other common “dead” device that we see on a regular basis is actually not dead at all: it’s just not recognized and understood by your computer. If you think you might be in this situation, here are some tips to help you regain access to your device.
How to Recover a USB Drive or SD Card
Using Windows
The method you use to restore a device depends upon the operating system your computer uses. Let’s start off with Windows.
In Windows, you’ll need to use the diskpart utility, which is a tool that comes built into Windows, though you’ll need to use the command line to make use of it.
Open
cmd.exe
from the list of installed applications, or from the 'Run..' dialog usually accessible by pressing Ctrl+X. Type ‘cmd.exe’ without the quotes, and press Enter.In the resulting terminal window, type
diskpart.exe
and press Enter. You'll be asked to provide administrator permissions, and a new prompt window will appear. The following commands should be run in the new window. Quake champions classes.Run
list disk
to list the available drives. Take note of the Number ID
that identifies the drive you want to recover. In this screenshot, 'Drive 2' is the attached 32gb SD Card that I want to recover:Run
select disk N
, where N
corresponds to the ID
from the previous step. And then, run clean
. This command will completely clean your drive by erasing any existing file system.At this point the drive is now blank, and can be re-flashed with Etcher. Or, you can add a partition back to it and format it, so that it acts like a normal storage device. Do the following:
- Type
create partition primary
- Type
select partition 1
- Type
format quick
Once successfully formatted, you should be able to use your USB drive or SD card again.
Using MacOS
Follow these instructions if you're using MacOS. Start by opening the Terminal application by going to the Finder, navigating to the Utilities folder, and double-clicking Terminal.
Type
diskutil list
and press Enter. You will see the drives listed, just look for the one that matches your device and make note of the “Identifier” on the right side. In this example, you can see a 32gb SD Card is “disk2”.Type
diskutil eraseDisk FAT32 UNTITLED MBRFormat /dev/diskN
where the “N” is the value shown in the previous command. So in this example, ‘disk2’ is the one that we need to use.Seeing similar results means that this drive should be ready to use again.
Using Linux
Make sure the drive is unmounted (
umount /dev/xxx
), and run the following command as root
, replacing xxx
by your actual device path:dd if=/dev/zero of=/dev/xxx bs=512 count=1 conv=notrunc
We hope this helps restore your drive
At this point you have reset and restored your USB stick or SD card back to a working condition, assuming it was simply in a corrupt state or was not being recognized by your operating system.
However, as explained above, the long-term memory blocks on SD Cards and USB sticks can and do wear out, especially when repeatedly undergoing intense data-writing operations such as image flashes (as opposed to occasional writing of files and folders in the traditional portable storage use-case).
The flash cells used in these devices are typically cheaper quality, and just don’t seem to have the storage integrity and reliability that enterprise grade spinning disks and SSD’s have, ultimately meaning data is not saved as it should be. Etcher will simply try to copy the data in a block-by-block fashion from the image file in use, but if the storage block doesn’t accept the bits and bytes, data corruption can occur and it may be time for a new drive.
Hopefully these steps can help in situations where a bad flash has occurred though, and get you back on your way to deploying Raspberry Pi’s or other IoT devices!
There are a dozen ways to install operating systems for the Raspberry Pi, but we have found the best image writing software. And it’s called Etcher. It’s free, simple to use and is available for Windows, Mac, and Linux. Follow along with this guide and you will see how simple Etcher is to write Raspberry Pi images to your Micro SD Card.
HARDWARE LIST
- USB Micro SD Card Reader
- Minimum 8GB Micro SD Card
SOFTWARE LIST
- Raspbian Lite Image or one of your choice
- Etcher (Windows, Mac or Linux)
Etcher – Raspberry Pi Image Writing Software
All will be good images. First off we need to download the Etcher software for either Windows, Linux or Mac. Follow the Etcher Website link and click beside the green button for the dropdown list of supported operating systems. Windows x64 is fine for most windows users or choose your appropriate system to commence the download.
Sd Card Burner App
When Etcher has finished downloading, you can go to your download location and launch the installer. Depending on your particular computer, this shouldn’t take too long to complete. Once complete, let’s start Etcher!
Select Image
The first screen you will see is the main screen for Etcher. Here it’s as simple as three steps. The first step to complete is to Select the Image you want to write to your Micro SD Card.
Clicking the Select Image button will bring you to your File System where you can choose the image you are going to write. In my instance, I’ve downloaded the latest Raspbian Lite image in ZIP format.
Another great thing about Etcher is you can leave your images compressed, and the software will be able to handle everything. How simple is that! Once you’ve chosen your file, we can go on to the next step.
Select Drive
The Select Drive option is where you will choose the correct drive that you want to Flash the image. You will need to have connected your USB Micro SD Card Reader to your computer with your Micro SD Card inside. When you click on Select Drive, you will see a new window listing all the available drives.
In my example above, there is a KINGSTON 240GB drive and a Multi-Reader USB Device 16GB. So I can tell here that my 16GB Micro SD Card is the correct one to choose. Please be cautious here as some External SSD or Hard Drives may show up in your list.
Select the correct drive, and a Green tick will appear beside it. Then you can click continue, and we can proceed to the last step.
Flash
Here’s where we can review both first steps and make sure we have selected the correct image and the micro sd card. If everything appears to be correct then click on the Flash button. You will see the following screen showing us how far the flashing of the Micro SD Card has proceeded.
Validating
Once the Flashing of the drive has finished, Etcher will then Validate the information and data written to the Micro SD Card. A good Fail Safe measure to make sure everything went the way it should have. Validating is a lot quicker than the Flashing stage, so please be patient.
Flash Complete
Upon completion of the Flash, Etcher will automatically eject the Micro SD Card so you can use it in your Raspberry Pi right away. That is one of the reasons that Etcher is the most accessible pieces of software to write Raspberry Pi images to a Micro SD Card. No need to format or choose the correct File System. Etcher handles all this without any input from you.
Advanced Settings
Now if you fancy getting a bit deeper with Etcher, then clicking on the Cog Wheel Icon in the top right corner will bring you to the Settings section. Here you can change a few settings like Eject on Success or Validate write on Success. Choose wisely, but try and avoid Unsafe Mode as this isn’t something that you would need. It’s mainly for Advanced users wanting to write images to Internal Hard Drives.
Final Thoughts
Sd Card Image Burner
Etcher is a simple and easy to use software package that can write Raspberry Pi images to a Micro SD Card in just a few steps.
- Choose your Image
- Choose your Micro SD Card drive
- Flash the Image to the drive
Etcher Sd Card Locked
It doesn’t get any more simple than that! Ms excel worksheet.