How To: Re-partition Your Android Tablet Or Smartphone? (All Options Included: Change Size, FS Type, Etc…)

Updated Mar 18, 2017How To's


Let’s pretend you want to resize your partitions in order to lend some space from your internal storage to the System and Data partitions.

Note: the images below also include errors I got so that you could learn from my mistakes as well.

1. So, the first thing you should do is reboot your device into “Recovery mode“.

Android repartition: Go into Recovery mode

Go into Recovery mode

2. Once there, open up your CLI (Command Line Interface) tool such as Terminal or CMD and issue:

adb root” – in order to start adb as root user.

Then, “adb shell” – in order to access the device shell.

Note: as mentioned on the previous page, you may need to specify the full path to adb, e.g: C:\Program Files(x86)\Android\android-sdk\platform-tools\adb root.

Android repartition: Start adb in root and go inside its shell

Start adb in root and go inside its shell

3-a. Next, use “ls” command to see the files inside the root file-system directory, and then check whether parted is installed by issuing parted command.

In my case (image below), upon issuing “parted” I got a “not found” error. However, since partitioning my device in the past, I know that my partition table uses GPT table – therefore parted is a necessity for me.

Android repartition: parted not found error

parted not found error

3-*. It may be a good idea to also check what tools are available to you on the device itself, so you might want to list the files inside sbin directory: ls sbin.

Android repartition: Found two important partitioning tools

Found two important partitioning tools

3-b. In case you don’t have parted pre-installed on your device, you may download parted from this guide (see previous page), then exit the shell by typing exit.

After downloading and extracting parted, use adb push to get parted inside your device like so: adb push PATH/TO/PARTED /.

Enter the shell again using adb shell.

Android repartition: Pushing parted into device

Pushing parted into device

Issue ls again to make sure parted is there.

Android repartition: make sure parted is there

make sure parted is there

* Tip: If you’re unsure about your device partition names, you can use a command that shows them: cat /proc/partitions.

Android repartition: Print partitions

display the partitions

As you can see, there’s mmcblk0 – which is the main block where all the partitions are stored.

And there are 12 partitions in total which uses the name format “mmcblk0” plus “p” and a number that represent them, such as: mmcblk0p1, mmcblk0p2, etc…

Blocks lie inside /dev directory in Linux (yes, Android is a variation of Linux). We will use the block we’ve found in order to re-partition the device.

4. In order to make sure you give parted the right parameter, go inside /dev directory: cd /dev.

And use find command to find the exact location of mmcblk0: find -iname mmcblk0.

Don’t forget to change parted user permissions by issuing: chmod 764 /parted – which gives you a permission to execute the program.

Android repartition: Change parted permissions

Change parted permissions

5. Finally, issue: /parted block/mmcblk0 (switch mmcblk0 with your device’s block name) to start the partitioning tool. (If you’re not inside /dev directory then use absolute path: /parted /dev/block/mmcblk0)

Use “p” to list the partitions inside parted.

Type “help” to see the commands available to you.

Android repartition: parted print partitions table

parted displays partitions table

Android repartition: parted help

Type ‘help’ for parted to display commands description

6. Since parted executes commands on the fly, from now on be super-careful regarding any command you issue!

Warning: the following procedure might break your device partition table if done improperly, and may render it non-bootable. Do NOT engage unless you know what you’re doing.

A short explanation regarding the relevant partitions:

  • Partition number 9 labeled FACTORYFS – is the “system” partition where all the operating system files are stored in.
  • Number 10 – DATAFS – is the “data” partition where all applications usually save their data.
  • Number 11 – UMS (USB Mass Storage) – is the internal storage partition where all the stuff such as: pictures, videos, etc, are stored in.

To resize those, you’ll have to delete them all and then assign different sizes – this is where a backup might become handy (I recommend copying all the files to your computer prior to erasing any partition).

After erasing and re-partitioning the available space, you should re-label the partitions with the same names (for compatibility sake) and create file systems (I prefer using ext4, however, if your device came with other specific file systems, it might be a good idea to stick to those).

So, how do we do it?

Here’s the sequence of commands with a following explanation:

(parted) rm 9
(parted) rm 10
(parted) rm 11

Will delete FACTORYFS, DATAFS and UMS respectively.

Parted: rm 9

Parted deletes the 9th partition (FACTORYFS)

(parted) unit b

Change the unit to bytes in order to be accurate as possible (for optimum sake).

(parted) p

Redisplay the partition table, this time showing size in bytes.

Parted: Change unit to bytes

Type ‘b’ to switch to unit sizes in bytes

