Hello,
I have facing problem with (for me) not very optimal partition layout of MI2S 16GB.
/data partition was too big (around 3GB of free space after all my applications installed) and /storage partition too small (9GB is not too much, few 1080p videos, offline GPS navigation maps, few MP3 albums and you are done).
So, I decided to change partition layout in this way - remove 2,5GB from /data and add them to /storage (/sdcard) partition.
If is somebody interested, here is how-to:
Prerequisites:
- CWM is installed and complete System1 backup is done
- connection to phone from PC over adb is functional in CWM
- OS backup with all other user data is copied to computer (whole internal storage)
Notice: /data and /sdcard partitions will be removed and re-created with new size, you have to restore all your data from the computer when finished
Characters after #(including #) are my comments, don't type them into adb command line!
command you have enter are marked red.
Preparation:
- copy content of partition_tools.zip into /system/bin and add executable attributes if necessary
- reboot phone into CWM, connect phone to PC
- connect to phone over adb and check if you are root (type "id") and also type "mount" to
verify that /system is mounted and ALL other "/dev/block/platform*" partitions are unmounted (/data*, /cache, /sdcard etc...), by default it's not and you have to:
- mount system partition:
mount /system
- umount cache partition:
umount /cache
- umount data partition(s): umount /data*
Finally it should looks like that:
~ #
mount
rootfs on / type rootfs (rw)
tmpfs on /dev type tmpfs (rw,nosuid,relatime,mode=755)
devpts on /dev/pts type devpts (rw,relatime,mode=600)
proc on /proc type proc (rw,relatime)
sysfs on /sys type sysfs (rw,relatime)
/dev/block/platform/msm_sdcc.1/by-name/system on /system type ext4 (rw,nodev,noatime,nodiratime,data=ordered)
If everything is OK, we can begin:
- in adb type:
parted /dev/block/mmcblk0 #this start "parted" and access the storage
unit MB #we set default unit of size to MB
print #this display actual partition layout, save this output in txt file!!!
#example of output:
Model: MMC SEM16G (sd/mmc)
Disk /dev/block/mmcblk0: 15.8GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
1 17.4kB 89.1MB 89.1MB fat16 modem
2 89.1MB 178MB 89.1MB fat16 modem1
3 178MB 179MB 524kB sbl1
4 179MB 179MB 524kB sbl2
5 179MB 180MB 1049kB sbl3
6 180MB 181MB 1049kB rpm
7 181MB 182MB 1049kB tz
8 182MB 183MB 524kB DDR
9 183MB 187MB 4194kB aboot
10 187MB 188MB 1049kB misc
11 188MB 191MB 2990kB logo
12 191MB 192MB 799kB m9kefs1
13 192MB 193MB 799kB m9kefs2
14 193MB 193MB 1024B m9kefsc
15 193MB 201MB 8501kB bk1
16 201MB 202MB 799kB m9kefs3
17 202MB 268MB 66.3MB bk2
18 268MB 284MB 15.7MB boot
19 284MB 300MB 15.7MB boot1
20 300MB 316MB 15.7MB recovery
21 316MB 327MB 11.5MB bk3
22 327MB 336MB 8389kB ext4 persist
23 336MB 872MB 537MB ext4 system
24 872MB 1409MB 537MB ext4 system1
25 1409MB 1812MB 403MB ext4 cache
26 1812MB 5570MB 3758MB ext4 userdata
27 5570MB 15758MB 10188MB ext4 storage
#because "parted" so far don't have support for ext4 FS resize, we must remove partitions 26 and 27
#and recreate them with different size from the scratch.
#still in the "parted" type:
rm 26 #this remove /data (userdata) partition
rm 27 #same with /sdcard (storage) partition
#now we create partitions back with new size
#(it's up to you to decide new sizes of partitions, in my case I have reduced /data by -2500MB
#and add them to /sdcard)
mkpartfs primary ext2 1812 3070 #new partition created, starting on 1812MB and ending on 3070MB
#=> size of the partition is: 3070 - 1812 = 1258MB (more then enough for my apps, I have still 568MB free in /data...
mkpartfs primary ext2 3070 15758 #in the same way we re-create storage partition
name 26 userdata #we have to set back partition labels
name 27 storage
quit
#now we convert new partitions to ext4:
tune2fs -j /dev/block/mmcblk0p26
e2fsck -fDp /dev/block/mmcblk0p26
tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p26
e2fsck -fDp /dev/block/mmcblk0p26
tune2fs -j /dev/block/mmcblk0p27
e2fsck -fDp /dev/block/mmcblk0p27
tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p27
e2fsck -fDp /dev/block/mmcblk0p27
#lets run "parted" again to do a final check:
parted /dev/block/mmcblk0
unit MB
print
#example of correct output:
Model: MMC SEM16G (sd/mmc)
Disk /dev/block/mmcblk0: 15758MB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
1 0.02MB 89.1MB 89.1MB fat16 modem
2 89.1MB 178MB 89.1MB fat16 modem1
3 178MB 179MB 0.52MB sbl1
4 179MB 179MB 0.52MB sbl2
5 179MB 180MB 1.05MB sbl3
6 180MB 181MB 1.05MB rpm
7 181MB 182MB 1.05MB tz
8 182MB 183MB 0.52MB DDR
9 183MB 187MB 4.19MB aboot
10 187MB 188MB 1.05MB misc
11 188MB 191MB 2.99MB logo
12 191MB 192MB 0.80MB m9kefs1
13 192MB 193MB 0.80MB m9kefs2
14 193MB 193MB 0.00MB m9kefsc
15 193MB 201MB 8.50MB bk1
16 201MB 202MB 0.80MB m9kefs3
17 202MB 268MB 66.3MB bk2
18 268MB 284MB 15.7MB boot
19 284MB 300MB 15.7MB boot1
20 300MB 316MB 15.7MB recovery
21 316MB 327MB 11.5MB bk3
22 327MB 336MB 8.39MB ext4 persist
23 336MB 872MB 537MB ext4 system
24 872MB 1409MB 537MB ext4 system1
25 1409MB 1812MB 403MB ext4 cache
26 1812MB 3070MB 1258MB ext4 userdata #userdata is smaller
27 3070MB 15758MB 12688MB ext4 storage #storage is bigger, good...
#now we can quit "adb" and in CWM menu remove dalvik cache and reboot the phone
#after fist boot we can connect phone to computer and copy our data back to /sdcard
# then we have to reboot to CMW and do an advanced restore to have user applications (/data) back.
# after that we can do a final reboot and enjoy new extended storage space
Good luck.
Hint: I have removed System1 partition and recreated it with size 16MB (no more dualboot) and also lower Cache partition size to 200MB to get more space for Storage, it works fine.