yashsingh1/xdaforums huggingface dataset:
[Galaxy S II Original Android Development] Lanchon:
ok so you rather DIY. you should, it's easy.

two options:

a)go to a standard partition scheme (recommended)

or b)change my script

a)

boot twrp then..

adb shell

parted /dev/block/mmcblk0

unit s

print

(always ignore any "problems" parted finds, dont fix them)

help

now this is the standard cache and modem partitions:

Model: MMC VIS00M (sd/mmc)

Disk /dev/block/mmcblk0: 30777344s

Sector size (logical/physical): 512B/512B

Partition Table: gpt

Number Start End Size File system Name Flags

1 8192s 49151s 40960s ext4 EFS

2 49152s 51711s 2560s SBL1

3 53248s 55807s 2560s SBL2

4 57344s 73727s 16384s PARAM

5 73728s 90111s 16384s KERNEL

6 90112s 106495s 16384s RECOVERY

7 106496s 311295s 204800s ext4 CACHE

8 311296s 344063s 32768s MODEM

9 344064s 2441215s 2097152s ext4 FACTORYFS

10 2441216s 15024127s 12582912s ext4 DATAFS

11 15024128s 30752767s 15728640s fat32 UMS msftres

12 30752768s 30769151s 16384s ext4 HIDDEN

your goal is to recreate those numbers in bold.

first exit parted and dd MODEM ( /dev/block/mmcblk0p8 ) to a file in your internal sdcard (mounted as /emmc, make sure its mounted)

better if you unmount everything now.

then get back to parted:

-delete (rm) the CACHE.

-make partition (mkpart) a new CACHE with the proper disk area as above.

-name it CACHE

-do the same 3 steps for the MODEM.

quit parted. then run this command to make the kernel reread the partition table:

blockdev --rereadpt /dev/block/mmcblk0

now dd the contents of MODEM back in.

using the TWRP UI, format cache.

and you are done.

b)

edit my script. change the line that says:

-> heapStart=344064

to

-> heapStart=532480

and that's all. it's significantly shorter but less fun :)
[Galaxy S II Original Android Development] sky321:
Just Thanks!

Hi Lanchon, I just wanna thank you for your script and all the effort. I'm verry happy with this easy method for repartitioning. Simple as a one klick solution, I love it.! Now I'm ready for the next step (MM) in the life of my S2. Unbeliveable long run for this device, and thats because you and your fellows did sutch a got job. Hat off.
[Galaxy S II Original Android Development] Lanchon:
hi

sorry i didnt see your post because it was a double response!

well, it should work. it works for everybody else! my guess is that either you are encrypted or you are not using the latest isorec twrp published by me or you are not using a recent kernel like one of my trim kernels.
[Galaxy S II Original Android Development] yupo72:
It works!!!

It takes an hour to do all the job but finally works.

Thank you Lanchon :good:
[Galaxy S II Original Android Development] erotavlas:
Do not excuse with me, thank you for your help.

I'm sure that my phone is not encrypted (could the upgrade to CM 13 automatically decide to encrypt it? I do not think so), I'm using this version of twrp recovery-Lanchon-IsoRec-TWRP-2.8.7.0-20160113-i9100-(by-arnab).zip. Maybe could be the kernel. I'm on 3.0.101-CM-g89cb46fblinky@cyanogenmod # 1 13 Feb 2016.

Thank again

Edit:

I repeated all the procedure by reinstalling the twrp, try to flash the script from internal sdcard and then after unmounting try to flash the script from tmp folder. This is the output https://gist.githubusercontent.com/...29a2fb9a363faf6a7eb89e456a944048/recovery.log
[Galaxy S II Original Android Development] svbarbosa:
I will opt for the script change. I just like the idea of a comfortable cache partition.

532480 is the starting block of my system partition. 344064 is the standard starting block of an unchanged i9100 system partition. Got it.

When I read the post my son was about to leave. So I will do it when he comes back in two weeks.

Thanks a zillion again for the help. :good::good:
[Galaxy S II Original Android Development] the.gangster:
Did you have your phone connected to your PC? If so, try disconnected. Looks like your internal SD was USB-mounted in all your logs.

Next, you are planning to have 1GB System and 6GB Data.

This would leave 7.5GB for your internal SD, but you already have 8.6GB of data on your internal SD. So even if you meanwhile configured Data to be wiped it would not work to keep all data on internalSD.
[Galaxy S II Original Android Development] Lanchon:
note that the cache partition serves no purpose these days.
[Galaxy S II Original Android Development] Lanchon:
i was able to reproduce the bug: in TWRP, if you mount via USB mass storage, something keeps locking the emmc even after you unmount. workaround: reboot TWRP, do not mount via USB mass storage, and flash. note that MTP does not have this issue.

