[APP] LagFix (fstrim) v1.5.1 2013.03.04

Did LagFix work on your Android 2.x device?


  • Total voters
    118
  • Poll closed .
Search This thread

AuxLV

Senior Member
Apr 30, 2009
435
729
36
Riga
THIS APP REQUIRES ROOT!

READ FAQ! Read that FAQ BEFORE you try app!

Premium version is now ON SALE! -50% off of the price! Enjoy!

Some Android users suffer from poor performance after some days/weeks of heavy usage. This is due to a well-known TRIM bug affecting these devices (there are reports that some Galaxy Nexus devices also have affected memory chips). Users with -discard mount option are NOT affected!

The source of the problem is that internal storage is not properly TRIMmed when needed. You can find lots of information on XDA - http://forum.xda-developers.com/showthread.php?t=1971852 and http://forum.xda-developers.com/showthread.php?t=1929021 for example. It is also well-known fact that running fstrim Linux tool from time to time fixes the issue until internal memory runs out of free blocks. Other solutions like mounting with -discard or disabling fsync may be slow or dangerous.

LagFix is a user-friendly implementation of fstrim utility. It allows you to select which partitions to trim (you should leave defaults unless you know what you are doing) and run the process easily.

Please note that fstrim output depends on kernel and device. It works fine unless you see errors. You might see big amounts of bytes, zero amount or repeating amount. All are fine! Read fstrim manual to understand why all these outputs are valid.

It is also advised to reboot your device after the TRIM process so that kernel could reinitialize block data.

There are two versions of LagFix:
  1. Premium version (v1.5.1) - no ads + ability to auto-run trimming on specified schedule. The best choise!
  2. Free version (v1.5.1) - trims your memory with one click, has ads, no schedule.

Warning! Premium version comes from different publisher! This is because Google does not allow to publish paid apps from my country. Send your rage to Google :) Both versions are legit, don't worry.

Release notes:

v1.5.1
+ Added CWM SuperUser support;
+ Added android.permission.ACCESS_SUPERUSER permission;
* Fixed disabling scheduler;
+ New notification icons.

v1.5
Full rewrite, dropped RootTools lib, made my own. No more problems!

v1.4
+ Device compatability detection is now completely reworked
* Fixed a crash

Earlier changelogs:

v1.3
+ New UI
+ Added Info screen
+ Added device compatability detection (looks like it should be improved further)
+ Renamed Donate version to Premium
* Fixed scheduling dissappear after reboot (Premium version)
* Some other bug fixes

v1.2 premium
* Added auto-trim functionality which runs on specified schedule. Click Schedule button and you'll see the options. Setup the way you want and click Install. The button will change to Uninstall to remove auto-trim if needed.
* Added detection if your device supports TRIM - run it once and you will know.
* Fixed some bugs.

v1.1
* Fixed chmod not working on some custom Sense ROMs.
* Added Android 2.2+ support.
* Fixed crashes.
* App is now multi-threaded.
* Updated UI a bit.
* New icon.
* App is renamed.


P.S. If your ROM mounts /data with -discard then this app is NOT needed!

P.P.S. Free version is now attached for those, who do not have market for some reasons.
 

Attachments

  • 01.jpg
    01.jpg
    37.3 KB · Views: 30,613
  • 03.jpg
    03.jpg
    19.1 KB · Views: 27,823
  • lagfix-1.5-free.apk
    757.3 KB · Views: 10,849
  • lagfix-1.5.1-free.apk
    757.2 KB · Views: 26,984
Last edited:

zombiefly

Senior Member
Jan 8, 2006
291
47
Excellent!

Thanks for this. only a day ago i pushed a load of music to my OneX and have been suffering ever since.

I'll give this a go and report back!

To be clear, should I now be able to fill the phone storage to almost capacity with this running? (not currently possible as it just slows down and heats up, draining the battery)

update: enabled the defaults and it said it was successful with some large numbers trimmed. rebooting now :)
 
Last edited:

AuxLV

Senior Member
Apr 30, 2009
435
729
36
Riga
To be clear, should I now be able to fill the phone storage to almost capacity with this running? (not currently possible as it just slows down and heats up, draining the battery)

You run this app every time your device becomes SLOW AS HELL. It does not work in background since it would impact performance. Previously I used backup/restore solution once a week to fix lags. So in my case I will now run this app once a week.
 

geoffcorey

Senior Member
Apr 24, 2010
2,157
484
Wow, just used this on my gnex, and all I can say is: thanks!

I was originally running with the discard Mount option, but it turns out it wasn't doing anything as your app trimmed a quite big number. (I have since removed said Mount option)

Also, I used to have issues with an app that set settings on boot not actually doing so, but after this app it works again. And my phone feels snappy again.

