[REPARTITION] Nexus 7 (2013) Repartition [FLO/DEB] [16GB/32GB] [UA TWRP]


Senior Member
Sep 4, 2013
Nexus 7 (2013) Repartition​

No one is responsible for your actions except yourself. Everything written further may potentially brick your device, although risk is reduced to minimum.

This repartition package offers 1.5G /system; a /vendor partition and it is fully backward compatible with any ROM (including stock system.img).

- If repartition pack says that device isn't correct,
than, if partition table wasn't modified before,
congrats! your device has different memory chip
that those I worked with. No worry, PM me and
I'll add support for it.
DO THE BACKUPs. Repartition will erase all your data
USB connection to PC is MANDATORY else you will not have opportunity to push ROM to your device


# Before processing further we highly recommend you backup persist and EFS using adb
# Or you might lose your IMEI/WIFI + BT mac addresses

adb root
adb shell
dd if=/dev/block/mmcblk0p2 of=/sdcard/modemst1.img
dd if=/dev/block/mmcblk0p3 of=/sdcard/modemst2.img
dd if=/dev/block/mmcblk0p4 of=/sdcard/persist.img
Now you can find 3 *.img files at path /sdcard. Copy them to your PC since internal memory will be erased.

# This mod is backwards compatible with any ROM so we highly recommend NOT to reverse it if repartition went well.
# You should use ONLY recovery from this thread since other don't support all benefits of this mod.
# When installing ROM just after you flashed zip and before installing GAPPs you MUST make a resize in TWRP since all roms are build for ~800M system.
# Package is unified for flo and deb. To restore stock layout use same zip and steps as for repartition.

1. Boot into recovery (You need to allow system partition modification to be able resize /system in recovery).
2. Backup your data & Move your files from flash to your PC.
3. Flash repartition pack zip.
4. Do the actions asked by repartition pack (go to Terminal in ordinary recovery and input word that pack will tell you. Everything else will be done automatically).
5. Phone will reboot into recovery.
6. Install TWRP from below (it is build with support of new partitions layout and sizes. It can be differed from official TWRP by next format 3.x.x-1 UA).
7. Format everything. (mount errors will not affect formatting!)
    - In TWRP: Wipe > Format data
    - Type yes
    - Once this completes go to: Wipe > Advanced Wipe
    - Tick all the boxes and wipe. There should be no further mount errors. (Thanks [user=7694808]@mr_rubbish[/user] for corrections in formatting).
8. Install ROM which you like.
9. Enjoy better flash partition layout.
If something gone wrong - we recommend you NOT to do anything by yourself. Write here for help, else you may do only worse.

Repartitioning package
: GitHub

Special thanks to
- Unlegacy-Android team;
- Sudokamikaze;
- rlw6534 for Kingston MMC layout;
- surfrock66 for his gide for Nexus 5;

As usual, feedback is appreciated :)

XDA:DevDB Information
Nexus 7 (2013) Repartition, Tool/Utility for the Nexus 7 (2013)

Source Code: https://github.com/clamor95/android_device_unlegacy_recovery

Version Information

Created 2018-09-19
Last Updated 2019-01-18
Last edited:


Senior Member
Sep 4, 2013
Common issues and F. A. Q.

Repartition pack should be safe for most devices. Common mistakes, issues and their solution will be published here.

1. You shouldn't flash any internal parts of repartition pack (*.sh files) only flash whole zip using TWRP. You may use my scripts for personal use or projects but authorship should to be kept.

2. If something isn't mounting after repartition try to format partitions that don't mount using Wipe -> Advanced Wipe in TWPR. Ideally you should format in that way all partitions in Advanced Wipe menu (see 5-th step of installation guide).

3. If you want to be sure that repartition went well I enclose loging zip. Flash it after repartition (when device reboots into TWRP). It won't modify anything only generates a partition.log in root of internal storage and outputs your current partition layout to screen. You should check if your layout is same as those fragments I provide under spoiler (file systems doesn't matter). If there are any differences you have to describe what you did and enclose partition.log to your post.

22      671088640B   1551892479B   880803840B                 system
23      1551892480B  2139095039B   587202560B                 cache
22      614429696B   2187293695B   1572864000B                system
23      2187293696B  2270167039B   82873344B                  cache
30      2348843008B  2610987007B   262144000B                 vendor
4. After flashing most ROMs system size will reduce to stock, you need to resize /system in TWRP or use flashable resize zip for ROMs that support addon.d (automatic resize when dirty flashing updates).

