Running TRIM from shell Is it possible to run fstrim in stock android 4.3 from adb shell?

I understand it runs every 24 hours when the device is plugged in and idle but I would like to run on demand to test a few theories.
WARNING: I have not tested this procedure.

You would need to have fstrim in system/bin. This XDA post has a DropBox download link.

start up adb and then switch users to root.

$ adb shell from your os terminal.

$ su to switch to the root user.

To copy fstrim to your /system/bin path you first need to mount the system path as Read/Write from adb or some other file manager

# mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system to mount /system as R/W

Then copy fstrim to the system path.

# cp &lt;pathtofstrim&gt;/fstrim /system/bin

Next you need to change permissions of fstrim to include execute.

# chmod 766 /system/bin/fstrim to make fstrim executable by root

After setting the correct permissions on fstrim you can run these commands from adb (as root):

# fstrim -v /data
# fstrim -v /cache
# fstrim -v /system  



OR, you could go the EASY WAY. Install the LagFix app, and trigger fstrim on demand, provided your device has fstrim support!