SD Card is showing strange behavior

(Justin Russo) #1

Hi I am trying to boot Linux with the Freedom Unleashed 500 work-flow. I ran into some issues with formatting my SD card. I follow the steps found in the instructional PDF but when I try to write the table to the disk and exit it says:
“Warning! An error was reported when writing the partition table! This error MIGHT be harmless, or the disk might be damaged! Checking it is advisable.”
I cannon see it when typing sudo fdisk -l either, however I can see it in the /dev directory (it shows up as /dev/sdb). How would I check to see if the SD card is damaged, or how can I fix it such that it can still boot Linux? Any response would be greatly appreciated.

(Nick Knight) #2

I just spent a few days debugging a similar problem that turned out to be due to a defective SD card. Here’s how I identified the problem.

Unplug your SD card, do a
ls /dev
then reinsert your SD card, and look for a new device called /dev/sd<X>, where <X> == a,b,c,… For me, it appears as /dev/sdb.

Next, check if there are any devices called /dev/sdb<N> where <N> == 1,2,…, you will need to unmount them before proceeding. Type
and identify where /dev/sdb1, /dev/sdb2, etc., are mounted. For example, I see:
/dev/sdb1 on /media/knight/boot type vfat (rw,nosuid,nodev,relatime,uid=1000,gid=1000,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,showexec,utf8,flush,errors=remount-ro,uhelper=udisks2)
Then type
umount <path>
where <path> is where the device is mounted; in my case, I used <path> == /media/knight/boot .
Once all the sdb<N>'s are unmounted — which you can verify by running
again, check for “bad blocks” with
sudo badblocks -n -v /dev/sdb
This will take a while. If there is any output (besides the “Finished” message), then you have corrupted blocks, and you shouldn’t trust your SD card.

Internally at SiFive we’ve had best luck with SanDisk Ultra or SanDisk Extreme (the bicolor ones), but this is not an official endorsement.