yashsingh1/xdaforums huggingface dataset:
[Galaxy S II Android Development] fireburner-de:
Thanks.

To clear things up for everyone:

I checked logcat and saw it trimming automatically forelast night (but not last). Also I do not have busybox installed, nor do I have any trimmer app.

Friom second link I got th4ese commands for manually invoking trim command, which also worked for me acording to logcat:

su
vdc fstrim dotrim

I will continue checking my logcat, to further approve this.

edit: the following partions were trimmed:

/cache

/preload

/data

none -> did not work

/system is mounted ro, thats why it won't get trimmed

I just wonder why my internal sd (ext4) did not get trimmed.
[Galaxy S II Android Development] daniu:
Hi,

not bad ... actually: great! Thanks for that. However ... on my device this command takes less than 1 second. I am not sure if this one really trims ... trimmer takes longer.

Plus - it does not give any feedback ... (besides that it claims to have trimmed something)

regards
[Galaxy S II Android Development] fireburner-de:
Well, check your logcat: either use adb to check logcat or in terminal type: logcat > /storage/yoursdnumber/logcat.txt and search this one for trim.

Then you will see if trim command has worked.

The more often you trim, the less time it needs for trimming. E.g. /data (4GB) needed 54s (according to logcat) when I used that trim command today.
[Galaxy S II Android Development] franticfreddy:
If i remember right, the internal sd-card is fused filesystem

according to /data. So when /data is trimmed, the internal sd-card

is also trimmed then.
[Galaxy S II Android Development] daniu:
Hi,

well - the logfile says that it was trimmed and I can even see more details here but nevertheless the whole process is rather fast ...

54sec? I never saw that ... the trimmer app takes a couple of seconds - maybe 2-3 - this one takes a couple of msec ...

regards
[Galaxy S II Android Development] Lanchon:
the command doesn't trim, it just sends a trigger to vold. maybe vdc should return immediately

FYI, different eMMC models in the i9100 take vastly different times to trim.

yes, it is fused. no, it isn't trimmed.
[Galaxy S II Android Development] fireburner-de:
Well that was not even my intention, to say it always should need that and that long ;)

It was just to point out, that trimming on an regularly trimmed partition can be very fast.
[Galaxy S II Android Development] iistoryahi:
I flash successfully this kernel-Lanchon-TRIM-IsoRec-20160207-cm-13.0-i9100.zip on my S2 , how to activate the trim ? Sorry for this noob question I'm noob for this trim thread :)
[Galaxy S II Android Development] ssanjy:
Please read this
[Galaxy S II Android Development] Lanchon:
use the Trimmer app or read the OP
[Galaxy S II Android Development] iistoryahi:
# on the phone in the terminal app:su -c "fstrim -v /system; fstrim -v /data; fstrim -v /cache; fstrim -v /preload"

can i use these steps using terminal emulator ??

Thanks for your hardwork and contribute Lanchon

And if i successfully trim my phone , is it everytime to flash another room needs to trim again ??
[Galaxy S II Android Development] Skyline:
Yes you can use that command.

That is not necessary but it will be better if you do as Lanchon said that somewhere. I don't remember actually :rolleyes:
[Galaxy S II Android Development] iistoryahi:
thanks for your quick response , I try it when i got home , I'll feedback later
[Galaxy S II Android Development] iistoryahi:
i already do and trim my phone using terminal emulator , and I'm sorry i don't know if it is success or failed , how to know if the phone is already trim , sorry for this noob question again
[Galaxy S II Android Development] franticfreddy:
When it looks like in my attached picture then its trimmed.

Best regards.
[Galaxy S II Android Development] Lanchon:
again, read!! or if you dont want to read then use the Trimmer app. all your questions are answered in this thread.
[Galaxy S II Android Development] Giobio:
From post #1:

........................Adjusting partition sizes

you can repartition your phone

