Affichage des articles dont le libellé est partitioning. Afficher tous les articles
Affichage des articles dont le libellé est partitioning. Afficher tous les articles

dimanche 16 août 2015

SD card partitioning



I have a 128 gb sd card that im using with my s5. Partitioning was easy enough, but as I was following a tutorial, I only made my partition 2.6 GB. Can I afford to make a larger partition? IE: 15 GB? Whats a recommended size for my SD card? Thanks!



jeudi 13 août 2015

Flashing and Partitioning Xiaomi MI2S running MIUI6



After upgrading from MIUIv4 to v6, I've discovered that the new version comes with a bootloader that
  • reflashes the recovery partition each time it's run with the stock recovery, which makes it impossible to use a custom recovery in order to install unsigned .zip patches,

  • doesn't support download mode, which makes it impossible to connect the phone to a computer as a block device and repartition it.

Since resolving this wasn't completely trivial (to me) and required a bit of research, I took some notes for future reference. I decided to compile these notes into a guide in hope that someone will find it useful. Keep in mind that while I do have technical background, I'm not intimately acquainted with the inner workings of Android and there was some trial and error involved. As a result, some steps may be too heavy-handed or even unnecessary and I therefore encourage comments.

Prerequisites
The guide presumes one has the adb, fastboot and parted binaries installed on a (presumably un*x) box, which enables access to block devices via the filesystem. For most users, that means a linux box.

List of files
  • xiaomi.eu_multi_aries_5.8.6_v6-5.0.zip – The MIUI6 v5.8.6 Czech ROM. Downloaded from [5].

  • emms_appsboot.mbm – A fixed bootloader for MIUI6 v5.8.6, which allows for the installation of recoveries other than the

  • built-in one (see Reinstalling the recovery). Downloaded from [2].

  • recovery-clockwork-6.0.5.0-aries-20140718.img – A recovery image of a custom version of the clockworkmod. Extracted from the archive downloaded from [1].

  • cm-11-20150802-NIGHTLY-aries.zip – An alternative ROM (Cyanogenmod 11). downloaded from [6].


Download mode
Booting into download mode appears to be disabled in MIUI6 v5.8.6. You will therefore need to boot into a custom recovery (see Booting into a custom recovery mode) and flash an alternative ROM (it would likely suffice to flash only certain partitions?):

Code:


$ adb push cm-11-20150802-NIGHTLY-aries.zip /storage/sdcard0

To boot into the download mode with an alternative ROM, consult [3] or run adb reboot dload against the phone in the system or in the recovery mode.

Repartitioning the internal flash memory
In my experience, the default size of the /system partition is insufficient to accommodate all the system applications along with the ever-growing Google Apps. The original inspiration came from [4]. To adjust the partition sizes, I used the parted command-line tool, since it comes with full support for GPT partitions and labels. Gparted used, but (as of v0.19.0-2) appeared to be much slower compared to parted and didn't seem to fully support GPT partition labels. Keep in mind that, unlike gparted, parted applies the changes to the block device immediately. Proceed with caution.

Before starting, it's best to backup the current partition table for a reference:

Code:


# gparted /dev/sdc
GNU Parted 3.2
Using /dev/sdc
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) unit MiB
(parted) print
Number  Start      End        Size      File system  Name      Flags
 1      0,02MiB    85,0MiB    85,0MiB  fat16        modem    msftdata
 2      85,0MiB    170MiB    85,0MiB  fat16        modem1    msftdata
 3      170MiB    171MiB    0,50MiB                sbl1
 4      171MiB    171MiB    0,50MiB                sbl2
 5      171MiB    172MiB    1,00MiB                sbl3
 6      172MiB    173MiB    1,00MiB                rpm
 7      173MiB    174MiB    1,00MiB                tz
 8      174MiB    175MiB    0,50MiB                DDR
 9      175MiB    179MiB    4,00MiB                aboot
