SD gets corrupted after a few days

Post Reply
bomberb17
Posts: 24
Joined: Fri Jun 13, 2014 4:42 am
languages_spoken: english
Has thanked: 0
Been thanked: 0
Contact:

SD gets corrupted after a few days

Post by bomberb17 »

Hello, I have the U3 and a 8GB SD running Xubuntu 13. Everything goes well, but after a few days the file system slowly gets corrupted, and I'm forced to rewrite the image again.
I've tried the following so far:
1) Disabling journal to minimize disk access
2) Trying another SD card brand
But problem persists. Anyone found a solution?

mdrjr
Site Admin
Posts: 11963
Joined: Fri Feb 22, 2013 11:34 pm
languages_spoken: english, portuguese
ODROIDs: -
Location: Brazil
Has thanked: 5 times
Been thanked: 110 times
Contact:

Re: SD gets corrupted after a few days

Post by mdrjr »

Can you define "slowly gets corrupted?" I never saw this before.

venkatbo
Posts: 543
Joined: Mon Feb 25, 2013 3:10 pm
languages_spoken: english
ODROIDs: C0/C1+/C2; U3+; XU3-Lite/XU4; H2; VU/VU7+; Touchscreen Show TFT Cloudshell SmartPower mAHRS DAC GPS Multiscope Ocam
Location: Bay Area, California
Has thanked: 4 times
Been thanked: 5 times
Contact:

Re: SD gets corrupted after a few days

Post by venkatbo »

May be worthwhile to list:
  • exact image (used) name,
  • complete specs (make, model, class, claimed-speed, etc) on both SD cards (http://en.wikipedia.org/wiki/Secure_Digital),
  • snippets of syslogs, possibly indicating read/write errors
  • whether all free un-allocated space on SD was freed-up for use, etc.
Someone who may have used a similar setup can then shed light...

McWizard
Posts: 3
Joined: Tue Apr 29, 2014 10:03 pm
languages_spoken: english
Has thanked: 0
Been thanked: 0
Contact:

Re: SD gets corrupted after a few days

Post by McWizard »

I do have the same problem. After a few days you get an error that the filesystem is read only (likely because the os detected some problems and tried to save what it can). When you try to reboot afterwards, it fails and you have to flash the sd again.

In my case the system is always running 24/7 and uses like 30% CPU time constantly. It also does a lot of usb transferring (file server). I've tried two different sd cards yet but I'll continue trying to change the sd card. The recent card was a Medion 32GB Class 10 card.
The image I used was the official 14.04 ubuntu one with only a few programs installed and no mayor changes. The SD Card had no further content so it was like 80% empty and all the traffic (besides logs etc..) was on usb.

Maybe it helps...

User avatar
Digimaster
Posts: 261
Joined: Tue Feb 26, 2013 4:16 pm
languages_spoken: english, russian
ODROIDs: U2, X2, U3, C1, C2, XU4(500+), N2PLUS
Location: Moscow, Russia
Has thanked: 6 times
Been thanked: 4 times
Contact:

Re: SD gets corrupted after a few days

Post by Digimaster »

This is a common problem with flash memory... This is why normal hd still preferable for file servers.
Once I bought 20 sd cards of a very respectable supplier (the exact model can say personally) and 1-2 fails after a very short work, and a couple more after a few weeks.
It's about 20% fail rate. I suppose with noname flash it can be even more. Every supplier tries to get "faster and bigger" flash but nobody make more reliable. Damn!

dronus
Posts: 87
Joined: Fri Jul 25, 2014 7:24 pm
languages_spoken: english
ODROIDs: U3, XU4, C1+
Has thanked: 0
Been thanked: 0
Contact:

Re: SD gets corrupted after a few days

Post by dronus »

This is sad, but not unusually. The SD cards are meant for media data storage and such, which usually means writing large files, accessing them and then delete large bunches of them.

Usng them as linux root partition means a totally different usage: Many small files are changed all the time: configurations, logfiles and so on.

All flash memories require a quite elaborate controller as every change to the flash means the rewriting of a large amount of memory, even if only small portions are changed. Also, the flash memory wears off and so has to be uniformly used across the disk to not fail in a single overused location.

This is managed by the flash memory controllers, and those are quite complex to ensure reliable operation of flash memory as an every-day disk in SSD's for example. For the miniturized SD cards, much simpler controllers are used, so they just don't perform very well with high amounts of write access.

That said, a SD card that will service a digital camera for years may be fragmented or worn out after days, if usual root partition operations happen on them.

How to make things better?
-Mount all file systems on the disk using the 'noatime' option. Most distributions for odroid does this already. That prevents the file system from storing the time of last access to every file, what would create a large amount of writing to the disk, even if we just want to read it!
-Use a read-only system disk. With an files system overlay, like overlayfs, it is possible to mount the SD card read only, and let all modifications happen in RAM. If another normal partition is added, things like /home can be placed on it with standard read/write capabilities, and will provide normal user experience for the personal user data. For administration, the system can be rebooted read/write enabled at any time to change configs or install updates, after that it runs readonly again. Such setups are extreme stable, and will survive a lot of user mistakes and power failures etc. A manual for creating such a setup can be found here: https://help.ubuntu.com/community/aufsR ... OnUsbFlash including a script at the bottom using overlayfs.

omnicogitosum
Posts: 2
Joined: Wed Jul 30, 2014 6:07 pm
languages_spoken: english, spanish
ODROIDs: x17 U2 x1 U3
Has thanked: 0
Been thanked: 0
Contact:

Re: SD gets corrupted after a few days

Post by omnicogitosum »

I had the same problem and it was the DISK SPACE!!
I thought the problem comes from the corruption of the system but NO.
What really happens is that the loggs consume the disk space and when you have 0 bytes the GUI cant load.

Excuse my english

Bye!

JungleDroid
Posts: 20
Joined: Thu Jan 13, 2022 6:35 pm
languages_spoken: english
Has thanked: 3 times
Been thanked: 1 time
Contact:

Re: SD gets corrupted after a few days

Post by JungleDroid »

In reply to original poster: " I'm forced to rewrite the image again"

I think you can repair the SD card in another computer. On linux with:
sudo fsck /dev/mmcblk0p1
sudo fsck /dev/mmcblk0p2

where /dev/mmcblk0p1 is the name of the drive partition (which you can find with the command 'sudo lsblk'

I also experience regular SD card corruption - with various SD card brands. I do shutdown the system nightly.
I notice the filesystems are already mounted with the 'relatime' in /etc/fstab (which is similar to 'noatime' option suggested by Dronus.
Any further suggestions/tweaks things to try to prevent corruption of SD card would be welcome.

Post Reply

Return to “Issues”

Who is online

Users browsing this forum: No registered users and 1 guest