Problems formatting an SD card

I’m attempting to format an SD card which has been in an Android phone on a previous occasion. It is therefore formatted as exfat. It is mounted as /dev/sdb and I can view files on it.

I want to wipe it and format it as ext4; but none of the typical methods seem to work.

  • Parted and Gparted operations succeed but once the SD card is re-mounted it is still exfat and the Android files remain on it.
  • Gnome-disk-utility does not succeed, but instead returns 'error synchronizing after initial wipe: Timed out waiting for object (udisks-error-quark, 0).

Any ideas how to solve this?

Could you check to see if creating a new partition table would help?

In Gparted: devices: create a new partition table.
Then create a new partition and format.

Could you check to see if creating a new partition table would help?

Tried this when I ran parted earlier, it returns > all operations succeeded, but when I refresh devices it is still listed as exfat.

Perhaps you will be looking at low-level formatting it.
Do some research and in a way of disclaimer, do it at your own risk.

It sounds to me like it is either set as read only or maybe even corrupted. You might want to try and check the smart status.

Think this is it. Tried deleting files from it, seemed to work, until I re-mounted it and the files re-appeared.

Is it possible that a partition of the SD is mounted when you reformat it?

1 Like

Is this any use?
https://www.linuxquestions.org/questions/linux-hardware-18/micro-sd-card-is-read-only-can%27t-change-it-4175641317/

I think that both gparted and gnome-disks “grey” out the option to format its mounted from memory

Gnome Disks normally shows mounted and unmounted disks I think, in which case you can choose to unmount them or whatever. I wonder if logging out and then logging back in as root may give the OP more options. Otherwise using some kind of rescue disk that you boot from? Apparently SD cards have a switch on them that enables write on/off. I’m not sure about this option however, I can’t test that.

I’m not sure, because whilst it doesn’t seem like there is more than one partition, disks does list two entries for the SD card:

The ‘Drive’ entry does not allow any operations, whilst the 128GB one does, but none are retained once the SD card is re-mounted.

Unfortunately a live iso produces the same result.

How about ```
sudo shred -v /dev/sdx

change sdx to the location of your device and then reformat. It should wipe the whole thing clean.

There should be a space between shred and -v. I tried to edit but it hasn’t gone through!

How do you have the sdcard connected to the computer? If it’s in an adaptor have you tried the switch on the side of it?

IMG20220603135742

1 Like

Check if your SD card is read-only:

cat /sys/block/sdX/ro
(replace X with the letter for your SD card)

If it returns 1 then it is ro.

You could try

sudo echo "0" > /sys/block/sdX/ro

and see if it will make it writable again.

Hopefully if this works, then creating a new partition table with Gparted and thereafter a new partition should work. I guess ; )

Adapter, but as far as I can tell there is no visible switch (even removed the casing and see nothing resembling a switch).

Returns 0, so not ro.

Took about three hours, and whilst the terminal output seemed to shred all of it, three times, re-mounting the sd card still shows the old files.

You might want to try putting it back into the Android device and see if you can delete files and format the SD card there. Just for the sake of testing.

If it is successful, you could put it back into your Linux box and see if you can perform any disk manipulation there.

I would if I had access to one, but it’s been a few years and I’ve long since replaced it. Current phone does not have a slot.

Bummer! :face_with_diagonal_mouth: