Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,805,635 Members 38,712 Now Online
XDA Developers Android and Mobile Development Forum

[HOW-TO][ROOT][4NOOBS] Resize sdcard0 and internal storage to maximize space for apps

Tip us?
 
bsined
Old
(Last edited by bsined; 17th April 2014 at 01:56 AM.)
#1  
bsined's Avatar
Senior Member - OP
Thanks Meter 88
Posts: 203
Join Date: Mar 2013
Location: Washington, DC
Database [HOW-TO][ROOT][4NOOBS] Resize sdcard0 and internal storage to maximize space for apps

Ever since I bought my Xperia TL (LT30at), I've been upset at the ridiculous allocation of onboard memory: only 1.97GB were available for apps. The rest was allocated to an emulated external SD card, which meant that any app installed on it would lose widgets and suffer from other weird glitches on reboot. I've searched all over the place and couldn't find a solution until @teidus shared his method (per my research, it has been used on older devices from other manufacturers as well). I tried it and adjusted the steps to ensure 100% compatibility with my phone (and added explanations so that other devices could be tested).

See proof in the attached screenshots.

WARNING: You will lose a lot of data if you don't follow this guide!

WARNING: These operations require a rooted device. If you are running unrooted Android 4.3 or newer, you cannot proceed.

NOTE: All of these changes will be reversed if you flash an FTF that includes partition-image.sin.

DISCLAIMER: I'm not responsible for bricked devices and data loss from power surges, hardware damage, or changes to the linked software. Always check the native manuals for all the tools listed here!

Required Downloads:
1. Flashtool, which includes ADB (got questions about it? - ask them here) - requires installation

2. @[NUT]'s dual XZDualRecovery. I'm linking to v2.7.94 BETA installer. If you wish to check for a more recent version, go to his download page and do a page search (CTRL+F) for XT-lockeddualrecovery[version-goes-here].installer.zip. (got questions about it? - ask them here) - unzip to a location you'll remember (say, C:\xperia-resize\recovery\)

3. FTF with your phone's 4.1.2 firmware - save it to the default Flashtool firmware directory (C:\flashtool\firmwares\)

4. File system utilities (attached) - unzip to a location on your phone's physical SD card you'll remember (say, fs-utils\)
The Guide (skip all the way to the bottom for the short guide if you know how to backup and flash FTFs):

1. Back up all data stored on internal storage:
Option 1: Connect your phone to the computer and save it to a computer drive.
Option 2: Open a file manager on the phone and copy it to a physical SD card (/sdcard1).
2. Back up your current installation with either Online Nandroid or your current recovery and remove the SD card for safety.

3. Flash your phone with basic 4.1.2 install.
3.1 Turn off the phone.

3.2 Launch Flashtool.

3.3 Click the thunderbolt icon on the left and select Flashmode.

