3

I've seen a few apps online, but they don't seem legitimate. From what I've seen, they don't seem to show what's going on while the drive is being defragmented. So I decided I wanna stay away from defragmenters in the Google Play store.

What would be an efficient way to defrag my both my phone's SD card and internal storage?

Dioxin
  • 205
  • 3
  • 7

2 Answers2

11

There's no reason to defragment flash media. It serves no purpose, because access to any flash cell is going to take the same amount of time as access to any other flash cell. The reason defragmenting is beneficial to mechanical hard drives is because it makes related data blocks contiguous, so that they can all be read in order as the disk is spinning and minimizing the amount of movement needed from the drive heads. Flash media has none of these moving parts, and therefore does not suffer from the same problems as mechanical drives.

In fact, defragmenting flash media could potentially be detrimental, because it will wear the memory faster while not providing any benefit. Flash memory firmwares will actually fragment data intentionally, in a practice known as wear-leveling, which helps to prevent specific cells from being overused and wearing out more than others.

Flash-based devices generally benefit from TRIMing, but Android 4.3 or higher will do this for you automatically. Apps that claim to perform defragmentation are suspicious at best. Even if they "work", there is no reason to use them.

eldarerathis
  • 36,787
  • 16
  • 144
  • 175
  • And given the amount of malicious adware apps in the Play Store these days, you should be wary of installing anything, much more these "performance apps". – Mindwin Remember Monica Sep 18 '15 at 14:01
  • 1
    I do not agree. The answer is a bit oversimplistic. In reality, since the flash memory is not connected directly to the memory bus, it is accessed via physical drive protocols. Each time you switch to a new fragment there are seeks involved. The seek time, as low as it is on flash drives, still takes way longer than a sequential read. Remember you are not accessing the memory directly, but through a controller. There is no reason to intentionally fragment everything. Only changing data. Most app's executables don't get modified on a daily basis. So defragmenting the OS after lots of apps updat –  Sep 18 '15 at 10:52
  • (continuing Elibs comment) ...update could be beneficial. Also, increased fragment size can cause increase in memory use to cache all the disk seek data, thus slowing CPU performance. – aleksikallio Sep 19 '15 at 07:50
  • So how do you manually TRIM a flash device if you are on an older version of Android? My device has been getting slower and slower and it has been suggested to me that this could help. – Michael Nov 13 '15 at 18:31
  • @Michael I think there are a few apps out there that will try to do it for you, but they probably require root. I'm also not sure if older version of Android have the necessary binaries. Here's one you could take a look at, though: http://forum.xda-developers.com/showthread.php?t=2104326 – eldarerathis Nov 13 '15 at 21:02
  • @eldarerathis Thanks, I tried the LagFix app, but unfortunately it said the flash on my device doesn't support trimming, so I guess I am out of luck. – Michael Nov 16 '15 at 05:34
  • @Elib If you feel you could provide a better answer, I'd be more than happy to accept it if the current accepted answer does not edit in correct info! :) – Dioxin Dec 22 '15 at 10:42
  • @VinceEmigh Based on the premise that Elib's information is correct. I would certainly like to see some sources for his contentions, as I've provided several that disagree. I've yet to see any reliable source suggest that defragmenting flash media is useful (not just "not harmful") so I'm entirely skeptical of that comment. – eldarerathis Dec 22 '15 at 14:57
  • @VinceEmigh All that to say: I have no intention of editing this to add the information in Elib's comment because I have no reason to believe it's at all accurate. – eldarerathis Dec 22 '15 at 14:58
  • @eldarerathis I didn't fully read through the details at the time I commented - was simply fishing for more info to come back to. After looking into it (correct me if I'm wrong) there is no seek latency for flash drives, so I'm actually not sure what Elib is referring to (would be nice to know). I now understand that flash memory degrades as more writes are performed, thus moving things around actually harms the longevity of the drive. Sorry for the misunderstanding! – Dioxin Dec 22 '15 at 15:11
  • @VinceEmigh Defragmenting is beneficial to the file system regardless of the access time for each block/cluster/fragment. The more fragments, the more metadata is required to represent a file, increasing parse/load time. On devices with particularly frequent cycling of space utilization (photos taken, synced, deleted when low on space), the degree of logical fragmentation will tend to be higher. Here is a quick example of flash storage benefiting from defrag, to the point that a major OS automates it: https://www.hanselman.com/blog/TheRealAndCompleteStoryDoesWindowsDefragmentYourSSD.aspx – Christopher McGowan Sep 27 '19 at 07:43
1

Defragmenting storage IC memory is not recommended for it may actually break the IC... Just like how SSDs are, you simply do not defragment Storage IC or it may break... also as far as I know Unix systems don't need to defrag since the files are already arranged in such a way that it is faster to access them

a better explanation here: http://geekblog.oneandoneis2.org/index.php/2006/08/17/why_doesn_t_linux_need_defragmenting