to better distribute available flash space. i recommend vestigial /preload (unless you want to go back to stock roms later), 1 GB /system (the original 0.5 GB /system is too small for android 4.4 and gapps; 0.75 GB is enough, but the Nexus 5 comes with 1 GB, so i guess google expects it to keep growing.

From post #2:

.............................Requirements:

you have not repartitioned

your device

and

shrank the /preload partition to enlarge other partitions.

Can I use this kernel within a system partition of 1,5 GB? (Hoping this is not a spam question)
[Galaxy S II Android Development] iistoryahi:
I'm sorry , but when i type on terminal emulatot ,

su

# fstrim -v /data

sh: fstrim: not found

but when i trim on trimmer app , it says trim completed

I'm just curious sorry
[Galaxy S II Android Development] Skyline:
Which rom you are using??
[Galaxy S II Android Development] iistoryahi:
I'm running CM13 20160502 build
[Galaxy S II Android Development] fireburner-de:
fstrim -v /xxx needs busybox; Busybox has been replaced by toybox on CM13.

Therefore either install busybox, use trimmer app or if you want to trim manually without installing busybox, use that command in root terminal

vdc fstrim dotrim
[Galaxy S II Android Development] iistoryahi:
i use this command

and it says command success

Edit: i install busybox and all the command works . Thanks
[Galaxy S II Android Development] Spyr0s:
You can also trim from TWRP recovery without having to install busybox.
[Galaxy S II Android Development] Lanchon:
of course you can. post #2 is not listing requirements for using this kernel.
[Galaxy S II Android Development] fireburner-de:
So TWRP has busybox included?

And good idea, I will manually trim /system and internalsd (if possible) next time I am on TWRP.
[Galaxy S II Android Development] Lanchon:
yes, TWRP includes a dynamically linked busybox binary.
[Galaxy S II Android Development] Naudiz:
Is trimming in TWRP just as safe as within regular OS? I was always too afraid to use it, as I wasn't sure if all the kernel-tweaks are active in recovery too.
[Galaxy S II Android Development] Lanchon:
an understandable concern. but you have to know that in the exynos 4210 platform (i9100, n7000, etc) you can only have ONE kernel installed. this was true before isorec and remains true now. an isorec recovery is just the recovery, it does not feature a kernel (contrary to recoveries in other platforms which typically do).

so...

-if you dont have a trim kernel, you wont be able to trim in android nor in recovery.

-if you do have a trim kernel, trimming from android or recovery is equally safe and effective.
[Galaxy S II Android Development] fireburner-de:
Just out of curiosity and because this crucial, question hasn't been asked so far:

If I sum up all I know about flash memory (well even for magnetic memory this will count, though it will have way higher higher read-write durability), I would summarize:

Someone flashing every nightly, will have an emmc that will die earlier than someone who flashes nighties let's say monthly.

And am I right that flash memory partitions aren't lined up like magnetic memory partitions, meaning that on a physical drive partion1 has sectors from 1-x and partitionx has sectors from x+1-y?

This means that data sectors on /system (which might be written very often) aren't the same physical sectors after some time, to prevent alternation/fail of this sectors?

So my final question is: Is my emmc altered by flashing nighties on a daily base?

I choose this thread, as this seems to be a better thread talking about memory specific topics.
[Galaxy S II Android Development] franticfreddy:
Of course it is altered. Every flash memory chip have its write-cycles

and limited lifetime. No device will live forever.

So its probably better to not flash much often.

There is some potential risk for get a corrupted emmc chip.

Especially at 5 years or older devices.
[Galaxy S II Android Development] fireburner-de:
Thanks [MENTION=4141005]Lanchon[/MENTION] for that wonderful explanation! This was very enlightening to me.
[Galaxy S II Android Development] fireburner-de:
[MENTION=4141005]Lanchon[/MENTION], after thinking about, what you wrote:

Would it make sense to sometimes trim all the other partitions 1-8?

So by doing fstrim -v /dev/block/mmcblk0p1 ... or even by doing fstrim -v /dev/block/mmcblk0p0 (for all partitions)?

Or would that be to dangerous?
[Galaxy S II Android Development] kosmasgr:
Hello guys :)

