Is it possible to resize partitions?
Yes, it is theoretically possible, but it may not work on your device. If you're ready to take a risk with your device (if something goes wrong, it may be bricked until you find what's wrong with it), go ahead. Also, this modification isn't recommended for beginners. Also notice that by this you will factory reset your device (all app data will be gone). You'll need:
- A rooted device with custom recovery
- Basic knowledge of how ADB works
- Basic knowledge of how partitions and partiton tables work
- Patience and time since this could (and will) probably have some obstacles since you're a beginner and these tutorials aren't made for your specific device.
I successfully resized my partition using this tutorial on XDA, however, I skipped some steps in the way, since they were directed at different devices (Xperia phones), therefore, not all steps are compatible.
This tutorial may not support your device, so proceed with caution
I will try to briefly summarize what is going on that tutorial.
What will we do:
- We will back up all the files present on the internal SD card (this is optional)
- We will delete
/sdcardpartition (that's internal, emulated "SD card"), and we will delete
/datapartition (that's where your phone data, including apps, is stored)
- We will then create new
/datapartitions, but this time, they will be resized so that you'd have more space for apps.
- If we backed up SD card earlier, we will now restore the original content of the internal SD
I assume you have worked with ADB and that you have a custom recovery present on your device (if you don't fulfil these requirements, get familiar with those before proceeding)
Okay, before we start, you'll need to download fs-utils.zip from this XDA page. These are file system utilities which we'll use later. Unzip this file and place it a folder, somewhere on the external SD card (e.g. /sdcard/fs-utils)
Also, enable "USB debugging" on your phone, located in "Developer Options" on more recent devices, or "Applications" on older devices.
Backing up files from Internal SD card (optional)
Okay, this one's pretty simple, you copy the files from internal memory to anywhere you want (i.e. PC, external SD card).
Editing the partition table
This is where it becomes tricky, so be sure that everything is working before starting this, and make sure that your phone has enough battery (just in case).
- Enter the recovery on your phone.
- Connect to ADB
Execute following commands
This should print out the partition table, like:
Number Start End Size File system Name Flags
1 131kB 2228kB 2097kB TA
2 2228kB 3801kB 1573kB Boot
3 3801kB 5374kB 1573kB Boot2
4 6291kB 27.3MB 21.0MB Kernel
5 27.3MB 28.3MB 1049kB TZ
6 29.4MB 32.5MB 3146kB modemst1
7 33.6MB 36.7MB 3146kB modemst2
8 37.7MB 40.9MB 3146kB fsg
9 40.9MB 46.1MB 5243kB ramdump
10 46.1MB 54.5MB 8389kB ext4 apps_log
11 54.5MB 71.3MB 16.8MB FOTAKernel
12 71.3MB 2120MB 2049MB ext4 System
13 2120MB 2620MB 500MB ext4 Cache
14 2620MB 5692MB 3072MB ext4 Userdata
15 5692MB 15.6GB 9942MB ext4 SDCard
In this example,
Userdata partition is on the 14th place, and
SDCard is in the 15th. Notice how the
Userdata starts at 2620MB, and ends at 5692MB, and
SDCard begins where
Userdata ends, and finishes at 15.6GB. Mark these numbers, as we'll use them when we create the new partitions.
Following this example, we will remove these partitions:
Now, we calculate new sizes of the new partitions. Notice: You need to have emulated SD Card on your system, don't completely remove it, it is hardcoded into the system, and removing could break the functionality of the device.
For example, if we want to increase the size of the
Userdata to 6000MB, we simply add 6000MB to 2620MB (where the partition starts), to get the position where the partition ends. In that case, it would end at 8620MB.
SDCard follows after the
Userdata, so it begins at 8620MB and ends at 15.6GB.
So, after calculating the sizes, we enter:
mkpartfs logical ext2 2620 8620 (change the numbers for your device)
name 14 Userdata
mkpartfs logical ext2 8620 15.6GB (again, change the numbers)
name 15 SDCard
Now, the space is allocated for these new partitions, but they aren't correctly formatted yet. So, in your recovery, format your internal SD card (sdcard0 or whatever it's called).
Now, in ADB, navigate to the folder on the external SD card, where the fs-utils are located:
cd /sdcard/fs-utils (change as appropriate)
After that, enter these commands, one by one:
tune2fs -j /dev/block/mmcblk0p14
tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p14
e2fsck -fpDC0 /dev/block/mmcblk0p14
Now, the partitions are formatted.
You can reboot the phone now.
Try to write something to the SDCard, just to check do you have write permissions on it, and if you don't, enter (via ADB):
chown -R 2800:2800 /mnt/media_rw/sdcard0
That should fix the problem.
After this, you can restore the backed up files to your SDCard.
Since this is my first community post, I encourage users to edit and expand this post as needed.