3.4 Select the appropriate 4.1.2 FTF from the list (it'll be there if you saved it to c:\Flashtool\firmwares\).

3.5 Tick "No final verification" checkbox on the right, click Flash, and when prompted, hold the VOLUME DOWN button, and connect the phone to the computer. The operation will take about 10 minutes. DISREGARD THE INSTRUCTIONS IN THE ANIMATION. Xperia T/TL doesn't have a hardware Back button.


3.6 When flashing is complete, boot the phone.
4. Connect your phone to the computer and let the computer recognize it.

5. Enable USB debugging.
5.1 Go to (System) Settings -> Developer options and flip the switch in the top-right corner of the screen.

5.2 Look a bit down (toward the middle of the screen) and check USB debugging.
6. Install the dual recovery.
6.1 Go to the location on your computer where you extracted dual recovery (e.g., C:\xperia-resize\recovery\).

6.2 Double-click install.bat.

6.3 Press 3 on your keyboard for the option 3. Installation on unrooted ROM.

6.4 Follow the instructions on your computer's screen.

6.5 When you will try to reboot the phone back into Android, the recovery will prompt you to root the OS. Do that.
7. Boot into PhilZ Touch recovery by opening App Drawer, starting NDR Utils, and selecting the appropriate option.

8. When the phone boots into recovery, connect it to the computer.

9. Start ADB.
If you don't know where ADB is, press WIN + R on your computer keyboard, type cmd in the pop-up window, hit ENTER, then copy & paste this command (paste by right-clicking the command prompt window): cd C:\Flashtool\x10flasher_lib. Then type adb shell and hit ENTER again.
10. Execute the following commands one-by-one (you can copy & paste, hit enter, and wait for the output):
Code:
umount /storage
parted /dev/block/mmcblk0
print
These commands unmount all drives, launch parted utility for mmcblk0 (onboard flash storage), and show the partition table.
11. Record the beginning of the partition Userdata and the end of the partitionSDCard. These are the limits of your new partitions The numbers are in megabytes (MB) unless specified.
For Xperia T/TL, Userdata begins at 1621 and SDCard ends at 15.6GB. Xperia V (and any other device with less than 16GB of storage) will definitely have a different value.
12. Remove the last 2 partitions by executing the following commands:
Code:
rm 14
rm 15
13. Calculate the new end point for Userdata, which is also the new start point for SDCard:
1621 (or another number you recorded in step 11) + additional space = new end. I added 4GB (4 1024MB = 4096MB) so my new end point was 7865. I advise to add at least 2GB (2048MB) to feel safe about having enough storage for apps. DON'T TRY TO REMOVE SDCARD ALTOGETHER BY ALLOCATING ALL OF THE AVAILABLE SPACE TO USERDATA! Emulated storage is coded into OS environment and requires additional modifications to work properly.
14. Create and name new partitions by executing the following commands (don't copy the text in parentheses):
The system might throw several errors in the process. When prompted, just type ignore and hit ENTER.
Code:
mkpartfs logical ext2 1621 7865 (change the numbers as appropriate for your device)
name 14 Userdata
mkpartfs logical ext2 7865 15.6GB (change the numbers as appropriate for your device and notice the GB to make sure the partition extends to the end of the onboard storage)
name 15 SDCard
quit
These commands create the partitions with ext2 file system and given beginning and end parameters, rename them as required, and close parted.
15. "Damage" the internal, emulated SD card so that it could be formatted properly later.
Tap Mounts and storage -> Format /storage/sdcard0 -> default and confirm the operation.
16. Insert the physical SD card (sdcard1) that you removed in step 2 back into the device.
Make sure it's mounted by tapping Mounts and storage and checking its status (it should say unmount /storage/sdcard1/). If not, mount it by tapping on the appropriate option.
17. Execute the following commands one-by-one in the ADB command prompt:
Code:
cd /storage/sdcard1/fs-utils (the directory name will be different if you didn't follow my conventions)
tune2fs -j /dev/block/mmcblk0p14
tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p14
e2fsck -fpDC0 /dev/block/mmcblk0p14
These commands convert Userdata partition into the appropriate ext4 filesystem, which is not supported natively in the recovery environment.
18. Reboot the device into full Android.
18.1 Remove the physical SD card for safety.

18.2 Tap Back until you make it to the top level of recovery. Then tap the top option Reboot the device.
19. When Android loads fully, you'll notice a notification about storage file system. Tap it and follow the prompts to format it.

20. Insert the physical SD card and reboot into the recovery you used to create the backup in step 2 to restore it.
In PhilZ, that's Backup and Restore -> Restore from /storage/sdcard1.
21. Reboot back into full Android and copy the files saved from internal storage back into it. Then reboot again so that apps recognize the data.

DONE!

Short guide/list of ADB commands and other events (*enclosed in asterisks*) if you know the safety drill:
 
Code:
*flash 4.1.2 & install dual recovery*
*boot into PhilZ Touch*
adb shell
umount /storage
parted /dev/block/mmcblk0
print
*record start point of Userdata and end point of SDCard*
rm 15
rm 14
mkpartfs logical ext2 1621 7865
name 14 Userdata
mkpartfs logical ext2 7865 15.6GB
name 15 SDCard
*Mounts and storage -> Format /storage/sdcard0 -> default -> confirm*
*insert physical SD card*
*Mounts and storage -> Mount /storage/sdcard1*
cd /storage/sdcard1/fs-utils
tune2fs -j /dev/block/mmcblk0p14
tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p14
e2fsck -fpDC0 /dev/block/mmcblk0p14
*remove physical SD card*
*reboot*
*format emulated SD card*
*reboot recovery*
*restore backup*
*reboot*
*restore sdcard0/*
*reboot*

Attached Thumbnails
Click image for larger version

Name:	2014-04-10_015902.png
Views:	1638
Size:	180.3 KB
ID:	2678067   Click image for larger version

Name:	2014-04-10_015912.png
Views:	1324
Size:	184.3 KB
ID:	2678068   Click image for larger version

Name:	2014-04-10_015919.png
Views:	1140
Size:	185.4 KB
ID:	2678069   Click image for larger version

Name:	2014-04-10_015927.png
Views:	1045
Size:	205.1 KB
ID:	2678070  
Attached Files
File Type: zip fs-utils.zip - [Click for QR Code] (431.3 KB, 104 views)
I do UX design - PM me for information architecture & workflow help.

People like when you THANK them.

My open questions:
Why do many developers host their downloads on spammy file hosting sites?

My devices:
Sony Xperia TL on PureXT 4.3
HP TouchPad 32GB on JCSullins's CM11
Microsoft Surface 2 RT 32GB

My guides:
Upgrading Xperia TL to 4.3 to keep root, data, and LTE
Resizing internal partitions on Xperia T/TL/V (and others)
The Following 29 Users Say Thank You to bsined For This Useful Post: [ Click to Expand ]
 
raghulrr
Old
#2  
Junior Member
Thanks Meter 5
Posts: 5
Join Date: Mar 2013
nice, i was looking for a way to increase the /data after switching to Omni and ART

Will try ASAP..

PS: i think this thread should be added in ALL IN ONE THREAD Section
 
bsined
Old
#3  
bsined's Avatar
Senior Member - OP
Thanks Meter 88
Posts: 203
Join Date: Mar 2013
Location: Washington, DC
Quote:
Originally Posted by raghulrr View Post
PS: i think this thread should be added in ALL IN ONE THREAD Section
That's a request to @gregbradley.
I do UX design - PM me for information architecture & workflow help.

People like when you THANK them.

My open questions:
Why do many developers host their downloads on spammy file hosting sites?

My devices:
Sony Xperia TL on PureXT 4.3
HP TouchPad 32GB on JCSullins's CM11
Microsoft Surface 2 RT 32GB

My guides:
Upgrading Xperia TL to 4.3 to keep root, data, and LTE
Resizing internal partitions on Xperia T/TL/V (and others)
 
norti
Old
#4  
norti's Avatar
Senior Member
Thanks Meter 141
Posts: 600
Join Date: Feb 2008
Location: Budapest
#6 would be the most welcomed way to resize partitions, but unfortunately it's not so easy as it was e.g. with ZTE Blade. But altogether it's good to know that you can resize them now! Thanks!
Xperia Z2 | 17.1.1.A.0.402 Telekom HU root
[FTF] STOCK FIRMWARES for Xperia Z2/Z2a (D65x3/D6502/SO-03F)

 
Phone history:
Siemens C25 (grey) -> Ericsson A1018s (blue) -> Ericsson R320 (blue) -> Ericsson T28s (grey) ->
Sony Ericsson T100 (white/blue) -> Sony Ericsson T630 (white) -> Sony Ericsson M600 (white) ->
Sony Ericsson Xperia X1 (silver) -> ZTE Blade (grey) -> Sony Xperia T (black)
-> Sony Xperia Z2 (black)
 
mohaxs
Old
#5  
mohaxs's Avatar
Senior Member
Thanks Meter 18
Posts: 104
Join Date: Dec 2013
nice tutorial brother... i'll be trying tommorow

Sent from S5J using Tapatalk
 
Harlock1978
Old
#6  
Junior Member
Thanks Meter 3
Posts: 14
Join Date: Jun 2013
Default Thanks

Thank you I was definetly looking for it

Thanks
 
Partitionator
Old
#7  
Senior Member
Thanks Meter 18
Posts: 103
Join Date: Sep 2011
@TO: I couldn't test ist but I think made a little mistake:
I think you want want to execute the programms wich are in the Directory in wich you made the cd. So you have to add ./ before each command.

I don't have such a device, to test it by myself: You said you have to make a new virtual SD. Some ROMes have a vold.fstab in /etc. Mayby it't enough to change this file to be able to remove the SD Partition completly.
 
bsined
Old
#8  
bsined's Avatar
Senior Member - OP
Thanks Meter 88
Posts: 203
Join Date: Mar 2013
Location: Washington, DC
Quote:
Originally Posted by Partitionator View Post
@TO: I couldn't test ist but I think made a little mistake:
I think you want want to execute the programms wich are in the Directory in wich you made the cd. So you have to add ./ before each command.

I don't have such a device, to test it by myself: You said you have to make a new virtual SD. Some ROMes have a vold.fstab in /etc. Mayby it't enough to change this file to be able to remove the SD Partition completly.
I was writing the guide as I was executing commands so everything is exactly as I entered it. I obviously removed all steps that turned out to redundant and wrong.
I do UX design - PM me for information architecture & workflow help.

People like when you THANK them.

My open questions:
Why do many developers host their downloads on spammy file hosting sites?

My devices:
Sony Xperia TL on PureXT 4.3
HP TouchPad 32GB on JCSullins's CM11
Microsoft Surface 2 RT 32GB

My guides:
Upgrading Xperia TL to 4.3 to keep root, data, and LTE
Resizing internal partitions on Xperia T/TL/V (and others)
The Following User Says Thank You to bsined For This Useful Post: [ Click to Expand ]
 
metaljoker
Old
(Last edited by metaljoker; 13th April 2014 at 09:33 AM.)
#9  
metaljoker's Avatar
Senior Member
Thanks Meter 24
Posts: 210
Join Date: Jul 2009
Location: Jeddah
Will that work with the Xperia Arc S?!
What is the difference between your method and the [MOD]{CM10.1}{CM10.2}{CM11}{AOSP}Working Int2Ext for Xperia 2011 [ART-compatible]?
 
bsined
Old
#10  
bsined's Avatar
Senior Member - OP
Thanks Meter 88
Posts: 203
Join Date: Mar 2013
Location: Washington, DC
Quote:
Originally Posted by metaljoker View Post
Will that work with the Xperia Arc S?!
What is the difference between your method and the [MOD]{CM10.1}{CM10.2}{CM11}{AOSP}Working Int2Ext for Xperia 2011 [ART-compatible]?
These are some great questions! This approach is very different from all Int2Ext scripts:
  1. HUGE NOTE: This works only for devices where the onboard NAND capacity is at least 8GB. That means that 2011 devices with 1-4GB of onboard memory are better off with mounting the physical SD card as /data.
  2. This is a semi-permanent modification to the partition table (it'll work fine if you do factory reset and flash a new ROM .zip but the allocation will be reset every time you flash FTF, possibly even if you exclude partition-image because each .sin contains its offset and size bits).
  3. This approach is compatible with locked bootloaders because support of init.d comes from the kernel.
  4. This approach allows you to allocate as much or as little of onboard NAND storage to each of the 2 partitions (/data and /storage/sdcard0) used for storing apps and their data instead of just allocating the entire physical SD card.
  5. This approach allows you to live a life independent of your physical SD card (i.e., your apps still work and your phone boots up just fine even if the physical SD card dies).
I do UX design - PM me for information architecture & workflow help.

People like when you THANK them.

My open questions:
Why do many developers host their downloads on spammy file hosting sites?

My devices:
Sony Xperia TL on PureXT 4.3
HP TouchPad 32GB on JCSullins's CM11
Microsoft Surface 2 RT 32GB

My guides:
Upgrading Xperia TL to 4.3 to keep root, data, and LTE
Resizing internal partitions on Xperia T/TL/V (and others)

The Following User Says Thank You to bsined For This Useful Post: [ Click to Expand ]
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes