Fixing SD-Read Only Remount


Coldbird

Member
Joined
Aug 15, 2010
Messages
397
Many Pandora users, including myself suffered from this problem... you did something CPU intensive and wanted to write a big chunk of data to your SD-card when suddenly you get a IO-Error Message and the SD-Card remounts in Read-Only Mode...


Well, good news - I've found the cause and fixed it...


This problem seems to be related to Bad-Filesystem Data, usually the CPU has enough time to retry and resolve the error, however when CPU is busy the retry timer times out and you have a problem...


The solution is easy... don't rely on automatic error correction, but instead fix the broken filesystem yourself!


Instructions


1. Unmount your SD card.


2. OPTIONAL!! sudo opkg install dosfstools - this is only required if your SD-card runs on the FAT32 filesystem!


3. Open a shell and issue the following commands...


sudo su


fsck -a /dev/yoursdcarddevice


fsck -r /dev/yoursdcarddevice


4. Remount your SD card.


--- What this does is scan your File-System Nodes, find broken Nodes and fix them. As the broken nodes are the cause of this problem and the trigger to requiring a fallback retry, this will solve your Read-Only Remount Problems.


--- Now you might wonder what exactly causes the Nodes to become corrupted, well - usually this happens when SD cards are removed without properly unmounting them first.
 
Fsck can also be used at whatever your mountpoint is, not just the /dev device. Useful if you don't know what the device is by /dev name (what is it called again? The 'files' residing in /dev, I mean). So instead of /dev/youcardandpartition, you can do /media/sdcard1. It's best to label your cards if you do this, though: the mountpoints change based on the order they're inserted if they're not labeled.
 
Fsck can also be used at whatever your mountpoint is, not just the /dev device. Useful if you don't know what the device is by /dev name (what is it called again? The 'files' residing in /dev, I mean). So instead of /dev/youcardandpartition, you can do /media/sdcard1. It's best to label your cards if you do this, though: the mountpoints change based on the order they're inserted if they're not labeled.
This will only work for read-only operations, operations like this which modify the file-nodes requires the filesystem to be offline and unmounted.
 
I was able to fsck my sd card that way, though I'll bet that mine was just plain not mounting at the time. Wrong timestamp or something.
 
I was able to fsck my sd card that way, though I'll bet that mine was just plain not mounting at the time. Wrong timestamp or something.
Might be that it grabbed the Devicepath from the fstab config while it was unmounted. :)
 
Umm...I was recently copying over tons of files to set up a bootable SD and had a fs error...this card is read only now....I will give this a try. I can't think of what else I was doing at the time of the copy, must have been something though. Is this problem something that a [kernel] fix/patch could resolve to ensure that the file copy process gets enough juice?


Thanks Coldbird.
 
Providing enough CPU power to avoid the errors on the fly IS the workaround... the real way to fix this would be fixing the Filesystem errors themselves, cause its the faulty SD card filesystem thats the cause of the problem...


The real way to fix this would be to have a "on-mount" event handler / script to auto-check and fix the filesystem using the commands I provided above.


This way every time the filesystem is about to get mounted it would trigger a auto-filesystem fix and thus ensure the filesystem is error-free.


PS. no problem, trying to be a contributing part of the Pandora community. :D
 
Last edited by a moderator:
thanks for the tutorial. i had to do "chmod 777 *" on the SD card afterward to get read and write access back on top of fixing the read-only file system. Also dosfstools was already install for me. (using FW 5)
 
Back
Top