Note: This article is part of a series. See the Index for more information.
Update: I’ve recorded this series as a screencast for Pluralsight:
(http://www.pluralsight.com/courses/raspberry-pi-home-server)
If you have a Pluralsight subscription, please consider watching it. Thanks!
Sometimes bad things happen to SD cards, and Windows doesn’t always handle it gracefully. I’ve had cards that Windows refused to recognize, and SD Formatter wouldn’t touch. There are a number of ways to fix this. Sometimes, putting the card in a camera, and telling it to format the card will work. If that doesn’t work, all is not necessarily lost. Here are some steps you can try.
Remember that you will lose any information that was on the drive, so don’t do this if you need to recover data from the bad card. There are utilities out there for rescuing data from damaged cards, but that’s beyond the scope of this article.
Note: These instructions are written for a Windows user. The “fdisk” command in Linux performs similar operations, but you’ll have to look elsewhere for the walkthrough.
Remove the bad SD card, along with any other flash drives or SD cards from your computer so you don’t accidentally format the wrong one. Press the Windows key, and “R” together, type “diskpart” at the prompt, and press enter.
You’ll find yourself looking at something that is almost, but not quite entirely, unlike a command prompt.
Type “list disk” to see all the disks in the computer.
Now insert the bad SD card into your reader, and type “List Disk” again, and look for the disk that wasn’t there before.
In this example, Disk 3 is the new entry in the list, and therefore the SD card that we want to reformat. Type “select disk x” where “x” is the number of the new disk from the list.
Before proceeding, be VERY sure you’ve selected the right disk. We’re about to blow away its partition table. If you accidentally chose your primary hard drive, very bad things will happen. Don’t blame me. I warned you plenty.
Once you are ABSOLUTELY sure you have the right disk selected, type “clean” and press enter.
The drive you selected is now a blank slate. Type “create partition primary” to create a brand-new partition table.
Finally, format the new partition by typing “format fs=fat32 quick”. Don’t forget the “quick” part, or you’ll be waiting around a while.
And that’s it. The drive is freshly formatted and ready to use again. If you open a file explorer window at this point, you should see your drive. It will still have its old name, but will be completely empty. Type “exit” to close diskpart. You can now proceed as usual.
Pingback: Raspberry Pi Home Server: Index | MelGrubb.ToBlog()
Pingback: Raspberry Pi Home Server: Part 1, Meet the Raspberry Pi | MelGrubb.ToBlog()
I’ve followed your tutorials and was using a 64GB USB Flash Drive as the Data drive (wanted to have a low power “no moving parts” system. I had an issue with the USB Flash Drive once where it somehow became read only, as if the physical “Read Only” switch on the Flash Drive got set, though there is no Read only switch on this particular Drive. I couldn’t get it to recover since I could no longer boot the Raspberry Pi and ended up having to using a Low Format tool to return the USB Flash Drive to a serviceable state. Currently, I re-did your tutorials but kept the boot & swap partition on the SD Card. I figured it would be easier to clone & restore the SD card as oppose to the USB drive. Do you have any insight how the USB Flash Drive may have gotten “stuck” and perhaps prevent it from happening in the future? Thanks.
Unfortunately, I have not found a way back from a read-only state. I’ve lost two SD cards that way in different circumstances. Maybe someone out there knows how to recover, but as far as I know, that card is a loss.
The two cards I lost were not a particularly good brand, I should mention. None of my major brand name cards have ever died like that, and I put them through a lot while writing this series.
I had a SD card die that way, it was a samsung brand so not one of the worst out there.
I used SystemRescueCD booted into GUI mode and used GPARTED to delete the old partitions on it then reformat it, and it did work.
I do not know why but atleast it is usable again 🙂
/Erik
Thanks for the insight. USB Drives & SD cards are getting like writable DVDs of old where we just look for the lowest cost and not worry about the brand. I’ll try to stick with more recognizable brands in the future.
Pingback: Raspberry Pi Home Server: Part 2, Installing the OS | MelGrubb.ToBlog()
Pingback: Raspberry Pi Home Server v2: Introduction | MelGrubb.ToBlog()