(parted) mkpart primary 176160768 2071986687 [the first number is one byte bigger then the ending number of the previous partition which in this case is 8, the second number minus the first will determine the final size of the partition]
(parted) mkpart primary 2071986688 4456448511
(parted) mkpart primary 4456448512 15216934911

Creating the three partitions again after deleting them previously.

Parted: recreating the partitions

‘mkpart’ command recreats the partitions with your desirable size

Note the above numbers are just examples, you should use consecutive numbers between each new partition, under the limits of your device space of course.

(parted) name 9 FACTORYFS
(parted) name 10 DATAFS
(parted) name 11 UMS

Will re-label the partitions.

Parted: renaming the partitions

Parted: renaming the partitions

(parted) unit mb

(parted) p

Check to see that your partitions are having the size you wanted and then quit.

(parted) quit

Exit parted.

mke2fs -t ext4 /dev/block/mmcblk0p9
mke2fs -t ext4 /dev/block/mmcblk0p10
mke2fs -t ext4 /dev/block/mmcblk0p11

Assign ext4 file system type to each of the newly created partitions.

Assign ext4 file system type

Assign ext4 file system type

7. Lastly, while still in “recovery mode”, re/install the system files (using the device recovery options) and only then it should be safe to reboot the device.

Tip: adb sideload command might be useful at this point.

COMMENTS (beta 3)

Add your comment here...
nam 1 mons ago
Forvme,  system's number is 24 , cache is 25 ,  and userdata is 46 , how to extend from system to userdata ? Have a lot of other partitions
ksolowoniuk 1 mons ago
I'm trying to use parted on a Nexus 7 (grouper) 32GB but when I try to print I get:

/dev/block/mmcblk0: unrecognised disk label

Any Ideas? I'm running Android 7.1.2 and I'd like to install opengapps (stock) but I don't have sufficient space.
rvs 3 mons ago
Can we resize boot partition using this..
I want to increase the size of boot partition from data partition
Bad English 5 mons ago
Are u sure? Can i try this tutor in my experia d2212 ? i change my eMMC to 16gb but my partition can be read only 2gb on system n userdata (mmcblk0p22-24). Please.... 
Moshiur rahman 5 mons ago
I'm using a pc which has windows 10 as well as android. I wanna remove android and its related partitions and make the disk space available for windows. Can I do this from windows using diskpart command?
Vishla 6 mons ago
i've lost my system partitions.. i've a zenfone 5..... in twrp i'm facing the problem of cannot mount/system,cannot mount cache and cannot mount data... can i use this method to get my partitions back... also i've no os installed now on my phone... can you help me please?
Guest 5 mons ago Vishla
Factory reset your phone
Guest 3 mons ago Vishla
Reflash the stock rom or find a custom rom suitable on your device, this solves the issue.
Roland Giesler 10 mons ago
I can get into the Android shell, but parted doesn't want to play along as you show it should. Firstly, $ adb root adbd cannot run as root in production builds I can however got into my android shell and then "su root", will that do the same as "adb root"? # /data/local/tmp/parted /dev/block/mmcblk0 GNU Parted Using /dev/block/mmcblk0 Welcome to GNU Parted! Type 'help' to view a list of commands. (parted) p p Error: Can't have a partition outside the disk! What now?
Lili O. Sep '16
i get this /system/bin/sh: parted: not found how install parted i don't understand . Please your help
Karel Ondrka Sep '16
Hi guys. I am currently trying to solve problem with my HTC Wildfire S that suffers from low storage and "Google Play Servives has stopped" pops up all the time. I allready repartitioned the SDcard so I have plenty of space for user apps, but GPServices needs to be part of the system obviously, so resizing the /system seems to be innevitable. I am not a newbie to rooting and stuff but this is just above me. I walked through it quickly. I see there big Partitioning chapter but I can't recognize if there is anything about resize. I am not native English speaker, which does not help. Is there in the text also anything about simple resize? If it is even possible to it just that "simple"? If yes, which part please... If no, any ideas about solving this problem? Thanks for any response...
Michael Aug '16
Your provided URL for the RAR of Parted gives a 404. Did you build it yourself if so how? And could you please re-upload the file?
Liron Aug '16 Michael
The file is now downloadable
Michael Aug '16 Liron
Thank you very much.
pmarini01 Jul '16
Everything appears to be fine in my case, but when I try to 'rm' a partition I get nothing. No warning, no error but also no partition is removed. Any idea what's going on?
opocaj May '16
hello. I've been looking for this for a while too bad I'm stuck at installing parted
borekon Jun '16 opocaj
maybe you are not rooted and/or in your android distribution the mmcblk0 is not present or does not exist. This is a very generic tutorial and it is not complete

More In Android