10      179MiB    180MiB    1,00MiB                misc
11      180MiB    182MiB    2,85MiB                logo
12      182MiB    183MiB    0,76MiB                m9kefs1
13      183MiB    184MiB    0,76MiB                m9kefs2
14      184MiB    184MiB    0,00MiB                m9kefsc
15      184MiB    192MiB    8,11MiB                bk1
16      192MiB    193MiB    0,76MiB                m9kefs3
17      193MiB    256MiB    63,2MiB                bk2
18      256MiB    271MiB    15,0MiB                boot
19      271MiB    286MiB    15,0MiB                boot1
20      286MiB    301MiB    15,0MiB                recovery
21      301MiB    312MiB    11,0MiB                bk3
22      312MiB    320MiB    8,00MiB  ext4        persist
23      320MiB    832MiB    512MiB    ext4        system
24      832MiB    1344MiB    512MiB    ext2        system1
25      1344MiB    1728MiB    384MiB    ext4        cache
26      1728MiB    5312MiB    3584MiB  ext4        userdata
27      5312MiB    29820MiB  24509MiB  ext4        storage


Mind that /dev/sdc refers to the block device of my phone and will differ on your system depending on the amount of other block devices connected and the type of your system. It's also best to backup either the entire block device (/dev/sdc) or at last the specific partitions you are going to be messing with (/dev/sdcXY) – this is doubly important for partitions <= 22, the correct content of which may be difficult to retrieve when damaged. Labels (most likely) aren't important, the partition numbers are, so make sure you keep their order when fiddling with them.

After finishing, reconnect the phone to make the kernel recognize the new partition structure and create the filesystem (mkfs.ext4) for any partitions you have created. The following example makes the system and system1 partitions 1GiB each and the userdata partition 4GiB at the expense of the storage partition:


Code:


# parted /dev/sdc
GNU Parted 3.2
Using /dev/sdc
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) rm 23
(parted) rm 24
(parted) rm 25
(parted) rm 26
(parted) rm 27
(parted) mkpart physical ext4 320MiB 1344MiB
(parted) mkpart physical ext4 1344MiB 2368MiB
(parted) mkpart physical ext4 2368MiB 2752MiB
(parted) mkpart physical ext4 2752MiB 6848MiB
(parted) mkpart physical ext4 6848MiB 29819MiB
(parted) name 23 system
(parted) name 24 system1
(parted) name 25 cache
(parted) name 26 userdata
(parted) name 27 storage
(parted) quit
# sync


And then, after reattaching the phone to the computer:


Code:


# for i in /dev/sdc2[34567]; do mkfs.ext4 $i; done
# sync


Recovery mode
For booting into recovery, consult [3].

Booting into a custom recovery
Use the process described at [2], with steps 7-8 interchanged with 9-10. I used the emms_appsboot.mbm and recovery-clockwork-6.0.5.0-aries-20140718.img files (see List of files) from the fastboot mode as follows:


Code:


$ fastboot flash recovery recovery-clockwork-6.0.5.0-aries-20140718.img
$ fastboot flash aboot emmc_appsboot.mbn
$ fastboot boot  recovery-clockwork-6.0.5.0-aries-20140718.img


If the phone gets stuck at booting during the last step, restart the phone and try again.

You should now be in the custom recovery. For me, this only lasted until a reboot. Then, the recovery was replaced with the stock one and it became impossible to boot into the system, effectively softbricking the phone. To fix this, flash the stock emmc_appsboot.mbm bootloader image extracted from the .zip of the MIUI ROM you are using and flash it from the fastboot mode:


Code:


$ fastboot flash aboot ./the/original/emmc_appsboot.mbn
$ fastboot continue


Booting into fastboot mode
To boot into the fastboot mode, either:
  • Reboot the phone while holding the volume down button.

  • Run adb reboot bootloader against the phone in the system or in the recovery mode.


Links
  1. [2014-07-08] ClockworkMod Recovery 6.0.5.0

  2. [Tools, Tips & Tutorials] [Device Team] How to get Custom Recoveries working again on Mi 2/2S with MIUI 6

  3. [Tips & Tutorials] [Mods' Insight] Understanding Recovery mode & Download Mode

  4. [SCRIPT] Fix partition table for Android 4.4

  5. MIUIV6 OFFICIAL RELEASE

  6. Browse Files for Samsung Galaxy S - aries