Post Reply

[HACK] Grow your data partition

OP cyansmoker

13th January 2014, 12:22 AM   |  #1  
OP Recognized Developer
Flag Los Angeles
Thanks Meter: 617
 
494 posts
Join Date:Joined: Sep 2010
Donate to Me
More
THE PROBLEM

As many of us have noticed, it is fairly easy to get an "Out of space" message when installing apps on our phones because, for some weird reason, Oppo decided that the storage part of the device should linger in the dark ages, when /userdata and /sdcard were separate partitions and you only had 2GB of data storage, even if your phone was a 32GB model.

Now, imagine that you are running KitKat and would like to try ART. This may be a bad idea as, if your data partition is more than 30% full, you will find that while converting your apps to this new format, Android will run out of space.

At OppoForums, a few bright people started looking into the issue and, of course, there is a way to improve the situation.

WARNING!

If you follow the steps below correctly, you should not run in any trouble. If you do not, however, you may end up spending much more time fixing your phone.

FIRST, THE THANKS SECTION
  • Anders tinkered with his deviceís partition table until he got to where he had grown the /userdata partition to something useable. Yes, itís some peopleís definition of ďplayĒ
  • Jousa11 is the first person trying to put a guide together explaining the steps to reproduce Andersí work. WARNING: I did no get to see said guide as Jousa quickly deleted it due to the risks involved. So, take that in account!
  • Rockman for providing the last resort rescue tools in case you brick your phone
  • Lucky for providing the WiFi fix
Please let me know if you are not on this list and I forgot to give you credit!

YOU WILL NEED

The hardware:
  • An Oppo Find5 phone(!)
  • A computer (Windows/Linux/Mac) with adb installed and working
  • A USB cable

On your computer:
  • adb
  • [Optional] fastboot

On your phone (SDCard):
  • parted + mke2fs + tune2fs
  • mmcblk0p21_persist_ext4.img
  • openrecovery-twrp-2.6.3.0-find5-TP-patch.img
  • [Optional] gdisk

You will use parted to work on your partition table; mke2fs and tune2fs to create ext4 filesystems on some of these partitions (parted does not know how to create ext4 partitions)

mmcblk0p21_persist_ext4.img is an image that you need to restore your /persist partition and avoid issues such as non-working WiFi.

openrecovery-twrp-2.6.3.0-find5-TP-patch.img is a patched recovery image. I know: you already have a recovery image if you are going through these steps. However, we are going to wipe it so you want to install this guy before rebooting. Note that if you forget, you can always flash it later using fastboot.

On your computer:
  • adb to access your phone recovery, push files to SDCard, reboot...
  • [Optional] fastboot. You will only need fastboot if you mess up your recovery partition.

WHAT IF SOMETHING GOES AWFULLY WRONG?

You may ďbrickĒ your phone. Apparently itís near impossible to hard brick your Find5, though. See below.

First, Anders recommends making a backup of your partition table. I didnít because I felt that if I messed something up, it would be a partitionsí content rather than the partition table but thatís not the wisest approach.
Furthermore, if you are really worried about what stilly error your fat fingers will cause (I know I should be!) you can also backup your partitions.

Backing up your partition table:

On your phone:
Code:
gdisk -b /sdcard/gpt.bin /dev/block/mmcblk0
Backing up a single partition:

On your phone:
Code:
dd if=/dev/block/mmcblk0p<partition id> of=/sdcard/backup-<partition id>.bin
On your computer:
Code:
adb pull /sdcard/gpt.bin
adb pull /sdcard/backup-<partition id>.bin
LAST RESORT

OK. So, you've bricked your phone. Now what?
First, you will need Windows. So if you're on a Mac or Linux and have no access to a Windows machine/VM, er..don't brick your phone.

  1. - Download drivers and tools
  2. - Download and follow the instructions


READY ? LET'S GET STARTED


>>>>>>>>>>>> First, Download The Files <<<<<<<<<<<<

Then...

On your computer:
UPDATE As dixxa pointed out, mke2fs and tune2fs may already be present on your device. It was not the case for me but you should check first; it seems like a good idea to use existing binaries.
Code:
adb reboot recovery
adb push parted /sbin
adb push mke2fs /sbin
adb push tune2fs /sbin
On your phone:
Code:
chmod 755 /sbin/parted /sbin/mke2fs /sbin/tune2fs

umount /cache
umount /sdcard
umount /emmc
umount /data

parted /dev/block/mmcblk0
You are now in the parted shell.
CAREFUL! Do not delete any partition below 20 or you will enter "Big Oops" territory. I recommend typing carefully and, yes, staying away from copy/paste operations that may swallow a character like, say, the '2' in '20'

Note that the size value I am using here is '4GB' for /userdata (rather than 2GB). I guess you could make /userdata bigger than 4GB, in which case you would have to recompute all the offsets in the commands below(!)

Code:
# rm sdcard
rm 29
# 28 thru 23 are reserved
rm 28
rm 27
rm 26
rm 25
# rm recovery
rm 24
# rm misc
rm 23
# rm cache
rm 22
# rm persist
rm 21
# rm data/emmc
rm 20

# now, re-create partitions but data is bigger
mkpart primary 1325 5421
name 20 userdata
mkpart primary 5421  5430
name 21 persist
mkpart primary 5430  5967
name 22 cache
mkpart primary 5967  5968
name 23 misc
mkpart primary 5968  5979
name 24 recovery
mkpart primary 5979  6012
name 25 reserve1
mkpart primary 6012  6019
name 26 reserve2
mkpart primary 6019 6028
name 27 reserve3
mkpart primary 6028 6062
name 28 reserve4
mkpart primary 6062MB  100%
name 29 sdcard
# exit parted shell
q
Let's create a file system on the partitions that require one. Note that I am formatting the SDCard using VFAT as, yes, EXT4 is a better FS, but it is also incompatible with Oppo's ROM and some apps may not require the proper permissions etc.

Code:
# Notes:
# -m 0: no reserved blocks
# -c 0: no max mount count
# -C -1: no mount count
# -i -1: max_int interval between checks
mke2fs -t ext4 -m 0 -L userdata /dev/block/mmcblk0p20
tune2fs -c 0 -i -1 -C -1 /dev/block/mmcblk0p20
mke2fs -t ext4 -m 0 -L persist /dev/block/mmcblk0p21
tune2fs -c 0 -i -1 -C -1 /dev/block/mmcblk0p21
mke2fs -t ext4 -m 0 -L cache /dev/block/mmcblk0p22
tune2fs -c 0 -i -1 -C -1 /dev/block/mmcblk0p22
# Hey look itís an ext4 SDCard!
mke2fs -t ext4 -m 0 -L sdcard /dev/block/mmcblk0p29
tune2fs -c 0 -i -1 -C -1 /dev/block/mmcblk0p29
# Actually to avoid errors like unable to write to root of sdcard:
mkdosfs -n sdcard -F 32 /dev/block/mmcblk0p29
mount -t vfat /dev/block/mmcblk0p29 /sdcard
At this point, we have clobbered the /persist partition and this could cause issues as mentioned earlier. Let's restore it.

Code:
# Restore /persist partition
mount -t ext4 /dev/block/mmcblk0p29 /sdcard
# On computer
adb push mmcblk0p21_persist_ext4.img /sdcard/
# On phone
dd if=mmcblk0p21_persist_ext4.img of=/dev/block/mmcblk0p21
IMPORTANT! Flash your recovery partition now. If you wait until after rebooting, you will need to use fastboot instead.

Code:
# Recovery partition: on computer
adb push openrecovery-twrp-2.6.3.0-find5-TP-patch.img /sdcard/
# On phone
dd if=openrecovery-twrp-2.6.3.0-find5-TP-patch.img of=/dev/block/mmcblk0p24
Admire your work
Code:
parted /dev/block/mmcblk0 print
Reboot into your new recovery and install your favorite ROM