Can I flash this kernel on my S2 with sane (safe chip) running cm 12.1 official ?

Thank you
[Galaxy S II Android Development] kal4metal:
Of course you can ;)
[Galaxy S II Android Development] Lanchon:
fstrim can only be invoked on mounted partitions, and only on partitions mounted as certain file systems such as ext4.

also who cares about most partitions? only the large ones and the heavily written ones are important.
[Galaxy S II Android Development] winone1208:
delete
[Galaxy S II Android Development] DRKMTTR:
Without reading first post - impossible
[Galaxy S II Android Development] Lanchon:
UPDATE: new CM 13.0 kernels are up !!!

F2FS support included.

enjoy!
[Galaxy S II Android Development] good8life:
Thank you! I will try.
[Galaxy S II Android Development] makix13:
Now it's time to move to CM 13, thanks Lanchon, Lysergic and rest of developers [emoji122] [emoji122]

S2 Cyanogenmod 5.1.1 [official nightly] - Lanchon's kernel isorec - arnab isorec twrp - Xposed [official framework] - Viper4Android
[Galaxy S II Android Development] kosmasgr:
Download links not working :(
[Galaxy S II Android Development] good8life:
This is normal TRIM, I have data and cache with f2fs ?

Kernel 28.02
[Galaxy S II Android Development] :
Works for me

From OP:
[Galaxy S II Android Development] SAMDestroy:
i have the same. it seems only system gets trimmed?
[Galaxy S II Android Development] fireburner-de:
[MENTION=6770733]SAMDestroy[/MENTION] [MENTION=6619837]good8life[/MENTION] It seems that trimmer app doesn't support f2fs, yet.
[Galaxy S II Android Development] SAMDestroy:
[MENTION=7183558]fireburner-de[/MENTION]

this sounds plausible :)

so in terminal and adb i get fstrim not found and this means i have to install busybox to use the manual fstrim commands?
[Galaxy S II Android Development] good8life:
Ok thank you
[Galaxy S II Android Development] fireburner-de:
This one initiates trimming, without the need of installing busybox:

su
vdc fstrim dotrim
[Galaxy S II Android Development] SAMDestroy:
su

vdc fstrim dotrim

Command succeeded and the phone got rebooted by itself

/cache /efs /preload /data should be trimmed now?

still no output for:

su

logcat -d | grep "Trimmed"
[Galaxy S II Android Development] fireburner-de:
[MENTION=6770733]SAMDestroy[/MENTION] I never had a reboot after that command, that's odd.

And as I mentioned on CM13 thread, logcat command doesn't show things, that happened before a reboot.

Maybe [MENTION=4141005]Lanchon[/MENTION] can tell us, if trimming an f2fs partition is supported at all.

edit: Have you tried logcat -d, instead?
[Galaxy S II Android Development] Yakap:
it's working on AICP ROM? Thanks
[Galaxy S II Android Development] fireburner-de:
Don't know what AICP is, but there are only TRIM Kernels for CM11-13 in this thread.
[Galaxy S II Android Development] SAMDestroy:
logcat -d brings alot of output

logcat -d | grep "Trimmed" is showing nothing

vdc fstrim dotrim always tells succeded and next step the phone gets rebooted
[Galaxy S II Android Development] kosmasgr:
Excellent work
[Galaxy S II Android Development] stylemessiah:
Any other changes [MENTION=4141005]Lanchon[/MENTION] , other than the f2fs addition?
[Galaxy S II Android Development] good8life:
I use this code , I have complete, reboot.

Which trim : data, cache, system?

How many times need this code to terminal?

Thank you
[Galaxy S II Android Development] SAMDestroy:
your phone got rebooted by itself?

from what i read this command will trim:

/cache /efs /preload /data
[Galaxy S II Android Development] good8life:
No I take reboot after from terminal
[Galaxy S II Android Development] rogers11:
Same here. But it's not the Trimmer app's fault cause on my N5 it trims the f2fs partitions too.
[Galaxy S II Android Development] good8life:
An tu tu after trim and f2fs watch screenshot :good:

Before 15200

Thank you for all Recognized Developer
[Galaxy S II Android Development] Lanchon:
don't know about 'normal', but certainly bad news: fstrim is not working on F2FS.

https://sourceforge.net/p/linux-f2fs/mailman/message/32515474/

just found out. don't know if this has been fixed in a newer release of F2FS that could be merged by LA.

you can google, whoever finds out first wins some candy :)

yes it does. fstrim is FS-agnostic: the file system implementation itself is the problem.

did phone "got rebooted by itself" or did you reboot manually? you seem to contradict yourself.
[Galaxy S II Android Development] SAMDestroy:
i my situation the phone reboots itself for using:

su

vdc fstrim dotrim

it also reboot itself for using fstrim -v /preload (busybox installed)

so it seems the /preload operation gets the phone to reboot itself on the "vdc fstrim dotrim" command

i get not output for fstrim -v /data

i get "inappropriate ioctl for device" or "fstrim not a typewriter" for fstrim -v /cache

only /system (ext4) gets trimmed like expected

i tried to trim with busybox,toybox,isorec-twrp and trimmer

so im really clueless now :-/
[Galaxy S II Android Development] rogers11:
It must have been fixed somehow because trimming f2fs partitions on Nexus 5 with CM13 works.
[Galaxy S II Android Development] good8life:
My data and cache with f2fs , from terminal I have the same (fstrim not a typewriter)
[Galaxy S II Android Development] the.divergent:
Can anyone PM me or please give me the detailed instructions how to change all partitions (if it possible) and then do trimming of system, data and cache, becouse I ain't too that I understand the process how to do so?

Regards
[Galaxy S II Android Development] Lanchon:
wow, amazing!
[Galaxy S II Android Development] Lanchon:
ok... half a candy for you then :)
[Galaxy S II Android Development] Lanchon:
about F2FS...

my take is that f2fs is not ready for prime time on the i9100.

i recommend that you refrain from converting to f2fs until some issues are addressed.

for more info take a look the comment i posted here:

http://review.cyanogenmod.org/#/c/132900/5

btw, when it's time to convert, convert the /data partition only and nothing else.

(well, you can also convert /sdcard and your external SD.

but only if you currently have them as ext4, which is something i already don't recommend.)

thanks!
[Galaxy S II Android Development] Lanchon:
can anybody reproduce the instant reboot on "fstrim -v /preload"?

SAMDestroy, could you please retry "fstrim -v /preload" but under the non-trim stock CM kernel?

to do this you need to reflash your currently installed CM and reboot. no wiping of any caches is needed.

after the test you can reflash my kernel if you want.

thanks!
[Galaxy S II Android Development] the.divergent:
edit: was thinking to change it to F2FS and then trim it

Regards
[Galaxy S II Android Development] good8life:
Welcome
[Galaxy S II Android Development] SAMDestroy:
is thats without the trim kernel? or is this with trim kernel?

i would try to trim preload without the trim kernel but currently im busy.. can do this later today if there still is a need for it [MENTION=4141005]Lanchon[/MENTION]

btw last night i had a random reboot with trim kernel
[Galaxy S II Android Development] good8life:
This is last kernel 28.02 with trim.

I don't have reboot with kernel 28.02, but I have 1 reboot with stock kernel nighty 27.02.

Now, I have installed 27.02 nightly and kernel 28.02 trim
[Galaxy S II Android Development] laserkater:
Is there a reason why you don't recommend using ext4 for /sdcard and external SD? Maybe you have already written something up about it and I've missed it so far, if so then sorry.
[Galaxy S II Android Development] SAMDestroy:
then there is maybe something wrong with my partitions i didnt noticed before.. or this f2fs-trim combination is buggy only for some hardware/software setups and it needs fixing/optimizing like Lanchon said
[Galaxy S II Android Development] good8life:
Which partitions we can trim: system, data, cache, preload, efs ?

Maybe even?

;)
[Galaxy S II Android Development] fireburner-de:
All ext4 partitions can be trimmed, which are by default /system /cache /preload /data and /efs

Internal and external sdcard can be trimmed, if they are formatted as ext4 (not if they are vfat).
[Galaxy S II Android Development] SAMDestroy:
sorry for the late response.

im back to cm-13.0-20160228-NIGHTLY-i9100 kernel.

trying fstrim -v /preload just gets me the "FSTRIM: Operation not supported" error :)
[Galaxy S II Android Development] JanJabko:
Could it be that Androbench is showing some results slower than before TRIM? Am I misinterpreting the results or did I miss something in this thread?

I'm on latest CM 12.1 nightly, IsoRec and repartitioned to /system 1GB and /data 6GB. eMMC is VIS00M, 07/2012, 0x09.

Trimmer showed trimmed space for all three partitions.

Screenshots before and after and trimmer attached.
[Galaxy S II Android Development] Lanchon:
ok! reboot on trim was really weird. :) thanks!

it was with trim kernel because it trimmed. you are having random reboots that most likely have nothing to do with trim.

your issues probably have nothing to do with f2fs either.

i bet you would be unable to reproduce the "reboot on /preload trim" too. because it probably never had anything to do with it.
[Galaxy S II Android Development] Lanchon:
of course there's a reason, ive written about it. bottom line: android wasn't designed to run this way; it's not tested; i've heard reports of many problems. but if you don't run into trouble, then by all means use it.

if i wanted to use ext4 i'd try to convert to /data/media instead.
[Galaxy S II Android Development] kosmasgr:
Results from my s2 with no emmc bug and trim cache , data and system and running latest cm 13
[Galaxy S II Android Development] Lanchon:
i dont really trust androbench, it's not very repeatable. i've said it many times here.

but your benchmarks show that random writes more than doubled!

random writes are among the slowest things for our device and the cause of many lags.
[Galaxy S II Android Development] laserkater:
Okay, didn't know that and haven't read it before. So far my phone is doing very well with ext4 on all partitions. Plus I think it's pretty sweet to be able to trim those partitions as well.

Thanks to you and [MENTION=6159291]Lysergic Acid[/MENTION] and all the other contributors for keeping this behemoth of a phone running so well!
[Galaxy S II Android Development] Lanchon:
UPDATE: VICTORY !!!

2016-03-02: after two years of tests and discussions, folklore, FUD and evidence, Lysergic Acid finally took the plunge and merged! TRIM is now part of the official CM 12.1 and CM 13.0 kernels, and this project can at last be retired, yoohoo!!! CM 13 users now enjoy TRIM out of the box, but users of CM 12.1 builds older than Match 2016 as well as CM 11.0 users continue to require a separate TRIM kernel.

this thread is dedicated to Entropy and the brave users who risked their devices to run the very first TRIM tests.
[Galaxy S II Android Development] Farmut83:
You deserve it :good: well done. Congrats.

Question: I have now your kernel from 28.02. I will just update (next nightly) the firmware? Trim will be enabled/works by default?
[Galaxy S II Android Development] Acid0057:
You do deserve it [MENTION=4141005]Lanchon[/MENTION] glad it's finally happening. I'm assuming this will be on CM13 builds from March 3rd on?

[MENTION=3016371]Farmut83[/MENTION] I'd think that would work. Just flash the first trim enabled CM13 over top of your existing CM13 install.
[Galaxy S II Android Development] SAMDestroy:
finally :) good news and [MENTION=4141005]Lanchon[/MENTION] this is because of my PM ;) joking
[Galaxy S II Android Development] makix13:
Thanks Lanchon for your work and efforts, to give us the opportunity to enjoy our S2 more and more,and thanks to all the developers that offer their work to the community, sincerely you are a good example of humanity [emoji122] [emoji122] [emoji122] [emoji122] [emoji106]

S2 Cyanogenmod 5.1.1 [official nightly] - Lanchon's kernel isorec - arnab isorec twrp - Xposed [official framework] - Viper4Android
[Galaxy S II Android Development] fireburner-de:
[MENTION=4141005]Lanchon[/MENTION] Thanks for all the work, you have put into the TRIM topic over the past years!

It's glad to see it tuned into official builds in the end.

You are one of the CustomRom scene heroes for i9100 (and I assume for many other devices)!
[Galaxy S II Android Development] the.divergent:
Does F2FS /system /data and /cache needs trimming with Trimmer apk or it is trimmed by itself already?

Regards
[Galaxy S II Android Development] Kevin3014:
So a few days back I read that trim enabled kernels will trim the phone automatically. How often is this done? Like once a day/week?

If it matters, I'm on the latest nighty (20160306) of CM 13.
[Galaxy S II Android Development] SAMDestroy:
from what i read it will trim every 24 hours after 1 hour of inactivity and only if your battery is min. at 80% or while charging 30%
[Galaxy S II Android Development] fireburner-de:
[MENTION=7013647]Kevin3014[/MENTION] The answer of [MENTION=6770733]SAMDestroy[/MENTION] is totally right!

[MENTION=6022607]Ojdanic[/MENTION] f2fs cannot be trimmed at the moment. I don't know, if it can be trimmed in general. But if it can be trimmed, this might be fixed eventually.
[Galaxy S II Android Development] Lanchon:
f2fs cant be trimmed by fstrim for the version of f2fs merged in our kernel. but latest official kernel now trims continuously on f2fs partitions (are mounted with discard). it kinda slows down things a bit, but at least it wont get painfully slow after a while.
[Galaxy S II Android Development] the.divergent:
Ok, thanks. So according to you is it better to stay on older build without merged trim and ext4 or to flash latest nightly and change to f2fs?

---------- Post added at 01:57 AM ---------- Previous post was at 01:23 AM ----------

Edit:I am thinking on /data and /system partition, don't care for /cache partition
[Galaxy S II Android Development] Lanchon:
i have null opinion until there's evidence.

EDIT: regarding performance.

but if you want to maximize data integrity, go for ext4.
[Galaxy S II Android Development] I_am_a_number:
Well done!

Fantastic! This has been one of the best threads on xda - in some ways it's sad to see the end of it. Thanks once again Lanchon.
[Galaxy S II Android Development] the.divergent:
I just converted /data on my S2 to F2FS.

Here are scores with antutu benchmark:

Ext4(before)

F2FS(now) .

You can see it is just a li'l difference between EXT4 and F2FS. I am hoping that phone will not slow down after a while on F2FS like on ext4 becouse we have autotrim now. Cheers ;)
[Galaxy S II Android Development] daniu:
Hi

[MENTION=6022607]Ojdanic[/MENTION],

If you think that this difference is because of f2fs you should run antutu more often. That difference does not at all have anything to do with changing your fs (it could though) - the values in antutu can be within a much bigger range. I had seen values that differed more than 1000 - IIRC even 2 or 3000 ... (that's why I don't use it any more - it does not say much) and I did not do anything while testing and tried to have the same handling (fresh booted, leaving the phone for a while)

I also think that a new ROM gotta settle a couple of days - so testing before that will give you any value ...

Regards

Sent from my x-phone using brain 2.0
[Galaxy S II Android Development] the.divergent:
So after a day of using rom on F2FS there's no much difference between F2FS and ext4, the only adventage is that f2fs has autotrimming. So here is SS of Antutu after a day of using.

Just to add that I've done this test with a lot of services running in background, becouse I wanted to get more realistic result, and on both of above screenshoots phone was fresh booted.