Re: Don't Format SD cards with OS utilities!

I have a Yun whose SD card used to work (last week), and has now stopped working. I tried all kinds of stuff, including re-formatting.

Major symptom is this: When you plug in the card, it does not auto-mount and /mnt/sda1 is not found. ls can't find it. df can't find it. The format sketch reports that it can't find the card. Meanwhile, the SD card works perfectly in both a Linux Mint system and in a Windows 7 system.

I have been busting it for days, and have tried everything I can think of. I even bought another SD card. Same thing.

Possible problems: -some kind of crazy format lock-up issue (unlikely) -physical damage to the card connector (I can't see anything wrong) -electronic damage to the card connector, such as static or hot swap issues -corrupted drivers in /dev/sda

If nobody can tell me what is better, I am going to re-flash the Yun with the latest release of OpenWRT, but it would be much better to have an actual understanding of this problem (and how to fix it).

Thanks for answering this!

More: Using the sdcard.org utility sort-of fixes the problem, in that it allows the yun to mount /dev/sda1. Limitations are that it only formats in FAT format, and that when I use the Disk Expansion script, it fails and puts the SD card into a useless state.

Progress, but not a complete solution. . .

Clearly the SD formatter won't produce the Yun SD. SD formatter did produce a SD that the Yun can mount so the question is why can't the Yun reformat this disk?

The Yun is trying to format the SD with two partitions, a FAT32 partition and an ext4 partition.

I think the format sketch asks you for the size of the data partition. This is the FAT32 partition so it must be large enough to format FAT32 but you must also leave enough space for the ext4 partition. Files are copied from the Yun flash to the ext4 partition.

Does the Yun print an error message when the YunDiskSpaceExpander fails?

It sort-of gives an error message. Like this: Serial.println(F("\nerr. formatting to FAT32"));

Followed by this:

halt();

The really maddening thing about this is that I got it to work and install the SD cards as /overlay on four different Yuns a few weeks ago. Now, none of them works. . .

I think that what is needed is either a way to restore the SD card to the factory condition (SD format apparently is not good enough), or a less automated process than the Sketch from the web site. At least, something that gives better error messages. . .

I think that what is needed is either a way to restore the SD card to the factory condition (SD format apparently is not good enough), or a less automated process than the Sketch from the web site. At least, something that gives better error messages. . .

The SD Association's SD Formatter restores the SD to the standard SD format.

I had access to the standard SD format specification. The standard specifies a single specific format for a given card size.

I wrote an Arduino example, SDFormatter.ino, for SdFat that first totally erases every block on the SD then creates the standard format.

I think your problem may be the size you specify. The Yun is trying to format a FAT32 partition and an ext4 partition. I believe the size is for the FAT32 partition and the rest of the SD will be in the ext4 partition.

If the size of the FAT32 partition is too small, the partition can't be formatted FAT32. If the size is too large, the ext4 partition can't be created or will be too small for the files to be copied to the ext4 partition.

I agree, the sketch should tell you exactly why it fails. Also the Yun sketch should accept any SD card formatted or not. My SDFormatter sketch does not look at the existing format, just wiped the SD clean and does a totally new format.

The SD Association's formatter also totally rebuilds all file structures.

I tried the YunDiskSpaceExpander sketch with an 8 GB SD. I allocated 2 GB (2000 MB) for the data partition and used the 1.6.3 IDE.

The SD was initially formatted with SDFormatter.

It seems to work.

Note: you must select Newline ending for serial monitor input.

This sketch will format your micro SD card and use it as additional disk space for your Arduino Yun. Please ensure you have ONLY your micro SD card plugged in: no pen drives, hard drives or whatever. Do you wish to proceed (yes/no)? yes

Starting Bridge...

Ready to install utility software. Please ensure your Arduino Yun is connected to internet. Ready to proceed (yes/no)? yes Updating software list... Software list updated. Installing software (this will take a while)... e2fsprogs mkdosfs fdisk rsync installed

Proceed with partitioning micro SD card (yes/no)? yes Enter the size of the data partition in MB: 2000 Partitioning (this will take a while)... Micro SD card correctly partitioned

Creating 'arduino' folder structure... Copying files from Arduino Yun flash to micro SD card... Enabling micro SD as additional disk space... enabled

We are done! Yeah! Now press the YUN RST button to apply the changes.