Thanks for this app.

Sent from my Galaxy Nexus using Tapatalk 2
 
  • Like
Reactions: chrone

AuxLV

Senior Member
Apr 30, 2009
435
729
36
Riga
Wow, just used this on my gnex, and all I can say is: thanks!

I was originally running with the discard Mount option, but it turns out it wasn't doing anything as your app trimmed a quite big number. (I have since removed said Mount option)

Also, I used to have issues with an app that set settings on boot not actually doing so, but after this app it works again. And my phone feels snappy again.

Thanks for this app.

Sent from my Galaxy Nexus using Tapatalk 2

I'm glad my app helped! May I ask to do me a favour and rate app in Play Store? That would be nice :)
 

zombiefly

Senior Member
Jan 8, 2006
291
47
You run this app every time your device becomes SLOW AS HELL. It does not work in background since it would impact performance. Previously I used backup/restore solution once a week to fix lags. So in my case I will now run this app once a week.

thanks. This is brilliant :D
the problems i talked of in my earlier post appear to have gone now after running Lagfix. My Phone is back to it's usual speed. :D :D

I was also using the emergency restore rom image method, glad I don't have to do that anymore, was a major pain.


I was looking into an app i use called settings profiles as I wanted to run lagfix after every usb dismount, unfortunately it doesn't support running applications, which is a shame. Is there any other way of hooking this in to run automatically after (un)mounting as a usb drive?
 

AuxLV

Senior Member
Apr 30, 2009
435
729
36
Riga
I was looking into an app i use called settings profiles as I wanted to run lagfix after every usb dismount, unfortunately it doesn't support running applications, which is a shame. Is there any other way of hooking this in to run automatically after (un)mounting as a usb drive?

LagFix trims /data partition, it has nothing to do with /sdcard which is mounted/unmounted. I will add scheduler in the future releases.
 
  • Like
Reactions: Ci-Fi

chrone

Senior Member
May 5, 2012
1,050
369
Surabaya
i'll give this a try on Nexus 4 since it's affected too by the slow down write performance if free space left less than 4GB. well done and thanks for keeping it free! :)
 
Last edited:

AlexNone

Member
Jul 26, 2010
9
2
Hey,

Work great on Nexus 10 AOKP ;)
But not work on HOX on Renovate rom with Trip Kernel. I think Sense kernel is the probleme or other.Root acces is OK

# fstrim -v /data
sh: <stdin>[32] : /data/data/com.grilledmonkey.lagfix/files/fstrim : can't execute : Permission denied

# fstrim -v / cache
sh: <stdin>[35] : /data/data/com.grilledmonkey.lagfix/files/fstrim : can't execute : Permission denied


Thanks for your work
 
Last edited:
  • Like
Reactions: chrone and AuxLV

chrone

Senior Member
May 5, 2012
1,050
369
Surabaya
I hope to hear your report if it will help in Nexus 4 case since I dont have one to test myself.

Just updated my post above. It works! I chose all /system, /data, and forgot the other partition.
Much appreciated dude!! :good::good:

Care to adding fstrim for Nexus devices to your app name? :p
 
Last edited:

AuxLV

Senior Member
Apr 30, 2009
435
729
36
Riga
Hey,

Work great on Nexus 10 AOKP ;)
But not work on HOX on Renovate rom with Trip Kernel. I think Sense kernel is the probleme or other.

# fstrim -v /data
sh: <stdin>[32] : /data/data/com.grilledmonkey.lagfix/files/fstrim : can't execute : Permission denied

# fstrim -v / cache
sh: <stdin>[35] : /data/data/com.grilledmonkey.lagfix/files/fstrim : can't execute : Permission denied

Thanks for your work

Thanks for report, looks like chmod was not executed successfully. I'll look into this issue and add a fix in next version.

You can try to fix it manually if you are familiar with Linux console:
Code:
# su
# chmod 777 /data/data/com.grilledmonkey.lagfix/files/fstrim
 

AlexNone

Member
Jul 26, 2010
9
2
Thanks for report, looks like chmod was not executed successfully. I'll look into this issue and add a fix in next version.

You can try to fix it manually if you are familiar with Linux console:
Code:
# su
# chmod 777 /data/data/com.grilledmonkey.lagfix/files/fstrim

Thanks !
I forgot the chmod :)
Fix manually with terminal emulator with chmod 777 and is OK.

Renovate Rom with Trip kernel 002 and Sense + are OK for fstrim :)
 
Last edited:

chrone

Senior Member
May 5, 2012
1,050
369
Surabaya
Nexus 4 16GB Storage Performance Over Time & TRIM

Before and after filling up the storage (coming from 5GB and filling it up to 1.2GB space available):
  • SW from 10 MBps to 4 MBps ~ 60% loss
  • RW from 1 MBps to 0.39 MBps ~ 61% loss

attachment.php


Did a reboot and the performance is getting better (1.2GB space available, deleted some files left with 2.2GB space available but the performance is more less the same):
  • SW from 4 MBps to 9.89 MBps ~ 147% gain
  • RW from 0.39 MBps to 0.51 MBps ~ 31% gain

Using the fstrim app (LagFix for Nexus 7 and HTC One X) and reboot (2.2GB space available):
  • SW from 9.89 MBps to 9.9 MBps ~ 0.1% gain
  • RW from 0.51 MBps to 1.07 MBps ~ 110% gain

attachment.php


:good::good:

i see a future request is in order, daily/weekly midnight crontab? :p
 
Last edited:

marzinho

Senior Member
Mar 17, 2010
184
18
Odp: [APP] LagFix for Nexus 7 & HTC One X

Looks like it works on OrDroid 12.5.1, which is Sense Rom, no errors...

Wysyłane z mojego HTC One X za pomocą Tapatalk 2
 

DeeZZ_NuuZZ

Senior Member
May 16, 2012
11,496
4,548
25
Hanover
tried it manually and then the app and now it worked :) i tried and in antutu the I/O is still at 896....and i get only 12828 points in antutu :/ ...hm i try it again with the trimming...
 

Top Liked Posts

  • There are no posts matching your filters.
  • 207
    THIS APP REQUIRES ROOT!

    READ FAQ! Read that FAQ BEFORE you try app!

    Premium version is now ON SALE! -50% off of the price! Enjoy!

    Some Android users suffer from poor performance after some days/weeks of heavy usage. This is due to a well-known TRIM bug affecting these devices (there are reports that some Galaxy Nexus devices also have affected memory chips). Users with -discard mount option are NOT affected!

    The source of the problem is that internal storage is not properly TRIMmed when needed. You can find lots of information on XDA - http://forum.xda-developers.com/showthread.php?t=1971852 and http://forum.xda-developers.com/showthread.php?t=1929021 for example. It is also well-known fact that running fstrim Linux tool from time to time fixes the issue until internal memory runs out of free blocks. Other solutions like mounting with -discard or disabling fsync may be slow or dangerous.

    LagFix is a user-friendly implementation of fstrim utility. It allows you to select which partitions to trim (you should leave defaults unless you know what you are doing) and run the process easily.

    Please note that fstrim output depends on kernel and device. It works fine unless you see errors. You might see big amounts of bytes, zero amount or repeating amount. All are fine! Read fstrim manual to understand why all these outputs are valid.

    It is also advised to reboot your device after the TRIM process so that kernel could reinitialize block data.

    There are two versions of LagFix:
    1. Premium version (v1.5.1) - no ads + ability to auto-run trimming on specified schedule. The best choise!
    2. Free version (v1.5.1) - trims your memory with one click, has ads, no schedule.

    Warning! Premium version comes from different publisher! This is because Google does not allow to publish paid apps from my country. Send your rage to Google :) Both versions are legit, don't worry.

    Release notes:

    v1.5.1
    + Added CWM SuperUser support;
    + Added android.permission.ACCESS_SUPERUSER permission;
    * Fixed disabling scheduler;
    + New notification icons.

    v1.5
    Full rewrite, dropped RootTools lib, made my own. No more problems!

    v1.4
    + Device compatability detection is now completely reworked
    * Fixed a crash

    Earlier changelogs:

    v1.3
    + New UI
    + Added Info screen
    + Added device compatability detection (looks like it should be improved further)
    + Renamed Donate version to Premium
    * Fixed scheduling dissappear after reboot (Premium version)
    * Some other bug fixes

    v1.2 premium
    * Added auto-trim functionality which runs on specified schedule. Click Schedule button and you'll see the options. Setup the way you want and click Install. The button will change to Uninstall to remove auto-trim if needed.
    * Added detection if your device supports TRIM - run it once and you will know.
    * Fixed some bugs.

    v1.1
    * Fixed chmod not working on some custom Sense ROMs.
    * Added Android 2.2+ support.
    * Fixed crashes.
    * App is now multi-threaded.
    * Updated UI a bit.
    * New icon.
    * App is renamed.


    P.S. If your ROM mounts /data with -discard then this app is NOT needed!

    P.P.S. Free version is now attached for those, who do not have market for some reasons.
    72
    FAQ

    WARNING!
    There are some devices affected by BrickBug. Samsung Galaxy S2 and Samsung Galaxy Note are known to have it. There are also reports that some Acer A210/A211 and LG O2x are affected too. There is a Got Brickbug? app to test your device, but it is only intended for Samsung users. BrickBug means DEATH of your device if you try LagFix! There are some unlucky guys already. In case of brickbug - use warranty and exchange your device. This is a hardware fault and manufacturer is responsible.

    I provide NO WARRANTIES for LagFix app! Use it on your own risk.

    LG O2x brickbug may be recovered following this great tutorial by fifi139.

    What does LagFix do?
    It calls fstrim utility, which calls ioctl operation called TRIM, TRIM does the magic.

    What is fstrim?
    fstrim is a Linux utility to call TRIM on your memory devices. You can find more information about it and source code at SourceForge. It is now a part of util-linux and can be found inside Linux kernel repository.

    What is ioctl?
    This is a programming interface to talk to storage devices directly in UNIX opearting systems. It is called DeviceIoControl in Windows. It allows to do a lot of low-level things on different storage devices like hard drives, CD-ROMs, flash memory and SSD drives.

    What is TRIM?
    TRIM is a low-level function, which informs memory controller of unused memory block. This is used on most of SSD drives and some eMMC memory. SD cards use different function - SD ERASE. Read more in Wikipedia.

    Why the lags?
    Devices with TRIM support must be trimmed to know which parts of memory is free and is available to write more data. When memory controller does not know which parts are free, it starts the search asking operating system to help it. This process will take time and the less free space available, the more time is required. And this operation blocks everything else. So everything you do starts to wait (lag) when some data needs to be written. For example, when you switch apps, the state of previously used app is saved to internal memory so you could get back to it when needed. Saving = lags. Simple!

    Which devices are affected?
    It is known by now, that Nexus S, Galaxy Nexus, Nexus 7, Nexus 4, Nexus 10 and HTC One X need regular trimming. It is also believed that all pre-ICS devices used different memory and they do NOT need it nor support it. Pre-ICS support will be dropped in version 1.2. Other 4.0+ devices? Well, test it! And report if it really helps - your device will be added to the list.

    How to properly test it?
    Use AndroBench app before using LagFix and after. You only need micro test. Look for Sequential Write values. Reading from memory is NOT affected, because reading does not involve writting and only writting triggers search party for free memory blocks.

    Why to reboot?
    Most of the users DO NOT need rebooting after trimming. But SOME RARE kernels do not re-initialize free block information after TRIM. It is impossible to detect such kernels, so if LagFix did something but IO related lags did not go away - reboot! Most of users DO NOT need rebooting!

    My device is in the affected list, but LagFix does nothing.
    Some kernels mount storage with -discard option. This option forces kernel to call TRIM operation after all write and delete operations. That means that functionality of this app is built-in, you don't need LagFix in such case.

    Why not every kernel comes with -discard?
    Discard slows down write operations a bit and delete operations a lot. Desktop Linux users NEVER use it, instead they put fstrim in cron to run once per day. Scheduled launching of LagFix is comming in version 1.2.

    LagFix is not available for my device in Play Market, why?
    It was reported by many users that your device does NOT support TRIM operation. You don't need this app, it will NOT do anything on your device.
    6
    Works with S4 (i9505) if anybody's wondering

    Trimmed /system, /data and /cache a few times over the past few days and haven't run into any problems

    Sent from my :tank:
    6
    hi..
    does this app fix the problem permanently?
    or this problem will be back? if the problem will be back, how long the problem will back since we use this app?

    one more question..
    is this perfomance issue hardware of software issue? thanks :)

    Memory should be trimmed regularly. It will be back as soon as you write some new files. It depends on how often you write new data to /data partition. I personally trim my phone once a week.

    The thing is that trimming is needed on all solid memory types, but different memory types uses different mechanisms for trimming. For example, SD cards use function called SD_ERASE and it is automatically called when needed by all known to me operating systems. Newer eMMC chips use TRIM function like in SSD drives. Desktop OSes call TRIM on a regular basis, like once per day or so. This includes desktop Linux. But Google devs forgot about it for some reason. So it can be called a software "bug" by Google/HW vendors.

    What I did? I took fstrim app from desktop Linux, cross-compiled it for Android and packed inside nice looking app :) I'm also preparing patches for CyanogenMod so that fstrim would be included for devices with such eMMC chips and run automatically like it does on desktop systems. But I need to spend some time understanding how Android and CM works and where to put it correctly. And how to submit patches and so on, so bear with me.
    6
    is there any update for fstrim coming out?

    Yes, bug fixes this weekend.

    Sent from my HTC One X using Tapatalk 2
Our Apps
Get our official app!
The best way to access XDA on your phone
Nav Gestures
Add swipe gestures to any Android
One Handed Mode
Eases uses one hand with your phone