alexjacobm
Posts: 3
Joined: Wed Apr 05, 2017 7:39 pm

Re-formatting the SD card

Wed Apr 05, 2017 7:42 pm

Hello,

I have my Raspberry Pi with a corrupted SD card. I need to remove all partitions and reformat the card and install the OS from the scratch. What OS can I use to do this? I tried Windows and Mac and I could not delete the partitions via these OSs.

Please help!

Thanks!
Alex.

[moderator, just use Balena Etcher works fine on a Mac or Windows PC to install Raspbian, and there is no need for fromatting]

ronny_b
Posts: 5
Joined: Thu Mar 31, 2016 5:23 pm
Location: US

Re: Re-formatting the SD card

Thu Apr 06, 2017 3:32 am

Is it really necessary to delete the partitions? I have never been in this particular situation, but it seems to me that if you just go ahead and format, the formatting would wipe out all the partitions - then you could just set up new ones.

Ron

ghans
Posts: 7876
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany

Re: Re-formatting the SD card

Thu Apr 06, 2017 5:32 am

Try formating the card with a digital camera or camcorder.

ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org

jahboater
Posts: 4774
Joined: Wed Feb 04, 2015 6:38 pm

Re: Re-formatting the SD card

Thu Apr 06, 2017 7:32 am

If you don't need noobs, simply put the new OS on the card without formatting it first.

https://www.raspberrypi.org/downloads/raspbian/

and follow the instructions (which work on Windows, Mac, or Linux - probably easiest on Linux as the tools are standard).

There is never any need to delete partitions or format the card as the direct install simply overwrites everything.

User avatar
Forrrge
Posts: 120
Joined: Fri Apr 27, 2012 6:07 am
Location: Gateshead, UK.

Re: Re-formatting the SD card

Thu Apr 06, 2017 9:34 am

I like the digital camera method and that has worked well for me, however there is quite a nice guide on using a tool in windows here

http://www.raspberrypi-spy.co.uk/2015/0 ... formatter/

alexjacobm
Posts: 3
Joined: Wed Apr 05, 2017 7:39 pm

Re: Re-formatting the SD card

Wed Apr 12, 2017 11:49 am

Thank you very much everyone!
I tried using my camera and it is still showing the folders/files :(
I am thinking the card is corrupted at this point.

hommar
Posts: 173
Joined: Sat Mar 25, 2017 1:55 pm
Location: Russia, Yekaterinburg

Re: Re-formatting the SD card

Wed Apr 12, 2017 2:44 pm

I think your sd is readonly becouse corrupted

memilanuk
Posts: 53
Joined: Fri Aug 09, 2013 2:20 pm

Re: Re-formatting the SD card

Wed Apr 12, 2017 2:51 pm

Did you download and run the SDFormatter program linked in the previous post by @Forrrge?

alexjacobm
Posts: 3
Joined: Wed Apr 05, 2017 7:39 pm

Re: Re-formatting the SD card

Tue Apr 18, 2017 4:35 pm

Let me try that @memilanuk

User avatar
CarlRJ
Posts: 599
Joined: Thu Feb 20, 2014 4:00 am
Location: San Diego, California

Re: Re-formatting the SD card

Tue Apr 18, 2017 5:55 pm

If it's merely the case that the filesystems are jumbled and you want to start over, I highly recommend Etcher, as it's a one-step operation: you point it at the card (it'll probably detect it on its own) and the OS image you want to use, and it does the rest, formatting and setting up the proper partitions and installing the OS (I've used it from macOS, though it's available for Windows and Linux as well).

If the card itself is corrupt, you would be much better off if you draw a big red "X" on that card and set it aside or throw it out, and start over with a new card. When the underlying mechanisms in the card itself go bad, there's no good way to fix that, and you risk losing your data later if you continue to rely on it.

And yes, it can be hard to tell those two failure modes apart. Choose carefully.

User avatar
allfox
Posts: 452
Joined: Sat Jun 22, 2013 1:36 pm
Location: Guang Dong, China

Re: Re-formatting the SD card

Tue Apr 18, 2017 9:13 pm

While the steps in this post is not necessary to install a new image, as the above post said, you could directly write a new image to overwhite the old one. I'm posting for saying it's possible to reformat with Linux. (maybe MacOS also? I dont know)

To erase the card:
sudo dd if=/dev/zero of=/dev/mmcblk0 bs=16M

This would completely erase the card, however usually we could just erase the very beginning part of the card, so that those left content have no index to look up, just like being erased. To do so we could add a count=4 option to the command line, to erase the first 64MB.

Then we make a partition:
sudo fdisk /dev/mmcblk0

press n
enter enter enter until it says done
press w, enter

Lastly, create a file system:
sudo mkfs.ext4 /dev/mmcblk0p1

Done with a freash new card.

peterlite
Posts: 720
Joined: Sun Apr 17, 2016 4:00 am

Re: Re-formatting the SD card

Tue Apr 18, 2017 9:30 pm

You can use a live version of a Linux distribution. Linux Mint is my choice. You boot Linux from a USB stick and use Linux tools such as Gparted. I have a small USB stick, 8 GB, with Gparted set up ready to fix disk problems for the other operating systems you mentioned.

eciramella
Posts: 5
Joined: Wed Jul 04, 2018 1:50 pm

Re: Re-formatting the SD card

Thu Nov 01, 2018 2:48 pm

Hate to dredge up this OLD post, but I find myself reflashing my card as I work through something at the moment.

One thing I've noticed is once I have raspbian on the card, my mac refuses to see the card in the build-in sd card reader slot.

However, on an old DELL 10v I have running Ubuntu, I'm able to reformat and then I can use etcher on my mac.

What is the approved/proper way to reformat these cards, from a mac, once you've chosen raspbian?

User avatar
DougieLawson
Posts: 36327
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Re-formatting the SD card

Thu Nov 01, 2018 3:25 pm

Stick it in a camera, a tablet or a phone and get one of those devices to reformat.

Stick it in a Linux system (like a Raspberry Pi booted from another SDCard) in a USB reader and use fdisk / parted / gparted / cp / dd / mke2fs / mkfs.fat / mkdosfs (pick your poison) to do whatever's needed.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

gordon77
Posts: 4239
Joined: Sun Aug 05, 2012 3:12 pm

Re: Re-formatting the SD card

Thu Nov 01, 2018 4:13 pm

eciramella wrote:
Thu Nov 01, 2018 2:48 pm
Hate to dredge up this OLD post, but I find myself reflashing my card as I work through something at the moment.

One thing I've noticed is once I have raspbian on the card, my mac refuses to see the card in the build-in sd card reader slot.

However, on an old DELL 10v I have running Ubuntu, I'm able to reformat and then I can use etcher on my mac.

What is the approved/proper way to reformat these cards, from a mac, once you've chosen raspbian?
Does it need formatting before etcher ? Does etcher just overwrite everything?

Heater
Posts: 13687
Joined: Tue Jul 17, 2012 3:02 pm

Re: Re-formatting the SD card

Thu Nov 01, 2018 4:23 pm

No it does not need formatting before using Etcher.Etcher is going to blow away whatever formatting was there before.
Memory in C++ is a leaky abstraction .

eciramella
Posts: 5
Joined: Wed Jul 04, 2018 1:50 pm

Re: Re-formatting the SD card

Thu Nov 01, 2018 5:55 pm

DougieLawson wrote:
Thu Nov 01, 2018 3:25 pm
Stick it in a camera, a tablet or a phone and get one of those devices to reformat.

Stick it in a Linux system (like a Raspberry Pi booted from another SDCard) in a USB reader and use fdisk / parted / gparted / cp / dd / mke2fs / mkfs.fat / mkdosfs (pick your poison) to do whatever's needed.
I wish - reformatting it via my Cannon didn't make etcher see it one bit. I'm really searching for a way to do this without several different computers/devices....

eciramella
Posts: 5
Joined: Wed Jul 04, 2018 1:50 pm

Re: Re-formatting the SD card

Thu Nov 01, 2018 5:56 pm

Heater wrote:
Thu Nov 01, 2018 4:23 pm
No it does not need formatting before using Etcher.Etcher is going to blow away whatever formatting was there before.
Etcher simply does not recognize there is a card in the slot....

n67
Posts: 938
Joined: Mon Oct 30, 2017 4:55 pm

Re: Re-formatting the SD card

Thu Nov 01, 2018 6:02 pm

Etcher is weird; there is no need to use it.

Just use "unzip", like this:

# unzip -cq /path/to/raspbian_image.zip > /dev/sdX

where /dev/sdX is the device file for the SD card.

The point of this post is that while there may be some cause for using Etcher (or Win32DiskImager or whatever) the *first* time you set up a Pi - once you are "in the game", it is much easier to use another Pi (or any other available Linux machine) to do the unzipping of the image file to make a new bootable SD card.

P.S. Instead of "-cq", I guess you can also use "-p" - which means the same thing. I have never tried this.
"L'enfer, c'est les autres"

G fytc hsqr rum umpbq rm qyw rm rfc kmbq md rfgq dmpsk:

Epmu Sn!

J lnacjrw njbruh-carppnanm vxm rb mnuncrwp vh yxbcb!

gordon77
Posts: 4239
Joined: Sun Aug 05, 2012 3:12 pm

Re: Re-formatting the SD card

Thu Nov 01, 2018 6:32 pm

eciramella wrote:
Thu Nov 01, 2018 5:56 pm
Heater wrote:
Thu Nov 01, 2018 4:23 pm
No it does not need formatting before using Etcher.Etcher is going to blow away whatever formatting was there before.
Etcher simply does not recognize there is a card in the slot....
I found my windows laptop was similar with Win32diskmanager, putting it in a usb adaptor instead of the SD card slot fixed it.

Heater
Posts: 13687
Joined: Tue Jul 17, 2012 3:02 pm

Re: Re-formatting the SD card

Thu Nov 01, 2018 8:11 pm

Sounds to me like the problem is not with Etcher or whatever.

If the operating system does not recognize and SD card plugged into whatever card reader then of course the likes of Etcher cannot see it either.
Memory in C++ is a leaky abstraction .

n67
Posts: 938
Joined: Mon Oct 30, 2017 4:55 pm

Re: Re-formatting the SD card

Thu Nov 01, 2018 9:17 pm

Heater wrote:
Thu Nov 01, 2018 8:11 pm
Sounds to me like the problem is not with Etcher or whatever.

If the operating system does not recognize and SD card plugged into whatever card reader then of course the likes of Etcher cannot see it either.
Not really.

The implication is that once he formats it (on some other machine - not the Mac), then (and only then) the Mac recognizes it. So, the OS sees it - but not until after the card has been formatted. When all is said and done, this is probably a Mac problem. In its infinite wisdom, OSX is probably refusing to recognize something it "doesn't like".

I know it is unfashionable to say this, but this is the sort of situation where NOOBS (Actually, PINN) would be a good idea. PINN is well setup to handle frequent OS "refreshes" (And does it on the Pi itself, eliminating dependencies on other computers and/or OSes).

Quote:
However, on an old DELL 10v I have running Ubuntu, I'm able to reformat and then I can use etcher on my mac.
"L'enfer, c'est les autres"

G fytc hsqr rum umpbq rm qyw rm rfc kmbq md rfgq dmpsk:

Epmu Sn!

J lnacjrw njbruh-carppnanm vxm rb mnuncrwp vh yxbcb!

Andyroo

Re: Re-formatting the SD card

Thu Nov 01, 2018 9:33 pm

eciramella wrote:
Thu Nov 01, 2018 2:48 pm
Hate to dredge up this OLD post, but I find myself reflashing my card as I work through something at the moment.

One thing I've noticed is once I have raspbian on the card, my mac refuses to see the card in the build-in sd card reader slot.

However, on an old DELL 10v I have running Ubuntu, I'm able to reformat and then I can use etcher on my mac.

What is the approved/proper way to reformat these cards, from a mac, once you've chosen raspbian?
Does it show up in disk manager at all?
I sometimes see faulty drives show as a controller with no disk partitions here and then use the secure erase option at the lowest secure setting (one move right) to check every sector on the drive / card.

Heater
Posts: 13687
Joined: Tue Jul 17, 2012 3:02 pm

Re: Re-formatting the SD card

Thu Nov 01, 2018 9:37 pm

n67,
Not really.
So you disagree with what I said.
...this is probably a Mac problem
Ah, but now you agree with what I said.

Excellent.

Bottom line for me is that is an OS cannot see a block storage device as a block storage device, no matter what formatting it may or may not have on it, then there is something wrong.
Memory in C++ is a leaky abstraction .

User avatar
HawaiianPi
Posts: 4777
Joined: Mon Apr 08, 2013 4:53 am
Location: Aloha, Oregon USA

Re: Re-formatting the SD card

Thu Nov 01, 2018 10:46 pm

eciramella wrote:
Thu Nov 01, 2018 2:48 pm
... my mac refuses to see the card in the build-in sd card reader slot.
Have you tried a USB card reader?

I've found the built-in slots on some computers don't always behave as expected.
My mind is like a browser. 27 tabs are open, 9 aren't responding,
lots of pop-ups...and where is that annoying music coming from?

Return to “General discussion”