he mounted but unmounted afterwards, it *should* have worked. btw, thanks for spotting the USB mount.
[Galaxy S II Original Android Development] erotavlas:
No, I do not. I have external microSD card inside. Yes, I saw that I cannot umount internal sdcard or emmc memory.

What do you suggest? I would like to do have 1.5GB System and 6GB Data and this should work lanchon-repit-20160216-system=1.5-data=6+wipe-sdcard=max-preload=min+wipe

Thank you
[Galaxy S II Original Android Development] svbarbosa:
I was suspecting that.

So maybe i should:

1. Make a full TWRP backup.

2. Adapt your instructions to reduce cache and adjust modem and system partitions.

3. Modify REPIT script with the new system partition starting block.

4. Run REPIT using wipe mode in all but internalsd partition.

5. Restore TWRP backup.

This should work, right?
[Galaxy S II Original Android Development] erotavlas:
Thank you for your support. Finally, I was able to unmount all the partitions. I executed again your script, but I stuck in a new error

Warning: Not all of the space available to /dev/block/mmcblk0 appears to be used, you can fix the GPT to use all of the space (an extra 2048 blocks) or continue with the current setting?
Error: Unable to satisfy all constraints on the partition.

[ERROR 1]

I:Legacy property environment disabled.

This is the complete log

https://gist.githubusercontent.com/...29f9231e748f709acdbf534202647242/recovery.log
[Galaxy S II Original Android Development] the.gangster:
Now you (still) try to resize internalSd to 7GB although it has more than 8.6GB of data in it!

Either remove up to 2GB of files from it or take a configuration like system=1.5-data=4 to keep enough space for the internalSd.
[Galaxy S II Original Android Development] Lanchon:
as you can see from your log:

***** processing partition #11 /sdcard (UMS)

info: moving/resizing the vfat partition

Warning: Not all of the space available to /dev/block/mmcblk0 appears to be used, you can fix the GPT to use all of the space (an extra 2048 blocks) or continue with the current setting?

Error: Unable to satisfy all constraints on the partition.

the resizing of your sdcard failed. as the.ganster said (even before you tried) this is because you don't have enough free space there. keep in mind that you want some free space in sdcard for the phone to work, so free up more than the bare minimum.
[Galaxy S II Original Android Development] Lanchon:
no!

if you follow my instructions for a standard cache partition, then you dont need to modify my script or wipe anything. when you are back to standard cache and modem, you just run REPIT: it will move your system partition where it needs to be and do all that you ask of it.

DO NOT SHRINK the cache to less than the standard 100MB! not worth the trouble.

you can also just modify the line in my script and keep your non-standard cache for now. i suspect i might push out a new version sometime that is able to handle cache and modem for you automatically. i didnt know some people had dared to touch /modem! :)
[Galaxy S II Original Android Development] DFurax:
Hi,

Is it really important to have the last isorec twrp to do this script ? Also if I have to install "Isorec twrp" should I install only the recovery or also the kernel (I'm on cm) ?

Thank you very much !
[Galaxy S II Original Android Development] Lanchon:
please dont spam the thread. either read or refrain from posting, thanks.
[Galaxy S II Original Android Development] :
Great work Lanchon!, I successfully ran this script on my phone, but a question, this is permanently right? even if I flash any rom? Im currently using CM12.1 last nightly and waiting for a more stable release of CM13 Sorry if this question is already answered
[Galaxy S II Original Android Development] fireburner-de:
[MENTION=5614371]Vixo1[/MENTION] Flashing ROMs does not affect partition layout at all, so YES.
[Galaxy S II Original Android Development] McConnor:
This looks like a great method to repartition - but probably it wont work on the i9100G variant (which I own)? Kindly asked: could it in theory be adapted to this device easily or is it to great an effort?
[Galaxy S II Original Android Development] Lanchon:
i have a new version ready that i didnt publish b/c of problems with xda. after that, the idea was to make it hardware independent and very portable. i dont know if ill keep the development up though.
[Galaxy S II Original Android Development] McConnor:
Oh please do...[emoji3] that version might come in very handy with mm rom also at our i9100g-door... That would mean e.g. half a GB of new space for system... Well let's wait what you decide and hope the best.

Gesendet von meinem GT-I9100G mit Tapatalk
[Galaxy S II Original Android Development] Pecka40:
Hello, First of all thank you for this great tool.

I successfully used it once but i wanted a bigger data partition so i tried it again with your recommended "-system=1-data=6-sdcard=max-preload=min+wipe". Now im getting an error.

The error was something like this:

Analyzing partition #11 /sdcard (UMS)

info: will move/resize the vfat partition

info checking file system

Logical sector size (127 bytes) is not a multiple of the physical sector size.

dosfsck 3.0.12, 29 oct 2011, FAT32, LFN

info: errors detected, retrying the file system check

Logical sector size (127 bytes) is not a multiple of the physical sector size.

dosfsck 3.0.12, 29 oct 2011, FAT32, LFN

FATAL: file system errors in partition #11 / sdcard (UMS) could not be automaticly fixed

[ERROR 1]

I dont really know what to do now. I tried running again. Tried doing it again with the stock partition. But that didnt help. Thanks for help!
[Galaxy S II Original Android Development] Lanchon:
you probably have an ext4-formated sdcard and are wrongly telling repit your sdcard is vfat.

I WILL NO LONGER MONITOR THIS THREAD.

PLEASE SEE THE OP FOR DETAILS.

thank you for using repit.
[Galaxy S II Original Android Development] Pecka40:
Thansk for the fast replay, even if you said you will no longer monitor the thread. Ill try checking the ext4 format.
[Galaxy S II Original Android Development] davidvanwijk:
Thanks for your work! My S4 is perfectly working on CM13 because of you!

Verstuurd vanaf mijn GT-I9505 met Tapatalk
[Galaxy S II Original Android Development] Acid0057:
I'll echo everyone else here Lanchon. Thank you for your hard work! The S2 community appreciates it.
[Galaxy S II Original Android Development] :
I WILL NO LONGER MONITOR THIS THREAD.

PLEASE SEE THE OP FOR DETAILS.

thank you for using repit.

Thread closed due to end of support from OP.
[Galaxy S II Original Android Development] Lanchon:
a loop???? man did you interrupt the script???? jeez you can't interrupt this!!!!

THERE IS NO LOOP!

YOU NEVER EVER INTERRUPT THIS SCRIPT!!!!!

the script either ends with success or an error OR YOU KEEP WAITING!

this will never get stuck in a loop, it looks like it was making progress and you killed it.

if the script ends with an error:

mostly not a problem, it stopped at a point where all your data is still intact.

but it was unable to attain your desired partition layout, and your device may be in a state where some progress was made and now it has unallocated, unusable empty space between partitions. if you fix the problem and rerun the script, it will continue.

IF YOU INTERRUPT THE SCRIPT:

MOST PROBABLY YOUR DATA IS EFFED UP COMPLETELY.

so please, DONT REPARTITION AT 3AM IF YOU CANT UNDERSTAND THE LOGS ETC AT THAT TIME!
[Galaxy S II Original Android Development] Lanchon:
i didnt test that but i would say it doesn't matter.

but your /system will be modified anyway.

why would you want to enlarge /system if you can't flash to it anyway???
[Galaxy S II Original Android Development] Lanchon:
this release if for people on stock, meaning vfat sdcard.

if your run the script, it shouldn't kill your data. but it certainly wont be able to repartition.

but i can help you anyway. so what layout did you want on your phone?
[Galaxy S II Original Android Development] Drhedphuk:
Thats what I thought, but I do not have your superior knowledge and wanted to cover the bases. Everyday is a school day after all...

Thank you for your reply.
[Galaxy S II Original Android Development] fireburner-de:
Good to know, as I was thinking of using ur script someday to extend my /data from 4 to 6GB. But I also formated sd0 as ext4.
[Galaxy S II Original Android Development] prazola:
To be clear, I've not stopped the script. It stopped himself after trying to read system partition info repeatedly aka "loop".

They've retired my driving license, not my brain [emoji1]
[Galaxy S II Original Android Development] Lanchon:
it never ever tries to "read system partition info repeatedly". it was not looping, it was making progress with each read. and i'm sure it didnt stop reading any partition info, it stopped while trying to do something else that was specified in the lost log. again, you probably had some corruption. or not enough free space to shrink partitions. who knows what you were trying to do! you didnt even say what script you flashed.
[Galaxy S II Original Android Development] Drhedphuk:
Sadly, attempt failed. Followed instructions to the letter. Screenshot enclosed.
[Galaxy S II Original Android Development] Lanchon:
you can do it now, here is a script with your requirements

EDIT: DO NOT USE THIS OLD FILE FOR PARTITIONING !!!
[Galaxy S II Original Android Development] prazola:
I was flashing the one-six zip, like the user above. System was 512mb with 70mb~ free.

I remember that at the end no partition was changed, but it takes a lot to end itself. Uh, phone was already pitted with 0.5 system and 5.0 data.
[Galaxy S II Original Android Development] Lanchon:
you really should open the full screen log before taking the snapshot (middle button at bottom)

as clearly stated, your fs had errors. with luck they were fixed. you can repeat the EXACT same operation (all steps) and see if it continues now.

or you can manually fix the filesystem errors. fixing filesystems is out of the scope of this script.
[Galaxy S II Original Android Development] Lanchon:
stock for you, but people should use this anyway.

WARNING: this still wipes /preload!!!

growing/shrinking an FS from 8MB to 512MB and back is not a sane idea. 2:1 or 4:1 change is ok, 64:1 change is nuts.

EDIT: DO NOT USE THIS OLD FILE FOR PARTITIONING !!!
[Galaxy S II Original Android Development] Drhedphuk:
All seems to be okay with the Fs, I'll try again.
[Galaxy S II Original Android Development] Lanchon:
i doubt partitions weren't changed. probably some were, and your phone is in a suboptimal states.

this report is completely useless: no log means you might as well not posted at all.

you can execute again and this time read the log at least if you wont post it.
[Galaxy S II Original Android Development] Lanchon:
the log clearly says that partition #10 (/data, the name was specified before in the log) had errors and that some were fixed.

it might be ok now, but it wasn't before.
[Galaxy S II Original Android Development] Drhedphuk:
I see. What steps can I take to ensure that it is indeed fixed?
[Galaxy S II Original Android Development] Lanchon:
the script tries to fix all safe-to-fix file system errors. (it might find errors that simply booting up the kernel will not.)

most errors are of this safe-to-fix type. but even if fixed, depending on the error found, the script might stop to give you a chance to think.

my take on this is:

-record the error (as you did)

-then re-run the script

chances are, the next run would have succeeded.

if there are errors that cant be fixed, you should manually run fsck.

dont ask me how to fix a disk, google that.
[Galaxy S II Original Android Development] Acid0057:
Excited to give this a try Lanchon. Going to give it a go tomorrow and report back. I currently have a S2 GT-i9100 on Cm 12.1 the last nightly. Stock partition sizes even preload. With your IsoRec+Trim Kernel and Arnab's TWRP. Just have to get a SD Card reader on the way home today (Mine broke and forgot till I was going to load the zip onto it :(
[Galaxy S II Original Android Development] Drhedphuk:
Thank you. I was just reading about fsck as your reply came through.
[Galaxy S II Original Android Development] Lanchon:
you dont need the sd. just download to internal and use TWRP file manager to copy to /tmp. its GUI, cant be any simpler! :)
[Galaxy S II Original Android Development] davidvanwijk:
can you examine my recovery log?

Hi Lanchon, resizing system with this tool failed. I am a beginner, so I suppose I made mistakes ...

Please, give me some advise. I uploaded recovery.log

This is a part of recoverylog:

Thanks

####################################

Lanchon REPIT

A Data-Sparing Repartitioning Tool

Copyright 2016, Lanchon

Device: i9100

####################################

===== PREPARATION =====

info: checking tool: parted

info: checking tool: blockdev

info: checking tool: awk

unmounting all partitions

info: rereading partition table

blockdev: /dev/block/mmcblk0: Device or resource busy

[ERROR 1]

I:Legacy property environment disabled.

E:Error executing updater binary in zip '/tmp/lanchon-repit-v0.1-sys1GB-data6GB-i9100.zip'

Error flashing zip '/tmp/lanchon-repit-v0.1-sys1GB-data6GB-i9100.zip'

Updating partition details...

I:mount -o bind '/emmc/.android_secure' '/and-sec' process ended with RC=0

I:Unable to mount '/sdcard'

I:Actual block device: '', current file system: 'vfat'

...done

I:mount -o bind '/emmc/.android_secure' '/and-sec' process ended with RC=0

I:Set page: 'flash_done'

I:operation_end - status=1

I:Set page: 'clear_vars'

I:Set page: 'install'

I:Set page: 'main'

I:Set page: 'clear_vars'

I:Set page: 'main2'

I:Set page: 'advanced'

I:Set page: 'confirm_action'

I:Set page: 'action_page'

I:operation_start: 'Copy Log'

I:Copying file /tmp/recovery.log to /emmc/recovery.log
[Galaxy S II Original Android Development] Lanchon:
your disk is busy:

>> blockdev: /dev/block/mmcblk0: Device or resource busy

this is likely because you didnt follow the list of steps in the OP.

instead of me copy/pasting the list and adding question marks after each step, please it and just tell me what you didn't do :)
[Galaxy S II Original Android Development] Lanchon:
oh, by the way:

i never actually tested flashing from EXTERNAL sdcard. it's a different device, so i assume it should not lock the eMMC. did you flash from external?

if so, of course copying to /tmp will work. but im interested in your experience. if you followed all steps and still get that error, it means that the prediction is wrong and it wont work from external for unknown reasons.

keep in mind that you data integrity is not affected by this error. it's a minor thing.
[Galaxy S II Original Android Development] davidvanwijk:
The steps I followed

Installed recovery is : recovery-Lanchon-IsoRec-TWRP-2.8.7.0-20160113-i9100.

Battery charged 100%.

I flashed from /tmp.

I unmounted all partitions with TWRP.

Phone was plugged into a power source.

I think I followed all instructions carefully. What went wrong?

Thanks again!
[Galaxy S II Original Android Development] OrganLoc:
Okay, thanks! I also would like to have a 1GB system, 6GB data layout (and sdcard as ext4 as discussed). So I guess that your script in post #30 is the solution?

Thank you very much! I will wait some time though for CM 13, as the last CM 12.1 with your Trim kernel and zram deactivated is super fast and stable, and I want to migrate to the new system layout with backups and new CM 13 in one batch.

Thanks!
[Galaxy S II Original Android Development] fireburner-de:
Great!

Thank you very much!
[Galaxy S II Original Android Development] Drhedphuk:
I have tried several times since, with the same effect. I am currently looking into fsck, but what I did notice was that when I tried to unmount the emmc checkbox it re-checks itself, therefore not unmounting I presume.
[Galaxy S II Original Android Development] Lanchon:
something was still mounted. you can repeat, maybe TWRP wasn't able to unmount.

if problem persists you can unmount in TWRP then:

adb shell cat /proc/mounts

from the PC and post the results

EDIT:

for reference, this is what it should look like. as you can see, no reference to /dev/block/mmcblk0 or any of its partitions.

[B]$ adb shell cat /proc/mounts [/B]
rootfs / rootfs rw 0 0
tmpfs /dev tmpfs rw,seclabel,nosuid,relatime,mode=755 0 0
devpts /dev/pts devpts rw,seclabel,relatime,mode=600 0 0
proc /proc proc rw,relatime 0 0
sysfs /sys sysfs rw,seclabel,relatime 0 0
selinuxfs /sys/fs/selinux selinuxfs rw,relatime 0 0
tmpfs /tmp tmpfs rw,seclabel,relatime 0 0
[Galaxy S II Original Android Development] Lanchon:
yes
[Galaxy S II Original Android Development] Lanchon:
no idea what twrp does.

if something is mounted and the script cant unmount it by itself, it WILL exit; no harm done.

but exit with a different error. so which error are you getting now?

i assume you know you are supposed te check the log every time, not just on the first run!

please reply to the correct message so i can follow our conversation.
[Galaxy S II Original Android Development] Drhedphuk:
I would love to be able to tell you what the problem is, but I can't read it as it doesn't fit in the dialogue box. Checked the log, doesn't give any evidence of what is happening, just says failed and as I have already stated can't read the text.

tried to take a screenshot as you directed in previous post and in OP but takes me back to the menu.
[Galaxy S II Original Android Development] Lanchon:
FROM THE OP:

if there are any problems, make sure to somehow record the log. take a picture of it at least; you can see a full screen log by hitting the back button once, then the center button at the bottom of the screen that looks like a TV screen.

EDIT:

hope you dont take it the wrong way :)

http://lmgtfy.com/?q=get+twrp+log

you can simply do this to see the log on the PC:

adb shell cat /tmp/recovery.log
[Galaxy S II Original Android Development] Drhedphuk:
As I have already stated, this is not happening on my device. I hit the back button and it takes me back to the main menu, NO TV screen at the bottom of the screen.
[Galaxy S II Original Android Development] anton_mjor:
Hi!

Tried running the script om my stock pitted S2, seems it got an error right in the end:

Tried running the script again after reading some posts in the thread and got another error, but it looks a bit different:

I just went from unrooted stock 4.1, flashed your IsoRec and latest CM13 nightly and tried it out a quickie before deciding to repit to fit gapps.

Are you able to tell anything from this?

My S2 is not my primary phone, so I'm not in a hurry to fix it, neither do I have any data on it I need to salvage, so I could just wipe it if it would fix the problem.

[EDIT] Sorry, I checked my settings in mounted partitions again and I had forgot to choose Micro-SD as storage. I changed it, unmounted eMMC, ran the script and it finished successfully! (Maybe this can help someone else.)