1

I was making a bootable SD card for my raspberry pi on ubuntu 18.04 and accidentally I put my computer to sleep. I ended up running my SD card, it doesn't want to format nether be partitioned, I tried using Gparted with no results: there is a red exclamation sign next to a EXT4 partition name. I event tried to use the command:

sudo mkfs.vfat -F32 -v /dev/mmcblk0p2

It displays this and get stuck:

/dev/mmcblk0p2 has 4 heads and 16 sectors per track,
hidden sectors 0x18000;
logical sector size is 512,
using 0xf8 media descriptor, with 10452992 sectors;
drive number 0x80;
filesystem has 2 32-bit FATs and 8 sectors per cluster.
FAT size is 10192 sectors, and provides 1304072 clusters.
There are 32 reserved sectors.
Volume ID is 0538c1e1, no volume label.

Is there a way to fix my SD card ? Thank you for trying to help. Have a nice day.

2
  • Can you access it with cfdisk /dev/mmcblk0 (not the partition, the whole drive)?
    – FelixJN
    May 29, 2019 at 14:33
  • 2
    I always use dd to write zeros to the first 100MB or so of any device (USB stick, SD card, HDD) that has a screwed up partition table. Then I reboot and use gparted. May 29, 2019 at 14:46

1 Answer 1

2
dd if=/dev/zero of=/dev/sd* bs=512 count=32

The above should clear your partition table. Then you should be able to use gparted. Replace /dev/sd* with your device (not your partition. e.g: /dev/sda, not /dev/sda1)

NB: MAKE SURE YOU USE THE CORRECT DEVICE FOR of=... OR HORRIBLE THINGS WILL HAPPEN.

1
  • +1 before I had to have root permission on my SD to make changes and now using that command with root privilages allowed the non-root user to make changes Jul 17, 2022 at 1:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.