helpme
Posts: 119
Joined: Thu May 16, 2013 2:20 am

Why smartphones' filesystem do not corrupt like RPi?

Sat Jul 13, 2013 4:08 am

When power is abruptly removed from Raspberry Pi, the filesystem on the SDcard of Raspberry Pi is corrupted. Why doesn't the same thing happens to Android smartphones? After all, they are all based on the Linux kernel and using the same filesystems.

User avatar
malakai
Posts: 1382
Joined: Sat Sep 15, 2012 10:35 am
Contact: Website

Re: Why smartphones' filesystem do not corrupt like RPi?

Sat Jul 13, 2013 4:45 am

Their file system isn't stored on an SD Card, are slimmed down, as well as locked down it gets more complicated than that but those are some of the basics. The Pi is operating much more like a PC than a smart phone.
http://www.raspians.com - always looking for content feel free to ask to have it posted. Or sign up and message me to become a contributor to the site. Raspians is not affiliated with the Raspberry Pi Foundation. (RPi's + You = Raspians)

OtherCrashOverride
Posts: 582
Joined: Sat Feb 02, 2013 3:25 am

Re: Why smartphones' filesystem do not corrupt like RPi?

Sat Jul 13, 2013 5:12 am

Smartphones rarely have their power cut. When you unplug them, they run on battery. When the batter runs down enough, the OS senses that and shutdowns properly. When starting from a dead batter, the battery must first reach a minimal charge level that would allow the OS to shutdown properly again.

ghans
Posts: 7871
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany

Re: Why smartphones' filesystem do not corrupt like RPi?

Sat Jul 13, 2013 7:32 am

Smartphones are shut down.
I would like to see somebody who always takes out the
battery to turn his device off , without using the
power button at all.

ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org

helpme
Posts: 119
Joined: Thu May 16, 2013 2:20 am

Re: Why smartphones' filesystem do not corrupt like RPi?

Sat Jul 13, 2013 8:43 am

ghans wrote:Smartphones are shut down.
I would like to see somebody who always takes out the
battery to turn his device off , without using the
power button at all.
ghans
Me too. Perhaps if someone simply removes the battery abruptly, filesystem corruption might happen on Android phones too. Perhaps it is because this is seldom done that no one complains about corruption as often as you encounter when you are using Raspberry Pi.

helpme
Posts: 119
Joined: Thu May 16, 2013 2:20 am

Re: Why smartphones' filesystem do not corrupt like RPi?

Sat Jul 13, 2013 8:47 am

malakai wrote:Their file system isn't stored on an SD Card, are slimmed down, as well as locked down it gets more complicated than that but those are some of the basics. The Pi is operating much more like a PC than a smart phone.
Even if they are not stored on SDcard, they are still stored on some form of non-volatile memory like flash. This is still vulnerable to filesystem corruption. The only real protection is only if the filesystem is mounted on RAM.

Heater
Posts: 13101
Joined: Tue Jul 17, 2012 3:02 pm

Re: Why smartphones' filesystem do not corrupt like RPi?

Sat Jul 13, 2013 1:02 pm

I have to reboot my Samsung Galaxy S phone all the time by yanking the battery. It lock up so hard it will not respond to the power switch.
This is an odd phenomena that depends on where I am. Normally no problem but at remote locations the 3G connection is very poor and the thing crashes many times per day.

Now. Every time I do that I risk corrupting my SD and I can see the system checking those file systems after a power cut.

I'm sure the Android OS itself is sitting on a more FLASH friendly files system than FAT or ext3. File systems like jffs are designed for use on raw FLASH chips and be a lot more tolerant of unclean shutdowns.

So far I have been having a terrible time with SD cards on the Pi. Even if I am careful about clean shutdowns it's not long before things get corrupted. Often I cannot even get dd on my PC to read back the same bytes I have written. Investigation with SD card tools on windows can show "card protected" and such weird stuff.

Mind you this is not limited to the Pi. I have other ARM boards that suffer this way.

helpme
Posts: 119
Joined: Thu May 16, 2013 2:20 am

Re: Why smartphones' filesystem do not corrupt like RPi?

Sat Jul 13, 2013 1:17 pm

Heater wrote:I have to reboot my Samsung Galaxy S phone all the time by yanking the battery. It lock up so hard it will not respond to the power switch.
This is an odd phenomena that depends on where I am. Normally no problem but at remote locations the 3G connection is very poor and the thing crashes many times per day.

Now. Every time I do that I risk corrupting my SD and I can see the system checking those file systems after a power cut.

I'm sure the Android OS itself is sitting on a more FLASH friendly files system than FAT or ext3. File systems like jffs are designed for use on raw FLASH chips and be a lot more tolerant of unclean shutdowns.

So far I have been having a terrible time with SD cards on the Pi. Even if I am careful about clean shutdowns it's not long before things get corrupted. Often I cannot even get dd on my PC to read back the same bytes I have written. Investigation with SD card tools on windows can show "card protected" and such weird stuff.

Mind you this is not limited to the Pi. I have other ARM boards that suffer this way.
This is a problem shared by all Linux-based systems. This is also why when people suggest building products around Pi, I said it is a bad idea because of this problem. It will cost a bomb if everyone goes back to repair centre every month.

User avatar
mrpi64
Posts: 931
Joined: Sat Feb 16, 2013 5:13 pm

Re: Why smartphones' filesystem do not corrupt like RPi?

Sat Jul 13, 2013 1:22 pm

A phone does not require permanent access to it's filesystems. The ones it uses all the time have backups (probably) so that if they are corrupted, an instant replacement can be avaliable (maybe). And because I like andriod (definetly not :lol: ).
I'm happy to help.
https://www.raspberrypi.org/forums/viewtopic.php?f=78&t=51794 - List of games that work on the Pi.

jawbonegroove
Posts: 37
Joined: Sun Jun 23, 2013 8:17 am
Location: pdx/usa
Contact: Website

Re: Why smartphones' filesystem do not corrupt like RPi?

Sat Jul 13, 2013 4:33 pm

I had a problem with my phone filesystem and corruption when I was running a 1% battery mod. If it shut down because of low power and I then tired to turn it back on (once or twice depending on my other configurations) it would corrupt my nand and I'd have to reflash my rom.

Heater
Posts: 13101
Joined: Tue Jul 17, 2012 3:02 pm

Re: Why smartphones' filesystem do not corrupt like RPi?

Sat Jul 13, 2013 4:43 pm

helpme,
This is a problem shared by all Linux-based systems.
No, it is not. There are many Linux based systems deployed at remote locations where a file system failure can not be tolerated.
They tend to use raw on board FLASH chips and a file system that is tolerant of power outages and unclean shut downs. Like JFFS2.

You might find our latest updates to a file get lost but the file system remains intact.

I have rolled out such systems with hundreds of units that have not failed in almost ten years.

Sadly such file systems are not really workable on SD cards.

User avatar
rpdom
Posts: 14994
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Why smartphones' filesystem do not corrupt like RPi?

Sat Jul 13, 2013 6:56 pm

helpme wrote:
malakai wrote:Their file system isn't stored on an SD Card, are slimmed down, as well as locked down it gets more complicated than that but those are some of the basics. The Pi is operating much more like a PC than a smart phone.
Even if they are not stored on SDcard, they are still stored on some form of non-volatile memory like flash. This is still vulnerable to filesystem corruption. The only real protection is only if the filesystem is mounted on RAM.
Yes, that would be totally safe because everytime you switch your phone off it the OS would be deleted. No chance of any corruption there! :lol:

User avatar
Jim Manley
Posts: 1600
Joined: Thu Feb 23, 2012 8:41 pm
Location: SillyCon Valley, California, and Powell, Wyoming, USA, plus The Universe
Contact: Website

Re: Why smartphones' filesystem do not corrupt like RPi?

Tue Jul 16, 2013 3:22 am

Commercial embedded systems typically have at least a minimal OS in ROM which is generally augmented or overridden by a full-function, more recent OS version stored in flash memory or on magnetic media. A "heartbeat" monitor running from ROM verifies that certain low-level tasks run as scheduled and if any fail within particular timeframes, the system is ordered to perform an orderly shutdown and restart. Some systems have two copies of the OS in flash or on disk beyond a minimal boot system in ROM - the current version of the OS and the previous version (TiVo uses this strategy). This ensures that if an update should fail due to any bugs not discovered during beta testing, the system can fall back to the previous OS version. Other systems have a minimal boot system in ROM and can ultimately be restored over a network.

We can configure a Pi to do similar things using one of the minimal Raspbian or other OS distros, the smallest of which are under 13 MBs. The only thing we can't do is boot from ROM, since booting has to occur from an SD card and the write-protect tab's status can't be read via the Pi's reduced-functionality SD card interface, making a true read-only system infeasible. The Pi is essentially a development board where a lot of unexpected changes are made in a short amount of time, which is not what usually happens in a commercial embedded system.
The best things in life aren't things ... but, a Pi comes pretty darned close! :D
"Education is not the filling of a pail, but the lighting of a fire." -- W.B. Yeats
In theory, theory & practice are the same - in practice, they aren't!!!

ski522
Posts: 394
Joined: Sun Sep 30, 2012 2:22 pm

Re: Why smartphones' filesystem do not corrupt like RPi?

Wed Jul 17, 2013 6:22 pm

Well...all I know is that my Android TV stick with no battery hasn't had a problem with corruption like the PI has during a power outage..it's an achilles heal for the PI IMHO as it's happen 3 times to me now and a major PITA since I have to restore everything when it happens!

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 23366
Joined: Sat Jul 30, 2011 7:41 pm

Re: Why smartphones' filesystem do not corrupt like RPi?

Wed Jul 17, 2013 8:05 pm

Just for fairness's sake, I've been using the Raspi for well over a year - never had a single SD card corruption.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

kghunt
Posts: 383
Joined: Sun Mar 04, 2012 9:28 am

Re: Why smartphones' filesystem do not corrupt like RPi?

Wed Jul 17, 2013 8:19 pm

Me either and I do hoik the power on it too fairly regularly. I almost never shut it down in fact.

User avatar
redhawk
Posts: 3465
Joined: Sun Mar 04, 2012 2:13 pm
Location: ::1

Re: Why smartphones' filesystem do not corrupt like RPi?

Thu Jul 18, 2013 10:52 am

Actually I have read about smartphones going bad due to filesystem corruption the INQ phones Mini and Chat 3G have been know to crash and rather amusingly lose all their applications. - http://getsatisfaction.com/inqmobile/to ... ons_update :lol:
I've also heard of Android phones going bad too this results in animation screen boot loops or stuck on the Android logo.
So yes smartphones can screw up the fact that they screw up less than an operating system stored exclusively on an SD-Card could have something to do with the way it handles data and the number of times it writes data to memory and how fault tolerant the file system is to data corruption.
If your SD card is getting corrupted (not bad SD card) then there is something wrong with your Pi perhaps you're overclocking it, the power supply is noisy or the card itself is unreliable.

I've been running Raspbian for well over a year now on the same SD card, it's also had it's fair share of updates / upgrades, installed apps and still ticking over quite nicely. :)

Richard S.

steev
Posts: 87
Joined: Fri Jan 27, 2012 5:08 pm

Re: Why smartphones' filesystem do not corrupt like RPi?

Thu Jul 18, 2013 11:14 am

It happens on Android, too.

The Android /system partition is usually mounted read-only and rarely ever written to, so maybe it is less likely to become corrupt, but I have had my userdata partition corrupted a few times after bad shutdowns with my MK808 TV stick.

Return to “General discussion”