GekkePrutser
Posts: 36
Joined: Sat Mar 23, 2013 5:09 pm

SD Card losing changes after reboot.

Thu Jun 22, 2017 5:05 pm

Today I finally figured out why some weird things have been happening to one of my camera Pi's (unfortunately I'm nowhere near it).

Every time I reboot the thing, all changes since December 2016 are lost. It's super weird. I can write to a file, read it back and it works just fine. (Though possibly the file is read back from cache of course). Reboot the pi and it is magically back to December 2016??? New/changed files are gone.

I know it is possible to do this on purpose if you should want to, with a ramdisk and overlayfs. This is not what's happening here, I checked. /boot/cmdline.txt loads /dev/mmcblk0p2 (the right partition) and mounts it directly through /dev/root.

Has anyone ever seen this before? I'm wondering if the card is broken but when I search for it I mainly find stories about cards that are corrupted. Not doing something like this.

Just wondering if I'm missing anything. Perhaps the filesystem is mounted readonly? Doesn't seem to be the case though when I check with mount. It says rw.

I just don't get this... :shock: :? I didn't notice until now because it does its thing pretty well (taking photos and submitting them to a remote web server) and I rarely make changes. But I made one recently and then I noticed.

PS: Image was written with dd and then expanded, but that's pretty standard practice and I've done it on many other pis. It's a pi 2 with a microSD card (not sure which brand etc as I'm 1,5 hours by plane away :) )

DirkS
Posts: 9956
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: SD Card losing changes after reboot.

Thu Jun 22, 2017 5:25 pm


Canedje
Posts: 263
Joined: Thu Mar 26, 2015 7:18 am

Re: SD Card losing changes after reboot.

Thu Jun 22, 2017 5:26 pm

It lookes like your SD card is damaged and only functioning in read mode.

You need to bring in an other SD card

GekkePrutser
Posts: 36
Joined: Sat Mar 23, 2013 5:09 pm

Re: SD Card losing changes after reboot.

Thu Jun 22, 2017 6:50 pm

Aha thanks to you both!

I had no idea this was a possible failure mode. I've had several cards go bad on me before and I was left to pick out the important bits with a hex editor as the filesystem was mostly unreadable :) So I'm lucky with this way of failing. This pi has been working pretty well for 6 months like this.

Anyway thanks! Hope it lasts till August when I'm next on site.

And sorry for not noticing the other topic from today - I did look over the stickys but I didn't think someone else might have had the same problem today!

Canedje
Posts: 263
Joined: Thu Mar 26, 2015 7:18 am

Re: SD Card losing changes after reboot.

Fri Jun 23, 2017 7:04 am

I had the same problem some time ago.
I did have backups by Win32diskimager. So I thought to be save. Wrong thought.
The problem was that my new SD card was smaller then the original one and could not handle the backupimage. :oops: :roll:
The solution hereby is to use piclone (sd card backup) program at the desktop to clone your actual SD card to the new one.
You do need an USB to CD card interface to make this happen.

Return to “Troubleshooting”