Lanchon REPIT

A Device-Only Data-Sparing Repartitioning Tool For Android

CHANGELOG - DEVICES - DOWNLOADS - GALAXY S2 - XDA THREAD

Powered by Flashize.


General Information (All Devices)

WHAT IS THE PROBLEM ?

many older devices, especially the ones originally released before emulated storage was available, were partitioned by the OEM in ways that hinder the installation and use of newer Android versions. for example, the Galaxy S2 GT-I9100 comes with a 0.5 GiB /system partition that is unable to fit CM 13.0 and Open GApps, even if you choose the pico version. though its flash is typically a generous 16 GiB, the stock /data partition is only 2 GiB which means that with today’s ART you run out of space to install applications in no time. it also comes with a 0.5 GiB /preload partition that goes unused on custom ROMs.

people have typically solved this by repartitioning. on Samsung devices this is a tricky process that involves the use of download mode, a Windows PC, Windows device drivers that support the device’s download mode, a ‘pirated’ proprietary PC software called Odin, the right PIT and other files, and correct configuration. (a free software alternative to Odin called Heimdall works on many devices and is cross platform and supports Linux PCs, but the rest of the hurdles remain.) the procedure has potential for hard-bricking if the wrong files are flashed. after repartitioning, all affected partitions must be reflashed or formatted anew, a procedure that many get wrong. and of course, all data in the affected partitions gets wiped (typically the complete device) making this an ultra-inconvenient affair.

WHAT IS REPIT ?

REPIT is a simple, safe, device-only, data-sparing, and easily portable repartitioning tool for Android devices:

you can look at the log of a demo run to get a feel for what REPIT can do. in this run on a Galaxy S2 it grows the /system and /data ext4 partitions to 1 and 6 GiB respectively, it wipes and shrinks the unused /preload partition to a minimum size, and it adjusts the size of the internal /sdcard vfat partition to occupy whatever space is left. REPIT plans, orders and undertakes a safe series of partition resize and move operations to reach its goal, all the while keeping and eye on details such as alignments and retaining the data present in the /system, /data and /sdcard partitions.

LIMITATIONS

HOW TO REPIT

  1. if you think your data is invaluable then treat it as such: make a backup!
  2. get TWRP running on your device.
  3. make sure your battery is mostly charged.
  4. get the zip for your device from the link below.
  5. rename it to express your desired configuration (see below).
  6. PLUG INTO A POWER SOURCE. this operation might take a long time and must not be interrupted.
  7. flash the zip locally on the phone. (if you want to sideload instead, please see the note below.)

finally, go get a coffee or two. do not, under any circumstance, interrupt this script !!!

in case the script fails to start:

if you want to sideload:

HOW TO CONFIGURE

configure the script by renaming the zip file before flashing it.

valid zip names: <prefix>[-partition1=<conf>][-partition2=<conf>]...<suffix>

valid partition <conf> values: [<size>(G|M)|same|min|max][+[keep|wipe][+[ext4|vfat|f2fs|swap|raw]]]

the defaults are device-dependent. please look inside your device’s configuration file for more information. for configuration samples please see the i9100 section below.

Partition Data
Partition Sizes
Partition Types
Supported Features
  wipe keep + move keep + resize keep + move + resize crypto footer
ext4 YES YES (brute force) YES (efficient) YES (brute force) YES
vfat YES YES (efficient) YES (efficient) YES (efficient) no
f2fs YES YES (brute force) no no YES
swap YES no no no no
raw no YES no no no

IN CASE OF ISSUES

if there are any problems, read the log! you can scroll it on TWRP. most likely it will tell you what is wrong and what to do about it. if not, make sure to somehow record the log. REPIT logs to file ‘/tmp/lanchon-repit.log’. otherwise, you can obtain a copy of TWRP’s log (which includes REPIT’s log), or if not at least take a picture of it with your camera. in TWRP 2.8.7.* 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. after recording the log, you can try reflashing the script if you understand what happened and flashing it again makes sense.

PLEASE NOTE: your ‘did not work’ report is useless unless you post info from your log.


Device-Specific Information

each supported device has a unique targeted build of REPIT in the download section. you can also find device-specific information in the device tree; try searching by device codename using Github’s find file. all configuration options for a specific device are defined in the corresponding <device-codename>.sh file and the common.sh files that might exist in the same directory and in directories above it. you might also find device-specific readme files with relevant information.

IF YOUR DEVICE IS NOT SUPPORTED

so your device is unsupported, tough luck… but porting REPIT to a new device is an easy job; you can either do it yourself or request that i do it for you. to request a new port, please follow this steps; port requests are welcome. if you want to get your hands dirty, check the configuration files for i9100 (1, 2), they are the most complete and commented. but usually you can get away with much less, take a look at i9300. for an example of how to handle out-of-order partitions, check out janice.


The Galaxy S2 Family

REPIT started its life as i9100-only tool and it inherits this doc section from the good old days.

IMPORTANT NOTE: this script will not work if your phone is encrypted. you need to decrypt your phone first. this was found and reported by XDA user jer194 here. if you run the script on an encrypted phone anyway, no damage will come: it will just refuse to start, complaining that it cannot reread the partition table.

IF… your stock-partitioned device cannot flash gapps after updating to CM 13.0

download and flash the file as it is. it will get most space from the unused /preload partition and only 8 MiB for the internal sdcard, and then make /system 1 GiB in size. it will keep you current /data size constant, whatever it is. it will retain all data except data in /preload, which is unused in custom roms (but some multi-boot setups use it).

IF… your device is usable

you can nonetheless use this script to do general repartitioning, file system fixing, wiping, and/or file system type changes. download the script, rename it to express your desired configuration (see below), and then flash it.

Galaxy S2 HOW TO

first get official TWRP running on your device, then follow the generic how-to.

valid zip names: <prefix>[-system=<conf>][-data=<conf>][-sdcard=<conf>][-preload=<conf>]<suffix>

for this device, partition alignment is 4 MiB and partition sizes get rounded to the nearest 4 MiB boundary. (it is typical for all devices to use the same value for partition alignment and granularity.)

Galaxy S2 Defaults
Galaxy S2 Samples


Disclaimer

i believe this software to be very safe and i exercised it a lot before posting it. but i accept no responsibility if your data is lost or your device is bricked.



for historical information regarding the CHEF-KOCH incident (and XDA’s response), please follow this link.