Notes on SD card corruption
I've had a couple of SD cards get wonky and quit accepting or reading new books. I'm still narrowing down what, exactly, causes this to happen, but I can quite reliably make it happen by copying either too much data or too many books to the ereader in a single operation. Update 2025-05-15: New information has been brought to light old information has been dug up from a swamp of fifteen-year-old forum posts and also I've spent far too much time experimenting and being frustrated, see “SD card too big” at the very bottom, everything between this and “SD card too big” is just preserved here to show the process I went through figuring this out in case it's useful to someone in the future.
How do you know when it's happened?
Here are the indicators/symptoms of SD card corruption that I've noticed:
- Recently added books are displayed as filenames (often with numbers on the end), rather than book titles, when you know that their metadata was correct in Calibre;
- “Collections” menu goes missing or displays 0 Collections, when there were collections present before;
- “No book” shown under “Continue Reading” heading;
- “No bookmark” shown under the Bookmarks heading (assuming you had set bookmarks before);
- “Unable to communicate with device” errors in Calibre when plugging the ereader back into the computer;
- Books appearing with one or zero pages, or appearing normally but giving an error when you try to read them (although this particular one might not be indicative of SD card corruption but just one bad book).
How it happens (working theory)
After you're done adding books to the ereader and you've ejected and unplugged it from your machine, the ereader will sit and spin its arrow-circle for a minute or two. During this time, the ereader is having a good sniff around its filesystem, finding books that it doesn't yet know about, querying each new file to get its title and author and collection data to show in the menus, making some preliminary decisions about how each book should be displayed, and writing all this data to the following files: SD card/Sony Reader/database/cache.xml SD card/Sony Reader/database/cacheExt.xml If this process goes wrong while the ereader is writing to the cache.xml or cacheExt.xml files (or maybe if the process goes wrong while those files are open for writing) then the ereader will never send the “Okay I'm done writing here” bits to the filesystem, and one or both of these files will end up with a chunk missing off the end, which makes the whole file no good and can often cause further problems elsewhere on the SD card. Tragically, our reading positions are also stored in these files, so the ereader will forget which page we were on! We can reliably cause this SD card corruption by sending too many books in one go, sending a few enormous books in one go, or (added 2025-05-15) trying to use an SD card bigger than 4 gigabytes, sigh.
Too many books in one go
Through experimentation I've figured out that starting with an empty SD card and adding several hundred (small, like under a megabyte each) books at once can corrupt the SD card, and when that happens, cache.xml has always been just under 64kb in size. It's possible that the ereader can't write more than 64kb to its cache file at a time, and Sony just didn't figure that people would want to dump hundreds of books on in one massive chunk. My cache.xml file is about 800kb at time of writing so we know the file can get big if it needs to, it just can't get bigger by more than 64kb (theoretically) in a single operation.
Smaller number of books, but each book is too big
I've also corrupted an SD card by combining twelve volumes of manga into one whopping half-a-gigabyte file, because I thought I was being clever. Oops. The ereader has to open each file you send it, in order to figure out from its metadata what sort of file it is, and who's the author and what's the title; it probably ran out of memory and crashed while it had its cache.xml file open. The poor thing's only got 64mb of RAM after all.
SD card too big
Although the PRS-505 can “see” SD cards of up to 16 gigabytes, in practice once you go over 4gb of Stuff on the card, things get really screwy. This is because the reader doesn't mount SD cards the way you'd expect any standard Linux system to mount them (aye these are linux-powered!), but uses some weird thing that Sony came up with that takes all kinda shortcuts to save battery life. Since I figured this out (by repeated frustrated experimentation plus trawling long-dead forum threads) I've repartitioned my memory card to 3.9 gigs (leaving half of its space unpartitioned) to make sure that there's no way to go over 4 gigs.
(how would you even go over 4 gigs of books, Dan? Well, you can fit like a thousand books in one volume of manga and Attack on Titan is really good sooo…)
How to avoid it
If you're sending dozens and dozens of books, or a few enormous books (comics and manga are especially bad for this), break up the Big Send into several Little Sends. Send a few books, then eject, unplug, allow the ereader to spin its circle and do its sniffing etc, then once it's done, plug back in and send more. How many? I've found thirty or so regular book-sized-books (under a meg each) or four-five manga volumes (like 20 or 30ish megs) in one go doesn't cause any problems. I've sent ten mangas at a time and had it be fine but, eeeehhhhhh, I don't like to. Makes me nervous.
How to fix it if it does happen
You gotta format the SD card and start all over again, sorry.
“Well, I'll just run a disk scan, correct any errors it finds, erase the cache.xml file and let the ereader rebuild it, eh?” yeah no, I had the same idea. It'll fail the same way, or even earlier because you're asking it to scan even more books. You could try deleting some books from the SD card and then maybe doing that, but it's unlikely to end up less hassle than formatting the SD card and starting over. You'll lose your place in your books because your reading position is also stored in cache.xml, but fortunately you've still got all your books in Calibre!
How to recover more gracefully than that
Take a backup of your whole entire SD card every now and then, including the Sony Reader folder with its cache files! If your SD card gets corrupted, format it and then restore the backup. Then you'll only have to start from Some Time Ago, rather than All Over Again - and it's WAY faster to restore a SD card image than it is to send all those books again through that retro USB wire.
Update 2025-05-15: it's the SD card
Quick update on this issue: since repartitioning my 16 gig SD card down to 3.9 gigs, I've been able to send a thousand books or a hundred volumes of manga at once with no problems at all. Granted, if I do that then the ereader will spin its circle for like an hour lol.
Interestingly, I was able to send the same 3.8ish gigs of books that previously caused problems - it seems that on big SD cards, issues start to crop up as you approach four gigs, whereas an SD card with a single 3.9 gig partition can fairly reliably get filled until Calibre tells you there's no more room (leaving maybe half a meg for the cache file to expand).
The most books I've had on at once was around 1,100. Here's a guy who put over 4,000 on, followed by two forum pages of useful technical information (after six forum pages of people bitching at him about it).
Now go back to the start.
