I have a Samsung Galaxy S and it has worked smoothly for the last couple of years. A couple of days ago, the battery charge died and when I turned it on, it had done a factory reset. Now every time I turn off the phone and then turn it back on, it always resets itself, How do I stop this and what could be the cause?
The Flash memory in the device may have died. This would cause any data on the chip (the /data chip) to not be picked up by the system, so it assumes that it is coming fresh out of a box.
This means that the chip(s) in the device may have used all of their write cycles. This is the reason SSDs aren't used for their reliability.
All flash chips (thumbdrives, SSDs, anything with a size of two to the power of X (2,4,8,16...) that isn't RAM...) have a limited number of possible write-erase cycles.
In most cases, this is unfixable other than replacing the chip. And in your case (if this is indeed your problem) this essentially is terminal.
Limiting writes to the chip (don't update apps, install-remove apps etc...) is the only way to slow this process.
... for the last couple of years...
In your situation this can be caused by general usage, esp, over this time period. My eeePC's SSD didn't last a year.
Although, this could be something completely different, I'm just going by inferences as I couldn't see anything on Google.