[Xiaomi Redmi 3s Guides, News, & Discussion] Abhijeet Rajgor:
Reserved

sry for being so direct

here explanation for things that might didn't understood

->

Note: as much as I’d like to, I do not currently possess the resources to grant readers technical support. The guide itself, in the vast majority of cases should be sufficient help. For any individual issue please refer to online forums which are meant for that purpose.

Why Re-Partition?

If you’re here out of curiosity or any other reason than necessity, you may wonder: “why would anyone want to repartition a smartphone / tablet?”.

To answer, each person probably has their own reason, a couple of such I can think of are:

In the case of an upgrade, when there’s not enough space on one partition but others has aplenty.

When you don’t have enough space to install more apps – since your data partition is full – so you want to resize that partition.

Of course, some cases can be resolved via a more simple solution, however, if you want to deal with the problem directly and not just bypassing it – repartition is perhaps the best way to go.

In order to re-partition your device, basically, these are the steps you’ll need to make:

1. Connect your device to your PC.

2. Open up a command shell, on Windows you’d probably use CMD / PowerShell, on Mac / Linux – Terminal.

2-a. Reboot into recovery mode. (Optional, depends on the partition you plan to modify)

3. Use ADB to connect to your device.

4. Launch a partitioning software.

5. Start partitioning.

6. Reinstall any required system file in case you’ve deleted those and afterwards you may exit the shell and reboot your device.

Explaining The Steps

1. We use another machine, in this case our PC, in order to re-partition Android, because we want to have access to our Android system just in case something goes wrong during the partitioning, and also, since Android system cannot be run and resized at the same time.

2. This step is rather self explanatory. We must use a flexible tool that will assist us re-partitioning.

2-a. If you wish to modify any partition other than the recovery partition, I recommend booting into recovery mode in order to do so.

Being inside recovery mode wouldn’t interfere with the process as you may delete the system partition and its files. Furthermore, it might become handy in case you’ll need to reinstall Android system.

3. ADB is an official Android developers tool and it also happens to be the most suitable tool for the job at the moment.

5.

Since this step depends on what you’re actually intending to do with your device – it doesn’t say much, it is an open step, open for your decisions that is.

By typing the help command of your partitioning tool you’ll get a list of the options available to you. For example, these are a few of the options you’ll see in parted:

rm NUMBER – will delete a partition

mkpart – will create a partition

unit UNIT – will set unit type, for example “unit b” will set parted to use bytes, “unit gb” for Giga bytes, etc… (Tip: use bytes for maximum accuracy).

name NUMBER NAME – lets you name the partition (upon making any changes, don’t forget to name the partitions properly).

q – quit parted.

Important Things To Note:

fdisk executes your commands only when changes are saved whereas Parted executes them instantly.

fdisk may not fully support GPT partition table, thus in case yours is GPT, it’s recommended to use Parted instead.

6.

* Tip: If you’re unsure about your device partition names, you can use a command that shows them: cat /proc/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.

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.

************

From another thread different info

By default, Parted uses MB as the storage unit. To prevent possible unused space after repartitioning, we’ll use sectors as a unit instead.

Type

unit s

This’ll change to sectors.

Type

print

It’ll give a warning, just type

i

Then:

print free

At the top, you’ll see that the sector size is written. Write this number down somewhere. For my Android One 4GB, the sector size is 512 bytes.

Now, you need to understand what the list means. Each horizontal row shows the details of a partition.

The 1st column shows the partition number.

The 2nd column shows the start offset of that partition. That means that the partition starts at the location mentioned.

The 3rd column shows where the partition ends. Notice that each partition starts exactly 1 sector after the previous one ends.

The 4th column is obviously the size of the partition.

The 5th column is the file system used by the partition. If nothing is written in this column, that means that it’s a binary partition.

The 6th column is the partition name.

You’ll see that the sizes in that list are weird. They’re not in any standard unit you might know. That’s because we used sectors instead of megabytes. The ‘s’ after each number indicates that it’s in sectors. (You can use the default MB unit (1MB=1000 KB. 1KB=1000bytes), or the MiB unit (1MiB=1024 KiB), but that just might leave 1 or 2 MB of space unused. So, I’m using sectors).

Remember that 1 sector = 512 bytes for my phone.

There’s some free space at the top and bottom of the list. Leave that free space there. Do not make partitions using those.

To convert sectors to MiB or KiB:

1s = 512bytes (Use the sector size you wrote down previously for this step, it might not be 512 bytes for you)

1024 bytes = 1 KiB

1024 KiB = 1 MiB

1024 MiB = 1GiB

So, 4833280s = (4833280 x 512) B = 2474639360 B

= (2474639360 / 1024) KiB = 2416640 KiB

= (2416640 /1024) MiB = 2360 MiB

= (2360 / 1024) GiB = 2.30 GiB

We’ll use another terminal window with sizes in MiB now. So open another Parted prompt in a new terminal / command prompt window, but instead of

unit s,

this time, write

unit MiB

Type “print”, “i”, and “print free” again

Look at my 11th partition. Its size is 8MiB. I know that this logo partition doesn’t need more than 2 MiB. So, I’ll make it smaller.

When you make partitions smaller, all the data inside will be lost. So, we need to back up the partitions first.

Open a 3rd terminal window. Type

adb shell dd if=/dev/block/mmcblk0p11 of=/microSD/p11

The “dd” command copies bytes from the “if=” location, to the “of=” location. The internal storage is /dev/block/mmcblk0. The “p11” after that refers to the partition we are backing up. Notice that in the Parted list, “logo” has a partition number of “11”. So the general command to back up partitions is

adb shell dd if=/dev/block/mmcblk0p<partition_number> of=/microSD/p<partition_number>

From recovery, unmount all partitions except microSD and oem. Then back up partitions 11, and 13 from PC. We will copy the files from OEM instead of using dd. So type

adb shell mkdir /microSD/oem

adb shell cp –a /oem/ /microSD/oem

Go to /microSD/oem/oem/app with TWRP’s file manager, and delete everything there.

Open the 1st terminal with sizes in sectors.

Type

rm 11

This will delete the oem partition. Type

print free

.