FAQ

Q: Is this dangerous?
A: Yes. Yes, it is.

Q: Any tip?
A: Yes. Follow these instructions carefully and if something wrong happens, unless you know what you are doing, leave your device alone and come here to ask for help.

Q: Can I hold you responsible for any damage to my phone/etc?
A: As usual, the answer is 'No'

Q: I found an error in your write-up!
A: Please let me know immediately.

-Chris.
Last edited by cyansmoker; 9th February 2014 at 12:17 PM.
The Following 8 Users Say Thank You to cyansmoker For This Useful Post: [ View ]
13th January 2014, 09:51 AM   |  #2  
RyuKurisu's Avatar
Member
Thanks Meter: 2
 
32 posts
Join Date:Joined: Jan 2013
You should probably use the latest TWRP 2.6.3.1 found here: http://techerrata.com/file/twrp2/fin....3.1-find5.img
The Following User Says Thank You to RyuKurisu For This Useful Post: [ View ]
13th January 2014, 04:14 PM   |  #3  
anders3408's Avatar
Recognized Developer / Contributor
Flag Jerslev
Thanks Meter: 1,203
 
1,667 posts
Join Date:Joined: Dec 2009
More
Looks good to me. Just be very carefully doing this.

Sent from my Find 5 using xda app-developers app
14th January 2014, 10:20 AM   |  #4  
dixxa's Avatar
Senior Member
Flag Neuilly-Plaisance
Thanks Meter: 12
 
349 posts
Join Date:Joined: Jul 2007
More
gdisk -b /sdcard/gpt.bin /dev/block/mmcblk0

those commands need to be typed in recovery even that one ?
15th January 2014, 10:37 AM   |  #5  
OP Recognized Developer
Flag Los Angeles
Thanks Meter: 617
 
494 posts
Join Date:Joined: Sep 2010
Donate to Me
More
Yes although I imagine this particular command should also work when booting system.

Sent from my Find 5 using Tapatalk
6th February 2014, 12:26 PM   |  #6  
dixxa's Avatar
Senior Member
Flag Neuilly-Plaisance
Thanks Meter: 12
 
349 posts
Join Date:Joined: Jul 2007
More
This thread is fine the only problem here is with those 2 binaries: mke2fs and tune2fs
You don't need to push them or chmod them since they are already in the recovery
Except that that thread is perfect.
2nd March 2014, 04:09 PM   |  #7  
Magissia's Avatar
Senior Member
Flag 127.0.0.1
Thanks Meter: 210
 
888 posts
Join Date:Joined: May 2012
More
Since we're at toying with partition, can't we merge the partitions in some way ?
4th March 2014, 09:08 AM   |  #8  
Senior Member
Flag Bacau
Thanks Meter: 112
 
330 posts
Join Date:Joined: Mar 2010
More
Just wondering is there any way to build a script to do this in an automated way thus avoiding user errors and typos?
22nd March 2014, 02:41 PM   |  #9  
forthenext24hours's Avatar
Junior Member
Thanks Meter: 2
 
13 posts
Join Date:Joined: Feb 2011
More
Hello everyone,
is the guide for the 32 or 16 gb model?
I have 16 gb Oppo find 5.
Thanks.

PS: what "on your phone" is supposed to mean"?
23rd March 2014, 11:38 AM   |  #10  
dixxa's Avatar
Senior Member
Flag Neuilly-Plaisance
Thanks Meter: 12
 
349 posts
Join Date:Joined: Jul 2007
More
There is a thread on the oppo forums
http://www.oppoforums.com/threads/gu...d-5-32gb.8361/

Quote:

Hello everyone,
is the guide for the 32 or 16 gb model?
I have 16 gb Oppo find 5.
Thanks.

PS: what "on your phone" is supposed to mean"?

If you don't know what does that mean don't do it you'll screw your phone.

The Following User Says Thank You to dixxa For This Useful Post: [ View ]
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes