Storage fragmentation in Android plays a major role in the ageing performance of the phone

Ever thought why your Android phone slows down with time? You are not alone. Many Android users complain about their Android phones “lagging” as their device ages. So what’s the cause of this performance degradation? Well, there is not just one thing to blame, but recent findings say that storage fragmentation may be one of the root causes for an Android phone to slow down.

Smartphones have become the go-to device for content, and Android continues to be the dominant operating system of choice with more than 87% of the total market share in 2018. Between playing games, watching videos, sending emails, taking pictures, and browsing through social media – the average user in 2017 spent 4-5 hours a day using their smartphone. As the amount of applications for mobiles expands, the time people spend using their devices continues to grow.

All of these HMIs (human machine interactions) between the person and the phone create data, and eventually fill up the storage space of the phone. Added to that, many of the popular apps, such as Facebook, run background services that preload content and analyze data even when you’re not using your phone. Thousands of such write operations happen every day. If this data is written inefficiently, the phone can be affected by a phenomenon called fragmentation, and may start feeling slower with time.

So how does fragmentation work?

Fragmentation can be driven by multiple factors starting from the kernel level, to the file system, to the FTL (flash translation layer) of the flash memory itself and it requires rigorous testing to identify the exact cause in the specific architecture (check out our guest article on Western Digital’s blog where we explain this in detail). But here is a simple analogy of what happens with your storage.

Fragmented storage is like visiting the worst library ever

Imagine you come to the library to get a couple of books. You need one very specific physics book, so you go to the physics section of the library. You find it, just to realize that most of the pages are not there. But at the back of the book you find a small paper, which tells you the rest of the pages are located in the departments of biology, modern literature, and history. Same goes for every other book you need. Going to this library becomes a real adventure quest, one that takes hours to complete.

The same scenario can happen with your Android’s storage if the file system and the storage device don’t work together as intended. Here’s one example of an Android phone that had its storage fragmented in one year:

But it’s not just the raw performance of reads and writes that can degrade. Latency is yet another parameter that can get worse with time and is probably the most easily noticeable stutter in the phone’s performance. Increased latency means that it takes more time for your Android phone to write and access files from the storage. In practice, your apps will take a longer time to load, and even the keyboard in a messenger app would take some time to appear. You might also see a longer time frame between pressing the photo capture button, and the picture actually getting stored on the device. In some cases that camera app might just crash, without saving the picture at all.

Things to do if your phone is getting slow

1. Make sure your storage isn’t full
Having a near-full storage is never good for your device. It leaves only a limited amount of memory cells to write on, which can increase the level of fragmentation and also reduce the lifetime of flash memory.  While lifetime is not such a big deal if you replace your phone every two years, it’s more of a concern for removable memory like an SD card, which people tend to use for many years in several devices.

2. Reduce the number of heavy apps to the minimum
Many of the popular applications like Facebook, Twitter, and Messenger run background activities, which create extra write operations for the storage. Such applications may also drain your battery as they use additional processing power, even when you’re not using the app. Make sure you don’t have any heavy apps on your device that you don’t actually use.

Here’s a list of heavy apps according to The Independent

3. Check which file system your phone uses
Ext4 and F2FS are the two most commonly used open source file systems used for Android devices. F2FS is designed to be more flash friendly and has a more modern architecture, but it is still quite experimental. At this point, we recommend that consumers use Ext4 as an open-source file system of choice for better long-term performance.

Check out our file system discussion with XDA-Developers to learn more about this topic.

4. If all else fails, factory reset the device
If your device becomes unbearably slow, there is still hope. You can wipe the whole storage of the phone, thus completely defragmenting the device. The caveat is that you’d need to back up all the valuable stuff from your device, and you’d need to reconfigure your phone from scratch.

Solving the issue of fragmentation in the long-run

Fragmentation is a result of many aspects as there are both hardware and software elements in the storage architecture. Flash memory – the storage hardware technology used by Android devices – has had phenomenal performance improvements in the last ten years. At the same time, the software stack that maintains all of the input/output operations between the OS and the hardware hasn’t changed that much. If the issue of fragmentation is to be solved, phone OEMs need to expand their focus on this concern, and more importantly need to conduct rigorous tests to ensure stable performance of the case-specific hardware-software architecture.

Are you a Tier-1 or OEM having storage fragmentation issues with your devices?

Let’s talk