5. After returning to stock partition table you won't be able to get into the Recovery from the bootloader anymore, but when you start the tablet normally it goes straight in the Recovery. It is normal state. New partition table proposes larger /recovery size (16MB) while stock gives only 10MB. During restoring stock process, it is impossible to restore larger recovery backup into new smaller partition. Whether not to leave user without recovery excess, recovery backup restores into /boot partition. Just flash ordinary TWRP and install ROMs from it.

6. Don't install the zip file from the USB OTG. Copy them into the /sdcard. Else you will get message after flashing repartition pack.
"Can not extract updater-script. Do you have it in package?
Updating partition details...
Last edited:


Senior Member
Jul 24, 2012
Clemson, SC
OK. Tried to flash on a clean, freshly wiped system (Flo 32G), all stock, ext4 on cache and Data, TWRP 3.2.3-0. Got the following:

******Applying dark magic******

This is not a Nexus 7 (2013)
Updater process ended with ERROR: 1
Last edited:


Senior Member
Oct 2, 2013
How to restore files, that we copied from our tablet using dd command ? (I haven't done anything yet. Just asking)

Sent from my whyred using XDA Labs


Senior Member
Sep 4, 2013
@lollyjay No it wasnt. Package has 2 step security system. It checks if partition table was modified and in what way (by package itself, by user or it is stock). Second step is that package itself doesn't modify anything, it needs manual confirmation in terminal, else no changes will be applied.
  • Like
Reactions: lollyjay


Senior Member
Jul 26, 2012
@lollyjay No it wasnt. Package has 2 step security system. It checks if partition table was modified and in what way (by package itself, by user or it is stock). Second step is that package itself doesn't modify anything, it needs manual confirmation in terminal, else no changes will be applied.
So do I NOT flash the modded twrp first?
Your instructions said to flash it after reboot to recovery
  • Like
Reactions: zentara


Senior Member
Jul 24, 2012
Clemson, SC
@rlw6534 Every manual repartition or repartition made not by my pack needs an individual look and partition table restore.

@lollyjay here
OK. Here is my partition layout. My userdata appears to be smaller than stock, but there isn't enough room on mmcblk0 to increase it to the size that your script is looking for. I have no idea how that could have been changed without bricking the tab. Everything else looks normal. Ideas?

Model: MMC MMC32G (sd/mmc)
Disk /dev/block/mmcblk0: 30937186304B
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start        End           Size          File system  Name      Flags
 1      67108864B    156745727B    89636864B     fat16        radio
 2      201326592B   204472319B    3145728B                   modemst1
 3      204472320B   207618047B    3145728B                   modemst2
 4      268435456B   283795455B    15360000B     ext4         persist
 5      335544320B   336343039B    798720B                    m9kefs1
 6      336343040B   337141759B    798720B                    m9kefs2
 7      402653184B   403451903B    798720B                    m9kefs3
 8      403451904B   406597631B    3145728B                   fsg
 9      469762048B   471298047B    1536000B                   sbl1
10      471298048B   472834047B    1536000B                   sbl2
11      472834048B   474931199B    2097152B                   sbl3
12      474931200B   480174079B    5242880B                   aboot
13      480174080B   480698367B    524288B                    rpm
14      536870912B   553648127B    16777216B                  boot
15      603979776B   604504063B    524288B                    tz
16      604504064B   604505087B    1024B                      pad
17      604505088B   606041087B    1536000B                   sbl2b
18      606041088B   608138239B    2097152B                   sbl3b
19      608138240B   613381119B    5242880B                   abootb
20      613381120B   613905407B    524288B                    rpmb
21      613905408B   614429695B    524288B                    tzb
22      671088640B   1551892479B   880803840B    ext4         system
23      1551892480B  2139095039B   587202560B    ext4         cache
24      2147483648B  2148532223B   1048576B                   misc
25      2214592512B  2225078271B   10485760B                  recovery
26      2281701376B  2281709567B   8192B                      DDR
27      2281709568B  2281717759B   8192B                      ssd
28      2281717760B  2281718783B   1024B                      m9kefsc
29      2348810240B  2348843007B   32768B                     metadata
30      2415919104B  30937169407B  28521250304B  ext4         userdata
  • Like
Reactions: Clamor