[TOOL][UNOFFICIAL][PORT] REPIT: for Nexus 7 (2013) [deb][flo] - Nexus 7 (2013) General

This is a port of Lanchon REPIT.
- Nexus 7 (2013) Deb (LTE) and Flo (WiFi) -​
Disclaimer:
I am not responsible for your actions or consequences, directly or indirectly, related to the files and/or advice offered.
It is your choice to proceed.
What is REPIT?
REPIT is a simple, safe, device-only, data-sparing, and easily portable repartitioning tool for Android devices.
See the GitHub README for more on What REPIT is. GitHub - Link
Limitations:
Requires TWRP (or TWRP based) recovery.
Does not support encrypted devices.
Will cause data loss if the repartitioning process is externally interrupted.
See the GitHub README for more on Limitations. GitHub - Link
---
Notes:
A few years ago (September 2018), I made a port of REPIT for deb,flo and manta that was spread out between multiple threads.
Some comments and instructions were lost in thread chatter or just in a different thread altogether.
The file name actually configures the repit script.
Noted that you may have to toggle MTP Disable, Enable, Disable.
Noted that you may have to reboot into TWRP after disabling MTP.
Remember /tmp is wiped after a reboot. Copy repit to /sdcard and after rebooting back into TWRP, copy it from /sdcard to /tmp using TWRP File manager.
Noted that you may have to unmount cache and data.
Do NOT flash repit from USB/OTG.
This is designed for a stock partition layout. If your device has been modified and a vendor partition was created, REPIT will not work.
Side note:
Lanchon added Nexus 7 (2013) to the official list. (November 2019)
Lanchon REPIT GitHub - Port Request - Commit
---
Be Careful.
There are always risks involved when you start messing around with a device.
If something goes wrong, you may end up with a non-working "bricked" device.
This is especially true when you start modifying partitions.
Backup what you want to save and store it off device.
Copy it to your computer, cloud storage, USB, ...
Instructions:
This operation might take a long time and must not be interrupted.
- Depending on the device and REPIT configuration, this might take a few hours.
Make sure your battery is fully charged or mostly charged.
- You can connect to a charger while the REPIT script is running. May or may not charge depending on the recovery.
How To:
If you already have a ROM installed, repit will backup, change the partition, restore and resize.
- You can just reboot once the script finishes.
Boot into TWRP
Swipe to Allow Modifications
Copy the repit zip to /tmp
Disconnect from computer
Disable MTP
Disable MTP TWRP -> Mount
Install repit
TWRP -> Install -> navigate to /tmp and flash the repit zip
Reboot to system
If you are doing a clean install, add the +wipe option to system in the zip file name. This will speed up the partitioning since system will not be backed up and restored.
lanchon-repit-20210220-system=max+wipe-cache=16M+wipe-flo.zip
- Reboot back into TWRP after the script finishes.
- Then follow the instructions from the rom thread to install the rom you are going to use.
Boot into TWRP
Swipe to Allow Modifications
Copy the repit zip to /tmp
Disconnect from computer
Disable MTP
Disable MTP TWRP -> Mount
Install repit
TWRP -> Install -> navigate to /tmp and flash the repit zip
Reboot to recovery
Follow the instructions from the rom thread to install the rom you are going to use.
---
Changes:
Nexus 7 (2013) [Deb][Flo]
Pushed a bit pass the safe zone and claimed a bit more unallocated space.
Updated to the current REPIT scripts.
Separate zip files for deb and flo.
Nexus 7 (2013) GitHub - Commit
Download Links:
MediaFire - Link
SourceForge - Link
GoogleDrive - Link
Direct Download from MediaFire:
lanchon-repit-20210221-system=max-cache=16M+wipe-deb.zip MediaFire - Download
lanchon-repit-20210221-system=max-cache=16M+wipe-flo.zip MediaFire - Download
REPIT Links:
Lanchon REPIT GitHub - Link
- My fork GitHub - Link
Credits:
Lanchon for his excellent REPIT project.
The Android Community and everyone who has helped me learn through the years.
Cheers all.

Note about configuration.
The user configuration is done by renaming the zip file before flashing it.
Not much room to change on deb/flo.
The modifiable partitions are only system and cache (22 and 23).
The actual partitioning is done by a sector range. This is declared inside the script along with a default configuration.
Code:
# the set of partitions that can be modified by REPIT:
# <gpt-number> <gpt-name> <friendly-name> <conf-defaults> <crypto-footer>
initPartition 22 system system "same keep ext4" 0
initPartition 23 cache cache "same keep ext4" 0
initPartition 24 misc misc "same keep raw" 0
# the set of modifiable partitions that can be configured by the user (overriding <conf-defaults>):
configurablePartitions="$(seq 22 23)"
...
# the set of contiguous partitions that form this heap, in order of ascending partition start address:
heapPartitions="$(seq 22 24)"
# the disk area (as a sector range) to use for the heap partitions:
heapStart=$(parOldEnd 21) # one sector past the end of tzb.
heapEnd=$(parOldStart 25) # the start of recovery.
By default, REPIT will back up, restore, compress and/or expand a partition.
The +wipe option will wipe the partition.
The max option is an easy way to allocate the remaining space for a partition.
The misc partition is not part of the user-config but, it is in the sector range.
It will be moved to the the end of the sector range without alteration.
The default zip name lanchon-repit-20210221-system=max-cache=16M+wipe-flo.zip
Creates a 16M clean cache partition. (Wiped)
Uses the rest of the unallocated space in the range for system.
System is backed up and restored since the +wipe option was NOT added to system.
Since only system and cache can be configured, this only allows a few options for deb and flo.
Default zip name. -system=max-cache=16M+wipe-
Include wipe system. -system=max+wipe-cache=16M+wipe-
See the GitHub README for more on how to configure. GitHub - Link
Cheers all.

<RESERVE>

<RESERVE>

I think this deserves a bump, because, this is some great work right here for those wanting to stick with a stock-like partition layout!

Hi, I want to go back stock partition size. So i have to rename the zip.
What zip name?

ipdev said:
This is a port of Lanchon REPIT.
- Nexus 7 (2013) Deb (LTE) and Flo (WiFi) -​
Disclaimer:
I am not responsible for your actions or consequences, directly or indirectly, related to the files and/or advice offered.
It is your choice to proceed.
What is REPIT?
REPIT is a simple, safe, device-only, data-sparing, and easily portable repartitioning tool for Android devices.
See the GitHub README for more on What REPIT is. GitHub - Link
Limitations:
Requires TWRP (or TWRP based) recovery.
Does not support encrypted devices.
Will cause data loss if the repartitioning process is externally interrupted.
See the GitHub README for more on Limitations. GitHub - Link
---
Notes:
A few years ago (September 2018), I made a port of REPIT for deb,flo and manta that was spread out between multiple threads.
Some comments and instructions were lost in thread chatter or just in a different thread altogether.
The file name actually configures the repit script.
Noted that you may have to toggle MTP Disable, Enable, Disable.
Noted that you may have to reboot into TWRP after disabling MTP.
Remember /tmp is wiped after a reboot. Copy repit to /sdcard and after rebooting back into TWRP, copy it from /sdcard to /tmp using TWRP File manager.
Noted that you may have to unmount cache and data.
Do NOT flash repit from USB/OTG.
This is designed for a stock partition layout. If your device has been modified and a vendor partition was created, REPIT will not work.
Side note:
Lanchon added Nexus 7 (2013) to the official list. (November 2019)
Lanchon REPIT GitHub - Port Request - Commit
---
Be Careful.
There are always risks involved when you start messing around with a device.
If something goes wrong, you may end up with a non-working "bricked" device.
This is especially true when you start modifying partitions.
Backup what you want to save and store it off device.
Copy it to your computer, cloud storage, USB, ...
Instructions:
This operation might take a long time and must not be interrupted.
- Depending on the device and REPIT configuration, this might take a few hours.
Make sure your battery is fully charged or mostly charged.
- You can connect to a charger while the REPIT script is running. May or may not charge depending on the recovery.
How To:
If you already have a ROM installed, repit will backup, change the partition, restore and resize.
- You can just reboot once the script finishes.
Boot into TWRP
Swipe to Allow Modifications
Copy the repit zip to /tmp
Disconnect from computer
Disable MTP
Disable MTP TWRP -> Mount
Install repit
TWRP -> Install -> navigate to /tmp and flash the repit zip
Reboot to system
If you are doing a clean install, add the +wipe option to system in the zip file name. This will speed up the partitioning since system will not be backed up and restored.
lanchon-repit-20210220-system=max+wipe-cache=16M+wipe-flo.zip
- Reboot back into TWRP after the script finishes.
- Then follow the instructions from the rom thread to install the rom you are going to use.
Boot into TWRP
Swipe to Allow Modifications
Copy the repit zip to /tmp
Disconnect from computer
Disable MTP
Disable MTP TWRP -> Mount
Install repit
TWRP -> Install -> navigate to /tmp and flash the repit zip
Reboot to recovery
Follow the instructions from the rom thread to install the rom you are going to use.
---
Changes:
Nexus 7 (2013) [Deb][Flo]
Pushed a bit pass the safe zone and claimed a bit more unallocated space.
Updated to the current REPIT scripts.
Separate zip files for deb and flo.
Nexus 7 (2013) GitHub - Commit
Download Links:
MediaFire - Link
SourceForge - Link
GoogleDrive - Link
Direct Download from MediaFire:
lanchon-repit-20210221-system=max-cache=16M+wipe-deb.zip MediaFire - Download
lanchon-repit-20210221-system=max-cache=16M+wipe-flo.zip MediaFire - Download
REPIT Links:
Lanchon REPIT GitHub - Link
- My fork GitHub - Link
Credits:
Lanchon for his excellent REPIT project.
The Android Community and everyone who has helped me learn through the years.
Cheers all.
Click to expand...
Click to collapse
I have been trying to repartition Nexus flo 2013 following the steps outlined above with lanchon-repit-20210221-system=max+wipe-cache=16M+wipe-deb.zip for 19.1 version but keep getting Error 1, see photo. Any help will be much appreciated. Thank you

greenleaves said:
I have been trying to repartition Nexus flo 2013 following the steps outlined above with lanchon-repit-20210221-system=max+wipe-cache=16M+wipe-deb.zip for 19.1 version but keep getting Error 1, see photo. Any help will be much appreciated. Thank you
Click to expand...
Click to collapse
Problem fixed. Now 19.1, pico gapps and Magisk 25.0 were flashed in success. The problem was that I didn't follow through the steps carefully described on the OP to increase the partition sizes as follows:
The file name actually configures the repit script.
Noted that you may have to toggle MTP Disable, Enable, Disable.
Noted that you may have to reboot into TWRP after disabling MTP.
Remember /tmp is wiped after a reboot. Copy repit to /sdcard and after rebooting back into TWRP, copy it from /sdcard to /tmp using TWRP File manager.
Noted that you may have to unmount cache and data.
Do NOT flash repit from USB/OTG.
This is designed for a stock partition layout. If your device has been modified and a vendor partition was created, REPIT will not work.

greenleaves said:
Problem fixed. Now 19.1, pico gapps and Magisk 25.0 were flashed in success. The problem was that I didn't follow through the steps carefully described on the OP to increase the partition sizes as follows:
The file name actually configures the repit script.
Noted that you may have to toggle MTP Disable, Enable, Disable.
Noted that you may have to reboot into TWRP after disabling MTP.
Remember /tmp is wiped after a reboot. Copy repit to /sdcard and after rebooting back into TWRP, copy it from /sdcard to /tmp using TWRP File manager.
Noted that you may have to unmount cache and data.
Do NOT flash repit from USB/OTG.
This is designed for a stock partition layout. If your device has been modified and a vendor partition was created, REPIT will not work.
Click to expand...
Click to collapse
Edit: NVM, i used restock to start fresh, and it all went fine. I've had this table kicking around long enough that I'm sure something was done that sysrepartundo couldn;'t undo.
How did you actually fix it? I ran sysrepartundo, am running it from the tmp folder with mtp disabled and nothing mounted, and still getting error 1. I've double check, all my partition sizes are stock.. I've been at this a few hours now and am getting frustrated.

theistus said:
I ran sysrepartundo, am running it from the tmp folder with mtp disabled and nothing mounted, and still getting error 1. I've double check, all my partition sizes are stock.. I've been at this a few hours now and am getting frustrated.
Click to expand...
Click to collapse
sysrepartundo is ancient and useless nowadays, try sysrepart-stock instead

Thank you for the script. I was able to repartion my flo and make it compatible with android 12L. Everything went smooth after realising (and correcting this mistake) that i"ve been putting the .zip inside /sdcard/tmp instead of /tmp (I was getting error 1 in TWRP).
During instalation process i"ve connected flo to charger and it indeed charged during repartition process
Things i"ve noticed
- TWRP appeared to be very laggy during repit process and took several seconds to reconginse the charger (to show to + sign next to the battery % to be precise)
- after device rebooted to stock 6.0.1, MTP didn"t work correctly. It appeared in my computer as "Nexus 7", but was completely empty. One more reboot (this time got short loading toast of "android is updating") and internal memory was visible from computer again

THANKS! It worked great for me also. I have mentioned it in the [GUIDE/TUTORIAL/HOWTO] Google Nexus 7 2013 Stock to Android 12 Tutorial.

Hi,
I had used @followmsi's sysrepart_1280_120.zip some time ago.
Now I'm interested in @followmsi's lineage 19.1 and want to use your lanchon-repit-20210221 script for increasing the system partition again.
Would you still consider the partition layout as stock, so I could use your script ? (See attachments)
And do I need a PC as the USB port is inoperative, so no way to connect to a PC?
Thank you very much in advance!

curiousde2002 said:
Hi,
I had used @followmsi's sysrepart_1280_120.zip some time ago.
Now I'm interested in @followmsi's lineage 19.1 and want to use your lanchon-repit-20210221 script for increasing the system partition again.
Would you still consider the partition layout as stock, so I could use your script ? (See attachments)
And do I need a PC as the USB port is inoperative, so no way to connect to a PC?
Thank you very much in advance!
Click to expand...
Click to collapse
You should be good to go.
Using one of the older (re)partitioning methods did not affect the partition table too much.
The note about a stock partition layout is mainly for users who used a (re)partition script that adds a separate vendor partition.
Cheers.

ipdev said:
You should be good to go.
Using one of the older (re)partitioning methods did not affect the partition table too much.
The note about a stock partition layout is mainly for users who used a (re)partition script that adds a separate vendor partition.
Cheers.
Click to expand...
Click to collapse
Would you recommend any precautions like putting files like restock on my device before running your script as I cannot connect to PC?
Thanks a lot for your help!

hi, i need some help, after using this script i can't seem to install any rom, i just can't format or mount any of my partitions, and sideload stops at some random %, anything i can do to restore? i backed up all files advised.

Hello, i'm having trouble installing Android 12L on my Nexus 7. I simply cannot get lanchon-repit to flash. It wont work, no matter how often I follow the steps and how thorougly I follow the guide. I tried everything. Already restored to "fabric-partitions" so on and so forth.
I'm constantly getting Error 1. I'm slowly losing my mind here.
Kind regards hoping for an answer
septchy
edit: also constantly says partition #30 not found.

I'm getting the following errors on flo:
Code:
FATAL: partition #31 unexpected
[ERROR 1]
Any ideas? Thanks

Related

[DEV]How to compile TWRP touch recovery

All of TWRP 3.x source is public. You can compile it on your own. This guide isn't going to be a step-by-step, word-for-word type of guide. If you're not familiar with basic Linux commands and/or building in AOSP then you probably won't be able to do this.
You can currently use Omni 6.0, Omni 7.1, Omni 8.1, Omni 9.0, CM 13.0, CM 14.1, CM 15.1, LineageOS 16.0 source code. Omni 9.0 is recommended for now unless your device has a super partition.
If you are using CM/LineageOS, you'll need to place TWRP in the LineageOS/bootable/recovery-twrp folder and set RECOVERY_VARIANT := twrp in your BoardConfig.mk file. TWRP source code can be found here:
https://github.com/TeamWin/android_bootable_recovery (NOTE: The location for the latest TWRP source code has changed!)
Select the newest branch available. This step is not necessary with Omni because Omni already includes TWRP source by default, however, if you are using an older version of Omni, you will probably want to pull from the latest branch (the latest branch will compile successfully in older build trees)
If you are only interested in building TWRP, you may want to try working with a smaller tree. You can try using this manifest. It should work in most cases but there may be some situations where you will need more repos in your tree than this manifest provides:
https://github.com/minimal-manifest-twrp
*BEFORE YOU COMPILE*
Note: If you add or change any flags, you will need to make clean or make clobber before recompiling or your flag changes will not be picked up.
Now that you have the source code, you'll need to set or change a few build flags for your device(s). Find the BoardConfig.mk for your device. The BoardConfig.mk is in your devices/manufacturer/codename folder (e.g. devices/lge/hammerhead/BoardConfig.mk).
Your board config will need to include architecture and platform settings. Usually these are already included if you're using device configs that someone else created, but if you created your own, you may need to add them. Without them, recovery may seg fault during startup and you'll just see the teamwin curtain flash on the screen over and over.
We usually put all of our flags at the bottom of the BoardConfig.mk under a heading of #twrp For all devices you'll need to tell TWRP what theme to use. This TW_THEME flag replaces the older DEVICE_RESOLUTION flag. TWRP now uses scaling to stretch any theme to fit the screen resolution. There are currently 5 settings which are: portrait_hdpi, portrait_mdpi, landscape_hdpi, landscape_mdpi, and watch_mdpi. For portrait, you should probably select the hdpi theme for resolutions of 720x1280 and higher. For landscape devices, use the hdpi theme for 1280x720 or higher.
TW_THEME := portrait_hdpi
Note that themes do not rotate 90 degrees and there currently is no option to rotate a theme. If you find that the touchscreen is rotated relative to the screen, then you can use some flags (discussed later in this guide) to rotate the touch input to match the screen's orientation.
In addition to the resolution, we have the following build flags:
RECOVERY_SDCARD_ON_DATA := true -- this enables proper handling of /data/media on devices that have this folder for storage (most Honeycomb and devices that originally shipped with ICS like Galaxy Nexus) This flag is not required for these types of devices though. If you do not define this flag and also do not include any references to /sdcard, /internal_sd, /internal_sdcard, or /emmc in your fstab, then we will automatically assume that the device is using emulated storage.
BOARD_HAS_NO_REAL_SDCARD := true -- disables things like sdcard partitioning and may save you some space if TWRP isn't fitting in your recovery patition
TW_NO_BATT_PERCENT := true -- disables the display of the battery percentage for devices that don't support it properly
TW_CUSTOM_POWER_BUTTON := 107 -- custom maps the power button for the lockscreen
TW_NO_REBOOT_BOOTLOADER := true -- removes the reboot bootloader button from the reboot menu
TW_NO_REBOOT_RECOVERY := true -- removes the reboot recovery button from the reboot menu
RECOVERY_TOUCHSCREEN_SWAP_XY := true -- swaps the mapping of touches between the X and Y axis
RECOVERY_TOUCHSCREEN_FLIP_Y := true -- flips y axis touchscreen values
RECOVERY_TOUCHSCREEN_FLIP_X := true -- flips x axis touchscreen values
TWRP_EVENT_LOGGING := true -- enables touch event logging to help debug touchscreen issues (don't leave this on for a release - it will fill up your logfile very quickly)
BOARD_HAS_FLIPPED_SCREEN := true -- flips the screen upside down for screens that were mounted upside-down
There are other build flags which you can locate by scanning the Android.mk files in the recovery source. Most of the other build flags are not often used and thus I won't document them all here.
*RECOVERY.FSTAB*
TWRP 2.5 and higher supports some new recovery.fstab features that you can use to extend TWRP's backup/restore capabilities. You do not have to add fstab flags as most partitions are handled automatically.
Note that TWRP only supports v2 fstabs in version 3.2.0 and higher. You will still need to use the "old" format of fstab for older TWRP (example of that format is below), and even TWRP 3.2.0 still supports the v1 format in addition to the v2 format. To maximize TWRP's compatibility with your build tree, you can create a twrp.fstab and use PRODUCT_COPY_FILES to place the file in /etc/twrp.fstab When TWRP boots, if it finds a twrp.fstab in the ramdisk it will rename /etc/recovery.fstab to /etc/recovery.fstab.bak and then rename /etc/twrp.fstab to /etc/recovery.fstab. Effectively this will "replace" the fstab 2 file that your device files are providing with the TWRP fstab allowing you to maintain compatibility within your device files and with other recoveries.
Code:
PRODUCT_COPY_FILES += device/lge/hammerhead/twrp.fstab:recovery/root/etc/twrp.fstab
The fstab in TWRP can contain some "flags" for each partition listed in the fstab.
Here's a sample TWRP fstab for the Galaxy S4 that we will use for reference:
Code:
/boot emmc /dev/block/platform/msm_sdcc.1/by-name/boot
/system ext4 /dev/block/platform/msm_sdcc.1/by-name/system
/data ext4 /dev/block/platform/msm_sdcc.1/by-name/userdata length=-16384
/cache ext4 /dev/block/platform/msm_sdcc.1/by-name/cache
/recovery emmc /dev/block/platform/msm_sdcc.1/by-name/recovery
/efs ext4 /dev/block/platform/msm_sdcc.1/by-name/efs flags=display="EFS";backup=1
/external_sd vfat /dev/block/mmcblk1p1 /dev/block/mmcblk1 flags=display="Micro SDcard";storage;wipeingui;removable
/usb-otg vfat /dev/block/sda1 /dev/block/sda flags=display="USB-OTG";storage;wipeingui;removable
/preload ext4 /dev/block/platform/msm_sdcc.1/by-name/hidden flags=display="Preload";wipeingui;backup=1
/modem ext4 /dev/block/platform/msm_sdcc.1/by-name/apnhlos
/mdm emmc /dev/block/platform/msm_sdcc.1/by-name/mdm
Flags are added to the end of the partition listing in the fstab separated by white space (spaces or tabs are fine). The flags affect only that partition but not any of the others. Flags are separated by semicolons. If your display name is going to have a space, you must surround the display name with quotes.
Code:
/external_sd vfat /dev/block/mmcblk1p1 flags=display="Micro SDcard";storage;wipeingui;removable
The flags for this partition give it a display name of "Micro SDcard" which is displayed to the user. wipeingui makes this partition available for wiping in the advanced wipe menu. The removable flag indicates that sometimes this partition may not be present preventing mounting errors from being displayed during startup. Here is a full list of flags:
removable -- indicates that the partition may not be present preventing mounting errors from being displayed during boot
storage -- indicates that the partition can be used as storage which makes the partition available as storage for backup, restore, zip installs, etc.
settingsstorage -- only one partition should be set as settings storage, this partition is used as the location for storing TWRP's settings file
canbewiped -- indicates that the partition can be wiped by the back-end system, but may not be listed in the GUI for wiping by the user
userrmrf -- overrides the normal format type of wiping and only allows the partition to be wiped using the rm -rf command
backup= -- must be succeeded by the equals sign, so backup=1 or backup=0, 1 indicates that the partition can be listed in the backup/restore list while 0 ensures that this partition will not show up in the backup list.
wipeingui -- makes the partition show up in the GUI to allow the user to select it for wiping in the advanced wipe menu
wipeduringfactoryreset -- the partition will be wiped during a factory reset
ignoreblkid -- blkid is used to determine what file system is in use by TWRP, this flag will cause TWRP to skip/ignore the results of blkid and use the file system specified in the fstab only
retainlayoutversion -- causes TWRP to retain the .layoutversion file in /data on devices like Sony Xperia S which sort of uses /data/media but still has a separate /sdcard partition
symlink= -- causes TWRP to run an additional mount command when mounting the partition, generally used with /data/media to create /sdcard
display= -- sets a display name for the partition for listing in the GUI
storagename= -- sets a storage name for the partition for listing in the GUI storage list
backupname= -- sets a backup name for the partition for listing in the GUI backup/restore list
length= -- usually used to reserve empty space at the end of the /data partition for storing the decryption key when Android's full device encryption is present, not setting this may lead to the inability to encrypt the device
canencryptbackup= -- 1 or 0 to enable/disable, makes TWRP encrypt the backup of this partition if the user chooses encryption (only applies to tar backups, not images)
userdataencryptbackup= -- 1 or 0 to enable/disable, makes TWRP encrypt only the userdata portion of this partition, certain subfuldes like /data/app would not be encrypted to save time
subpartitionof= -- must be succeeded by the equals sign and the path of the partition it is a subpartition of. A subpartition is treated as "part" of the main partition so for instance, TWRP automatically makes /datadata a subpartition of /data. This means that /datadata will not show up in the GUI listings, but /datadata would be wiped, backed up, restored, mounted, and unmounted anytime those operations are performed on /data. A good example of the use of subpartitions is the 3x efs partitions on the LG Optimus G:
Code:
/efs1 emmc /dev/block/mmcblk0p12 flags=backup=1;display=EFS
/efs2 emmc /dev/block/mmcblk0p13 flags=backup=1;subpartitionof=/efs1
/efs3 emmc /dev/block/mmcblk0p14 flags=backup=1;subpartitionof=/efs1
This lumps all 3 partitions into a single "EFS" entry in the TWRP GUI allowing all three to be backed up and restored together under a single entry.
As of TWRP 3.2.0, TWRP now supports a version 2 fstab like those that have been found in Android devices for years. Yes, I know we're really slow to adopt this one, but I also saw no major advantage to v2 and the v2 fstab was being used in regular Android as well as recovery and I didn't want full ROM builds crashing or doing other weird things because of TWRP flags being present in the fstab. Version 2 fstab support is automatic. You don’t need to add any build flags. The regular version 1 fstab format is also still valid and it’s possible to use both v1 and v2 types in the same fstab. TWRP 3.2.0 also supports using wildcards via the asterisk in v1 format which can be useful for USB OTG and micro SD cards with multiple partitions. Note also that v2 fstab formats haven’t been extensively tested so developers should test their v2 fstabs before shipping to users (you should always be testing anyway!).
This is a v1 fstab line with a wildcard intended for a USB OTG drive. All partitions should show up in the list of available storage devices when the user plugs in a drive:
Code:
/usb-otg vfat /dev/block/sda* flags=removable;storage;display=USB-OTG
This line is straight from the v2 fstab for the same device and also should work. In this case the kernel will notify us that new devices have been added or removed via uevents:
Code:
/devices/soc.0/f9200000.ssusb/f9200000.dwc3/xhci-hcd.0.auto/usb* auto auto defaults voldmanaged=usb:auto
In addition to the v2 fstab, you can include /etc/twrp.flags which uses the v1 fstab format. The twrp.flags file can be used to supplement the v2 fstab with TWRP flags, additional partitions not included in the v2 fstab, and to override settings in the v2 fstab. For example, I have a Huawei device with the following stock v2 fstab present as /etc/recovery.fstab
Code:
# Android fstab file.
#<src> <mnt_point> <type> <mnt_flags and options> <fs_mgr_flags>
# The filesystem that contains the filesystem checker binary (typically /system) cannot
# specify MF_CHECK, and must come before any filesystems that do specify MF_CHECK
/dev/block/bootdevice/by-name/system /system ext4 ro,barrier=1 wait,verify
/dev/block/bootdevice/by-name/cust /cust ext4 ro,barrier=1 wait,verify
/devices/hi_mci.1/mmc_host/mmc1/* auto auto defaults voldmanaged=sdcard:auto,noemulatedsd
/devices/hisi-usb-otg/usb1/* auto auto defaults voldmanaged=usbotg:auto
/dev/block/bootdevice/by-name/userdata /data f2fs nosuid,nodev,noatime,discard,inline_data,inline_xattr wait,forceencrypt=footer,check
/dev/block/bootdevice/by-name/cache /cache ext4 rw,nosuid,nodev,noatime,data=ordered wait,check
/dev/block/bootdevice/by-name/splash2 /splash2 ext4 rw,nosuid,nodev,noatime,data=ordered,context=u:object_r:splash2_data_file:s0 wait,check
/dev/block/bootdevice/by-name/secure_storage /sec_storage ext4 rw,nosuid,nodev,noatime,discard,auto_da_alloc,mblk_io_submit,data=journal,context=u:object_r:teecd_data_file:s0 wait,check
In addition I have also included this in /etc/twrp.flags:
Code:
/boot emmc /dev/block/platform/hi_mci.0/by-name/boot
/recovery emmc /dev/block/platform/hi_mci.0/by-name/recovery flags=backup=1
/cust ext4 /dev/block/platform/hi_mci.0/by-name/cust flags=display="Cust";backup=1
/misc emmc /dev/block/platform/hi_mci.0/by-name/misc
/oeminfo emmc /dev/block/platform/hi_mci.0/by-name/oeminfo flags=display="OEMinfo";backup=1
/data f2fs /dev/block/dm-0
/system_image emmc /dev/block/platform/hi_mci.0/by-name/system
The first 2 lines in twrp.flags adds the boot and recovery partitions which were not present at all in the v2 fstab. The /cust line in the twrp.flags file is added to tell TWRP to allow users to back up the cust partition and to give it a slightly better display name. The /misc partition is also only present in the twrp.flags file. Much like the /cust partition, the /oeminfo partition is in the twrp.flags file to tell TWRP to allow users to back it up and give a display name. The /data line is needed because this Huawei device, like many Huawei devices, is encrypted but the encryption uses some special Huawei binaries and is encrypted with some sort of default password that the user cannot change. We use the Huawei binaries to decrypt the device automatically in recovery. The /data line here tells TWRP to use /dev/block/dm-0 instead of /dev/block/bootdevice/by-name/userdata which is required for proper mounting, etc. Lastly we have the /system_image line so that TWRP will add a system image option for backup and restore.
As we add more new devices, we’ll add more example device trees to https://github.com/TeamWin/ which should help you find more ways to use this new fstab support. Please note that using the v2 fstab format at this point is completely optional, so feel free to continue using v1 if that is what is more comfortable or if you have trouble with the v2 format support.
If you have questions, feel free to stop by #twrp on Freenode. If you post here I may not see it for a while as I have lots of threads out there and there's no way for me to keep track of them all. If you successfully port TWRP to a new device, please let us know! We love to hear success stories!
If you have code changes that you'd like to submit, please submit them through the Omni Gerrit server. Guide is here.
Once you get Omni or CM sync'ed and your TWRP flags set, you should do a source ./build/envsetup.sh We usually lunch for the device in question, so something like "lunch omni_hammerhead-eng".
After you lunch successfully for your device this is the command used for most devices:
Code:
make clean && make -j# recoveryimage
Replace the # with the core count +1, so if you have a dual core it's -j3 and a quad core becomes -j5, etc. If you're dealing with a "typical" Samsung device, then you'll need to
Code:
make -j# bootimage
Most Samsung devices have the recovery included as an extra ramdisk in the boot image instead of a separate recovery partition as found on most other devices.
Old guide here: http://forum.xda-developers.com/showpost.php?p=65482905&postcount=1471
So, now, hopefully you've compiled TWRP for your device and gotten it working. Now, you'd like to know how to get TWRP officially supported for your device so that it can be installed automatically with the TWRP app. In order for us to add "official support" for your device we'll need the following:
1) Device configuration files to compile TWRP from source for your device. This means that you cannot have repacked a recovery.img by hand to get it working. We need to be able to compile it from source so that we can easily release future updates.
2) We'll build a copy of TWRP and send it to you for validation. Once you've validated that we can build a working image for your device, we'll add it to the official TWRP app.
Note that we won't take credit for your port. You'll still get to post it on XDA to collect all the credit that goes with releasing something new for your device along with having your name listed on our website as the maintainer for the device. Also note that it's not always possible to provide automated installs for all devices.
You can now boot TWRP in an emulator. If you're trying to help develop TWRP, this can be a huge help as you don't have to risk your device and you can do everything directly on your computer.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Download this set of device configuration files.
Compile a recoveryimage using those device files. In the Android SDK, click on Tools -> Manage AVDs. Click New. Set it up as the following:
AVD Name: TWRP
Device: Galaxy Nexus
Target: ICS or newer though anything will probably work here
CPU: ARM (armeabi-v7a)
Check the box for hardware keyboard (your computer's keyboard will work in TWRP)
Up to you if you want to have the skin with controls present
Front Camera: None
Back Camera: None
RAM: 1024 VM Heap: 64
Internal Storage: 200
SD Card: Size: 500 MiB
Then click OK.
Once you have your AVD and your recoveryimage, you can boot TWRP in the emulator by browsing to your android-sdk/tools folder and run this command:
./emulator -avd TWRP -ramdisk CMFOLDER/out/target/product/twrp/ramdisk-recovery.img
Note that ADB doesn't work right away. About 10 to 15 seconds after TWRP finishes booting, ADB will come online. We start ADB via init.rc so even if TWRP fails to boot due to some kind of code error that you may have made, ADB should still work. Enjoy!
TWRP and A/B devices:
From a TWRP standpoint, A/B devices aren't a whole lot different from regular devices, but developers seem to be shy about working on these devices. I'm going to try to shed some light on this subject and hopefully this will serve as a guide for porting TWRP to A/B devices.
Firstly, let's understand what is an A/B device and how it's different. A/B devices have duplicates of many partitions on the device. An A/B device has 2x system partitions, 2x boot partitions, 2x vendor partitions, 2x modem / firmware partitions, etc. Only one slot is in use at a time. During early boot, the first stages of the bootloader read some small amount of data called the BCB or Bootloader Control Block and decide whether to boot the A partitions or the B partitions. When an OTA update is available, the data from the active slot is copied from the inactive slot and patched / updated. For example, if you're currently on slot A, your device would download the update and copy the existing system partition from slot A and patch / update it with the new updates into slot B. Once the copying and updating is complete, the BCB is updated and the device reboots using slot B. Next time an update is available, the system partition in slot B is copied to slot A and updated, the BCB gets updated, and we reboot to slot A. When viewing partitions on the device, you'll see something like this:
Code:
/dev/block/bootdevice/by-name/boot_a
/dev/block/bootdevice/by-name/boot_b
/dev/block/bootdevice/by-name/system_a
/dev/block/bootdevice/by-name/system_b
/dev/block/bootdevice/by-name/userdata
/dev/block/bootdevice/by-name/vendor_a
/dev/block/bootdevice/by-name/vendor_b
Note the dual boot, system and vendor partitions in the list above, but only one userdata partition.
While there is technically no requirement that I am aware of, all A/B devices shipped thus far have no separate recovery partition. Instead, the boot image contains the recovery in its ramdisk. The important thing is knowing that the boot image now also contains the recovery. For completeness, the system partition is a full root file system. During boot, if the kernel is told to boot to recovery, it will extract the ramdisk in the boot partition. If the kernel is not told by the bootloader to boot to recovery, then the kernel will mount the appropriate system partition (A or B) because the system partition is a full root file system. This means that the system partition on these devices is mounted to / instead of to /system and the system partition contains all of the files that would have normally been in the boot image ramdisk and a /system subfolder.
From a TWRP standpoint, there are 3 things that you have to do for an A/B device. First, you need to set
Code:
AB_OTA_UPDATER := true
in your BoardConfig.mk. Secondly, for any partition that has an A/B option, you need to add
Code:
flags=slotselect
in your fstab so something like this:
Code:
/boot emmc /dev/block/bootdevice/by-name/boot flags=slotselect
/system ext4 /dev/block/bootdevice/by-name/system flags=slotselect
/system_image emmc /dev/block/bootdevice/by-name/system flags=slotselect
/vendor ext4 /dev/block/bootdevice/by-name/vendor flags=slotselect;display="Vendor";backup=1
/vendor_image emmc /dev/block/bootdevice/by-name/vendor flags=slotselect
Lastly, once you get into TWRP, you will probably want to make sure that bootctl hal-info responds correctly with no errors. Usually the bootctl binary requires a proprietary library or even a couple of services to work correctly. If bootctl does not work correctly, then you will not be able to switch slots within TWRP correctly either.
In addition to setting
Code:
AB_OTA_UPDATER := true
you may also want to set:
Code:
BOARD_USES_RECOVERY_AS_BOOT := true
BOARD_BUILD_SYSTEM_ROOT_IMAGE := true
If you set
Code:
BOARD_USES_RECOVERY_AS_BOOT := true
then make recoveryimage will no longer work and instead you will have to make bootimage. I don't recommend setting either of these flags for TWRP-only build trees. These flags will probably be required for developers building full ROMs for A/B devices.
Installing / Flashing TWRP on A/B devices:
Since all known A/B devices do not have a separate recovery partition, you will eventually have to flash TWRP to the boot partition. On the Pixel 1 and 2, we use fastboot boot to temporarily boot TWRP without flashing TWRP. We are then supplying a zip to allow users to flash TWRP to both slots. You can download one of these zips from our website and update the zip as needed to support your devices. Eventually we will add tools to TWRP to allow users to flash recoveries on these devices without needing to use zips.
Recently, I worked on the Razer Phone. The Razer Phone unfortunately does not support fastboot boot. Instead, users have to determine their currently active boot slot using
Code:
adb shell getprop ro.boot.slot_suffix
then use
Code:
fastboot --set-active=_a
to switch slots to the inactive slot. From here, the user can
Code:
fastboot flash boot twrp.img && fastboot reboot
to get into TWRP. Once in TWRP they can then go to the reboot page and change back to their originally active slot, make a backup, then install TWRP. Using the inactive slot allows users to get a good, unmodified backup of their device before installing TWRP.
Hopefully this helps!
Debugging with gdb in TWRP guide can be found here!
Beep boop zee doop
I know I've PM'ed you but I would like to ask you again. What should I do after compiling the TWRP recovery binary? What files have to be copied and where? I'm trying to integrate it with an ICS kernel.
Dees_Troy said:
Once you get CM sync'ed, I suggest that you go ahead and compile a build of ClockworkMod (ClockworkMod source is included in the CM repos). We usually lunch for the device in question, so something like "lunch full_tenderloin-eng".
After you lunch successfully for your device this is the command used for most devices:
Code:
make clean && make -j# recoveryimage
Click to expand...
Click to collapse
I don't get this part. What is lunch supposed to be? is it supposed to be a individual command for a device or can I do "lunch full_tenderloin-eng" for all devices? Because I am building for a device that doesn't run Android natively (at least out of-the-box) so cyanogenmod doesn't support it on any way...
Also, can I use this for resistive screens? Just to make sure.
Thanks for the guide, I have been looking for this for a long time
thanks for the guide, well structured and not so complicated
i have only a question: i'm trying to build it for galaxy 5, the problem is that the resolution is 320x240, so can you tip me on modify the sources? (i've done this some days ago, but images were too large)
manuel100 said:
thanks for the guide, well structured and not so complicated
i have only a question: i'm trying to build it for galaxy 5, the problem is that the resolution is 320x240, so can you tip me on modify the sources? (i've done this some days ago, but images were too large)
Click to expand...
Click to collapse
Set the device resolution to 320x240...I'm pretty sure they have support for that resolution...and if they don't then you can copy one of there's except resize it all to 320x240
Edit-they only have 320x480 https://github.com/TeamWin/Team-Win-Recovery-Project/
My question: I built twrp from source a while ago using smasher's Samsung inject twrp zip...that worked fine for a while...but recently we switched to mtd format so that inject twrp zip doesn't work...neither does the inhect twrp button within twrp anymore...I've seen that the galaxy s has the same problem as well...just wondering if you know of a work around...
Sent from my SGH-I997 using Tapatalk 2
mg2195 said:
Set the device resolution to 320x240...I'm pretty sure they have support for that resolution...and if they don't then you can copy one of there's except resize it all to 320x240
Edit-they only have 320x480 https://github.com/TeamWin/Team-Win-Recovery-Project/
My question: I built twrp from source a while ago using smasher's Samsung inject twrp zip...that worked fine for a while...but recently we switched to mtd format so that inject twrp zip doesn't work...neither does the inhect twrp button within twrp anymore...I've seen that the galaxy s has the same problem as well...just wondering if you know of a work around...
Sent from my SGH-I997 using Tapatalk 2
Click to expand...
Click to collapse
thanks for respond, however i've tried resizing images to 320x240 but i don't know what should be the size of bottoms, because they are alway out-of-screen
what is smasher's Samsung inject twrp zip? but i think that the recovery doesn't work because you have to built it with mtd support (for ex. on madteam they are trying to build a mtd kernel, but for install that testing rom they built a special cwm with mtd support)
manuel100 said:
thanks for respond, however i've tried resizing images to 320x240 but i don't know what should be the size of bottoms, because they are alway out-of-screen
what is smasher's Samsung inject twrp zip? but i think that the recovery doesn't work because you have to built it with mtd support (for ex. on madteam they are trying to build a mtd kernel, but for install that testing rom they built a special cwm with mtd support)
Click to expand...
Click to collapse
Smashers inject twrp zip is a tool for Samsung devices that let's you get the recovery without flashing the whole kernel. You basically put the ramdisk-recovery.img in the zip and then flash. During the flash process it pulls the boot.img, replaces the current ramdisk-recovery.img with the new one that contains twrp. It then deletes the old boot.img and flashes the new one...not affecting the actual kernel...
The recovery itself has mtd support...I can use it if I flash the whole boot.img, but I don't want to release the recovery within a whole kernel...because then I have to keep it up to date with both twrp and kernel sources, not to mention the different kernels available for my device....I can't make a recovery for each kernel...don't have the time for that...that's where the inject came in handy....the user could use any kernel he wanted while still using twrp
Recovery logs say it fails to find the ramdisk inside the boot.img and then in parenthesis something about may not be using gzip compression...which it is....
Sent from my SGH-I997 using Tapatalk 2
---------- Post added at 07:21 AM ---------- Previous post was at 07:19 AM ----------
Deestroy did this same tutorial on rootzwiki...if you look at the second post you'll see info about the smasher inject twrp I was referring to...http://rootzwiki.com/index.php?/topic/23903-How-to-Compile-TWRP-from-Source
Sent from my SGH-I997 using Tapatalk 2
mfsr98 said:
I don't get this part. What is lunch supposed to be? is it supposed to be a individual command for a device or can I do "lunch full_tenderloin-eng" for all devices? Because I am building for a device that doesn't run Android natively (at least out of-the-box) so cyanogenmod doesn't support it on any way...
Also, can I use this for resistive screens? Just to make sure.
Thanks for the guide, I have been looking for this for a long time
Click to expand...
Click to collapse
can I get help here please?
mfsr98 said:
can I get help here please?
Click to expand...
Click to collapse
Its a single command...it opens up the menu for devices...just type lunch into the terminal and hit enter...you'll see what I mean. You will probably have to add your device to the menu by creating a vendorsetup.sh in your device repo if it doesn't already exist....
Sent from my SGH-I997 using Tapatalk 2
Thank you for the quick answer. Yes, I already have vendorsetup.sh on the boot.img. Sorry for the noob question
What about for android beginners???
Devarishi said:
What about for android beginners???
Click to expand...
Click to collapse
There's only so much that you can dumb it down and simplify it. There's lots of other guides out there for getting started. Compiling a recovery is not a super simple task that anyone and everyone can do and there's plenty of potential pitfalls including the possibility of bricking your device. If none or very little of this guide makes sense, then you might see if a developer for your device is interested in working on it instead.
how would you compile this for a device without an official cm9 build?
azoller1 said:
how would you compile this for a device without an official cm9 build?
Click to expand...
Click to collapse
Well, you don't need official cm9 if you can find any working device tree for you phone you are good to go.. For lg spectrum 4g, this could be useful.
Hey guys I'm trying to compile this for my phone the problem I'm running into is I need the root.ts I've searched and it doesn't come up with anything any help would be appreciated thanks
Sent from my SAMSUNG-SGH-I577 using xda premium
I have a mtk6577 device which is not in de device tree of CM9.
I can compile CWM for my device with CM9. Because I was only making recovery, there was no need for setting up boardconfig.
In this guide there is a part starting with TARGET_RECOVERY_INITRC which is not there in my boardconfig.
Also is stated:
"Your board config also needs to include architecture and platform settings. Usually these are already included if you're using device configs that someone else created, but if you created your own, you may need to add them. Without them, recovery will often seg fault during startup and you'll just see the teamwin curtain flash on the screen over and over."
Does this mean that I cannot build TWRP without it, even I can build CWM ?
gls9 said:
I have a mtk6577 device which is not in de device tree of CM9.
I can compile CWM for my device with CM9. Because I was only making recovery, there was no need for setting up boardconfig.
In this guide there is a part starting with TARGET_RECOVERY_INITRC which is not there in my boardconfig.
Also is stated:
"Your board config also needs to include architecture and platform settings. Usually these are already included if you're using device configs that someone else created, but if you created your own, you may need to add them. Without them, recovery will often seg fault during startup and you'll just see the teamwin curtain flash on the screen over and over."
Does this mean that I cannot build TWRP without it, even I can build CWM ?
Click to expand...
Click to collapse
Look for another mtk6577 device that has CM & copy the arch flags from it.

[RECOVERY] JCSullins' Touchpad CWM6 v6.0.1.9 [2012-12-15] Edit: 1-31-13

DISCLAIMER: I'm not a dev, nor do I play one on t.v. Use the information and links at your own risk. READ and UNDERSTAND what your doing before flashing is the best bet.
I take no responsibility or credit for the information.
The OP is primarily just quotes/links from JcSullins over at RootzWiki about his current CWM Recovery v 6.0.1.9.
This thread is NOT intended as a walk through of a first time install of Android/CM on the Touchpad. There are several threads on Xda and RootzWiki for that.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
Rootzwiki version of this thread
CONTENTS: (See RolandDeschain79's CWM6 Video)
Post 1 - JcSullins fixed CWM6, installable from Acme3 or Recovery. (Scroll down)
Post 2 - Background on file system corruption/inode errors with CWM5 and early TWRP recoveries.
Post 3 - Moboot 3.5 and Moboot 3.8 background and issues with TWRP recovery.
Post 4 - How to Clean Install / Dirty Install Rom Updates using CWM6 after first install with Acme3.
Post 5 - Basic info for using CWM Recovery.
Post 6 - CM9/CM10 First Time Install Links (not all inclusive)
NEW CWM6 Setting: Dedupe (.dup) vs .tar backups. See post 5 for how to change the setting and read Koush's Explanation.
The Fixed CWM6 (2012-12-15) From RootzWiki AcmeInstaller3 thread Post 204
JcSullins said:
OK, fixed CWM6 update package has been "officially released"
JcSullins CWM Recovery v6.0.1.9 Goo.im Download
(Mpg2 Edit: Use the 12/15/2012 version because the script is setup to work with BOTH AcmeInstaller AND a previously installed Recovery)
Any CWM users should upgrade to this version (including those who installed the CWM6 testing from a few days ago).
Note that it will remove any existing uImage.ClockworkMod or uImage.TWRP before install.
Click to expand...
Click to collapse
From Rootzwiki Post 209
jcsullins said:
You can install with whatever recovery you currently have installed.
The version number it shows is 6.0.1.9.
Two things to check that it is correct version:
1) Selecting "install zip from sideload" from main menu will give a "Not implemented." message
2) In the "Backup and Restore" menu, you will see "choose default backup format" at the bottom (not "choose backup format")
To make sure that all the filesystems are "clean", I would suggest doing the following after it is installed:
1) go to 'backup and restore', select 'backup' (might take a little while)
NOTE: DO NOT CONTINUE WITH NEXT STEPS IF BACKUP FAILS FOR SOME REASON
2) go to main menu and select "mounts and storage"
3) select "format /cache"
4) select "format /data"
5) select "format /system"
6) go to main main, then select "backup and restore", then select "restore" and select the backup you just made
Click to expand...
Click to collapse
Thread continues Rootzwiki Post 211
Mpgrimm2 said:
JcSullins, thanks for your previous post about cm6. I had just posted this earlier when i found this thread....
My understanding from your previous post is that a fresh format with the newer Cwm6 you just posted will correct any file system/inode corruption. Am I correct?
Click to expand...
Click to collapse
jcsullins said:
Yep, that's correct.
Click to expand...
Click to collapse
Background: File system corruption/inode errors
Background: File system corruption/inode errors from RootzWiki Acme3 thread Post 102
jcsullins said:
The "Fix Recovery" commit - http://review.cyanogenmod.org/26596 - fixed the building
of recovery as part of standard build process.
http://review.review.cyanogenmod.org/#/c/26704/ plus review.cyanogenmod.org/#/c/26705/
is the fix for the filesystem corruption. If you build a recovery for the Touchpad (or know
someone who does), please make sure you/they include these two commits.
Click to expand...
Click to collapse
jcsullins said:
This issue was initially discovered in the days of CM7 when I created scripts to resize the /data partition. Several people were having trouble
using them because the filesystems check (fsck) on /data would fail. After some testing, I discovered that ext4 filesystems created with make_ext4fs
from system/extras/ext4_utils would fail a "fsck -fn <block_dev>" check immediately after creation with numerous inode errors. As far as we knew,
there was never any "real" data corruption. The problem seemed to only surface when doing a fsck required for doing a filesystem resize.
The issue resurfaced when we needed to resize /system for jellybean installs. Luckily, with the jellybean version of ext4_utils, I was able to uncover
the real source of the problem (make_ext4fs assumed our kernel supported ext4_lazyinit when it doesn't) and the fix (see above).
I tested TWRP v2.3.1.0 for tenderloin and it had the issue. I contacted Dees_Troy about rebuilding a fixed TWRP. Turns out that the TWRP for
tenderloin is not built using the jellybean source, so the above fix would not apply. However, he changed TWRP to use mke2fs instead of make_ext4fs to work around the issue.
In short, TWRP v2.3.2.3 for tenderloin does not have the issue. It is the current version available from http://teamw.in/project/twrp2/75
NOTE: The link on that page says it's v2.3.1.0 when it's really v2.3.2.3 it downloads.
Click to expand...
Click to collapse
Moboot 3.5 and Moboot 3.8 background and issues with TWRP recovery.
By now you should also be using the latest CWM6 (12/15/12) or latest TWRP (2.3.3.0+) due to files system corruption issues. If you use Cwm6, I recommend Moboot 3.8 as well.
Twrp & Moboot 3.8 summary ...
Moboot 3.8 is still considered a "Testing" version but allows correct device S/n reporting to android OS needed for certain apps/games like Asphalt 7 etc. There are no issues reported (yet) when used with cwm6 because it has always used sdcard/clockworkmod/ for backups.
TWRP uses your device S/N (000000000 on Moboot 3.5) to create the folder where backups are stored, when you update to Moboot 3.8, TWRP will be looking at a new backup folder (ie 12345678) and won't see your previous TWRP backups. This is not an issue on all future backups (or if you started with Moboot 3.8). If needed you can use a file browser to move the old TWRP backup files to the new S/n folder and it has been reported to work.
(Note: I have not tried TWRP on the Touchpad, but I have used it on other devices).
JcSullins' Moboot 3.5 (Last stable version)
JcSullins' Moboot 3.8 (Testing version)
Moboot 3.8 has been setup to be flashed from either Acme3 or the installed recovery (ie CWM6).
For download links and more info, I created a dedicated thread: [INFO] on JcSullins' Moboot versions (& Version Poll)
Currently... If you have 'ever' installed (ie originally) with AcmeInstaller3 you don't have to use it or AcmeUninstaller anymore for regular installs or updates, you can use the latest Cwm6 or TWRP 2.3.3.0 using either the clean install or dirty install that I detail below. If you get your install all hosed up, Acme is still the best way to clean out all the garbage, by completely removing (AcmeUninstaller) and reinstalling android (AcmeInstaller3).
Using AcmeUninstaller/AcmeInstaller3 method works well and is considered the 'tried & true' method because of issues with prior recoveries.
Prior versions of Acme(1&2) created a system partition size of 300mb which was appropriate for cm7/9. Cm10 needs about 350mb or more so Acme3 is needed because it sets the size of partition to 400mb AND formats without all the corruption/inode errors that occurred when formatting with prior recoveries (cwm5 & TWRP 2.1.x) hence "tried & true".
Per JcSullins (See the OP) if you perform a format of the 3 partitions with Cwm6 (& implemented in TWRP 2.3.3.0) it will correct any corruption issues (so u don't need to rely on Acme for a correct format once it has set the correct partition size).
To summarize,
if your system partition was previously sized to 400mb with Acme3, then yes, formatting and flashing with CWM6 will work correctly.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Note: Cwm6 12-15-2012 and Moboot 3.8 zips can be installed from your current recovery as well as being installed via Acme3. If you have already installed CM via Acme3 (provides 400mb system partition size needed for future installs of CM10), and have Moboot 3.8 (optional but recommended) and CWM6 (not optional, need this version or latest TWRP 2.3.3.0), then...
How to Clean Install / Dirty Install Rom Updates using CWM6 after first install with Acme3.
Step 1 (backup & format)
- Make a backup of your current CM9 install (See next post for details on using CWM6)
- Format/wipe ... system, data & cache (via Cwm6)
(ensures there isn't any file system corruption left over from prior recovery versions)
Step 2 Option 1 (clean install)
- flash CM9 and ICS Gapps zips via CWM6
(or CM10 & JB Gapps)
- Reboot, re-run CM setup
Step 2 Option 2 (Dirty install)
- "Backup and Restore" -> "Advanced Restore" -> select your CM9 backup -> "Restore data"
(advanced restore of cm9 data only)
- flash CM9 and Gapps zips via CWM6
(or CM10 & JB Gapps)
- Reboot, (should have all your apps and settings)
-------------------------------------------------------------------------------------------------------------------------
Some may disagree with me but I have never considered wiping Cache/Dalvik Cache a "Clean Install".
(using AcmeUninstall/AcmeInstaller3 would be a clean install too).
Clean Install vs Dirty Install Rom/Updates via Recovery: (After initial install with Acme3)
Generally, if your recovery is working right (each one has had issues at some point in it's development on every device I've had), the typical steps I've seen...
"Clean installing" a rom usually means to format the 3 basic partitions (& sometimes the /boot too depending on the rom/kernel script) and flash the rom as recommended by most devs to avoid issues (some rom installer scripts will handle the formatting for you, but shouldn't be assumed unless stated by the rom's developer. 9-14-13: See Attachment for example).
"Dirty Installing" a rom typically involves formatting the system & cache (sometimes only the cache :thumbdown: ) and flashing a rom to preserve /data partition with user apps & settings.
A cleaner method for this is to format all 3 partitions, flash rom, and restore only /data from a backup.
I've rarely seen dirty installs recommended by devs, but when I have seen them say it was "OK to try", it was done on the same rom/firmware base between incremental rom updates only (vs b/w CM7 - CM9 or CM9 - CM10, etc), and if you had a bug, you needed to go back and do a clean install before reporting it or expecting help. I will add that many people have been successful restoring their CM9 data after flashing CM10 & Gapps.
Basic CWM Recovery Info
CWM Recovery Backup, Format/Wipe, Restore, & Flash: ! MAKE SURE YOU READ THE NOTES IN THE OP AT THE TOP FIRST !
You CAN get into RECOVERY by: pressing [pwr] and selecting "boot ClockworkMod" from the bootloader (Moboot) when powered off.
You CAN get into RECOVERY by: holding [pwr], selecting "Reboot", then "Recovery" from within CM9/10.
Sdcard/clockworkmod/ (This is the folder CWM Recovery creates/uses.)
________________ /backup (recovery's backup of /system, /data, /boot.img, etc. are saved here by date. You can edit the filename.)
________________ /download (If you use CWM Rom Manager, it will place its downloads here. I've never used it.)
After the device has a Custom recovery, the recovery can be used to:
1) Flash/install .zip files:
- New/rooted kernels, including boot.img files (controls how the o.s. works with hardware)
- Roms (complete /system & /data file with kernel, custom apps, modded settings)
- Bootanimations (should be correct resolution)
- Other system improvements
- Themes (modify look of device/menus etc. Usually specific to each device (ie HP TP) & FW/Rom Base (ie CM9 vs CM10)
Must clear "dalvik cache" & may need to flash "deodexed template" or deodexed Rom, boot to system, before flashing each theme).
2) Make .tar(or dedup) backups of /system, /data, & /cache. Also backs up /boot ( boot.img or Kernel), and some versions may backup /recovery (recovery.img ), /wimax (wimax.img ) if available, that can be restored, usually together.
Note: Format the appropriate partition before restoring. (Usually format/wipe the first 3.)
It’s a good idea to make an initial backup right after you install the custom recovery. Then you can just format, restore the backup, if things get messed up.
3) Format/wipe the 3 main partitions and flash other partitions (depending on recovery version):
/system (o.s., system apps)
/data (google acct, app & phone settings, downloaded/installed apps)
/cache (used by o.s. to access info/apps, includes "/dalvik cache")
Android Partitions Explained
----------------------------------------------------------------------------------------------------------------------------------------
Controls:
[ Vol Up/Dwn ] = move or highlight selection
[ Home ] = select item/option
Note: On CWM Touch versions HW controls may still work.
How to Flash a Zip (Generally):
Place the .zip on the SDcard (or Sdcard/zip or similar folder of your choice)
Boot to recovery.
-> WIPE CACHE (habit of mine)
-> INSTALL ZIP FROM SD CARD -> CHOOSE ZIP FROM SDCARD
(navigate to where the zip is and select it)
-> REBOOT SYSTEM NOW (may need to "Go Back" to get to reboot option)
How to flash a rom (Generally):
- Make a backup in recovery first (/system, /data, /cache, etc.)
- Format/wipe the 3 partitions as appropriate.
(some Rom zips will do this for you, but may require a specific recovery coding such as “Edify” in CWM).
- Flash the Rom.zip (and any supplements like Gapps)
- Reboot to system, let it load, Verify functions
How to flash a theme (Geneally):
- Go to recovery, Wipe " Dalvik Cache ",
- Flash the " Stock Deodex Template" or Deodexed Rom (Depending on your version)
- Reboot to system, let it load, Verify functions
- Go To recovery, ADVANCED, Wipe "dalvik Cache"
- Flash the theme you want, ie GreenSteel.zip
- Reboot to system, let it load, Verify functions
Note: Anytime you wipe cache/dalvik cache it will take longer to boot the first time (ie Android is Updating).
Back up & Restore your file system with CWM recovery (DETAILED)
1 - (Enter Recovery)
-> BACKUP AND RESTORE -> BACKUP (This will separately backup: boot.img, /system, /data, /cache, wimax.img, etc)
Note: If you prefer the dedupe (.dup) backup format over .tar (default) and want to change the setting,
go to -> CHOOSE DEFAULT BACKUP FORMAT (before creating your backups)
* NOTE: you can stop here if you just want a backup*
2- (Format Manually through Recovery)
-> WIPE DATA/FACTORY RESET ( this will format the DATA & CACHE partitions for you in one shot )
-> MOUNTS AND STORAGE -> FORMAT SYSTEM
-> FORMAT DATA (Optionally there if needed, i.e. to restore only data partition)
-> FORMAT CACHE (Optionally there if needed)
4- (Restore Manually through Recovery)
-> BACKUP AND RESTORE -> CHOOSE YOUR BACKUP
-> RESTORE (This will restore all parts of the backup: /system, /data, & /cache, /boot [ boot.img or Kernel], /recovery [recovery.img], /wimax [wimax.img], SD-EXT if setup )
Note: If there is more than one, the numbers are a date/time stamp (ie: 2012-02-16.06.14.40 is Feb.16, 2012 at 6:14AM), so choose the appropriate one.
I typically change the name later, ie: "2012-02-16 CM9andApps".
(9-14-13 edit: Changing the name in newer CWM recoveries may create "MD5 checksum" errors and prevent a restore. Needs verified).
4.1- ADVANCED OPTION (Restore portions of backups individually, typically used to restore /data after Rom Update)
-> ADVANCED RESTORE -> CHOOSE YOUR BACKUP IMAGE ( /system, /data, /cache, /boot, /recovery, /wimax, SD-EXT)
-> RESTORE
5- (Reboot)
-> REBOOT SYSTEM NOW (may need to "Go Back" to get to reboot option)
CM9/CM10 First Time Install Links
CM9/CM10 First Time Install/Discussion threads
(XDA) Roland Deschain's How to install jcsullins CM10 Unofficial Build 20121216, with Sound, Camera & Microphone
(Also has Cm9 install info and zip packages with all current files.)
(Rootz) Nevertell's CM9 Install Directions in Post 19 of Newbie Questions thread
(@ NT, this is worthy of it's own thread or rolled into the OP of Travis' CM9 thread)
(Liliputing) How to install Android 4.0 or 4.1 on the HP TouchPad (CyanogenMod)
(This is a great guide and the one I originally used, but the linked install files for AcmeInstaller3, Cm9/10, Gapps, Moboot 3.8, & Cwm6 are out of date)
JcSullins' HpTouchpad Goo.im folder
(source for many current files: Cwm6, Moboot, Acme3, AcmeUninstaller, CM10.0 Experimental, etc)
Official CyanogenMod 9 HpTouchpad Downloads
(Click the "Nightly" link for now)
Latest Goo.im Google Apps Downloads
(Must match your CM base, ie CM9, CM10.0, CM10.1)
CM9/CM10 Support/Discussion Threads
(Rootz) Travisross69's [ROM] Official CyanogenMod 9 Nightly Build Discussion
(Rootz) Roland Deschain's How to install jcsullins CM10 Unofficial Build 20121216, with Sound, Camera & Microphone
(Xda) Imfloflo's [NIGHTLY] [ROM] CyanogenMod 9
(Xda) BigSimon's [ROM] [12/16] Unofficial CM10 Preview by Jcsullins Now with sound+camera
mpgrimm2 said:
one more post for me
Click to expand...
Click to collapse
What is this all about ?
Menthe is MIA on his JcSullins CWM6 thread since Dec 7th. I requested (Dec 20th) to take over the thread but the Mods recommended I just create a new one and they would merge it. I waited long enough and I think people may find the info useful if they don't want to use a pc/Acme3 to do all their rom updates/nightly's. I will duplicate this over at Rootz once I am all setup.
this is a lot of useful info. thanks for putting it together
Re: [RECOVERY] JCSullins' Touchpad CWM6 Recovery v6.0.1.9 [2012-12-15]
mpgrimm2 said:
Menthe is MIA on his JcSullins CWM6 thread since Dec 7th. I requested (Dec 20th) to take over the thread but the Mods recommended I just create a new one and they would merge it. I waited long enough and I think people may find the info useful if they don't want to use a pc/Acme3 to do all their rom updates/nightly's. I will duplicate this over at Rootz once I am all setup.
Click to expand...
Click to collapse
I'm sorry I'm a little lost I am new to this thread but I am NOT new to the touchpad nor xD a when did you have to use a computer to update CyanogenMod I didn't know people needed to do that because I just do it right through my touchpad. I am so glad I came to the threads because I thought only cm mod was available. Now only if I port gay bi sorcery over here this would be crazy it is the best rom out there it has more tweaks than every other ROM combined literally. It's so large and crazy it ca there is a central server for a lot of the mods an tweaks because it would be too large
Sent from my cm_tenderloin using xda premium
Crwolv said:
I'm sorry I'm a little lost I am new to this thread but I am NOT new to the touchpad nor xD a when did you have to use a computer to update CyanogenMod I didn't know people needed to do that because I just do it right through my touchpad. I am so glad I came to the threads because I thought only cm mod was available. Now only if I port gay bi sorcery over here this would be crazy it is the best rom out there it has more tweaks than every other ROM combined literally. It's so large and crazy it ca there is a central server for a lot of the mods an tweaks because it would be too large
Click to expand...
Click to collapse
Post 2 & 4 give a basic background on the issue. Basically, early recoveries were creating file system corruption when formatting partitions. It didn't always produce noticeable problems, but it was there. The workaround was to use AcmeInstaller3 from a PC for installs/updates and then restore a backup from within Recovery. Acme3 reformats the partitions correctly and would list/scroll all the file system errors before it fixed them (sometimes taking 15 - 20 mins to finish). Jc's CWM6 fixed the problem so it's ok again to do everything from recovery.
Remember you move to CM10, your system partition size needs to be @ 400mb (done initially with Acme3).
I'm not sure what the rest of your post is about.
Added Roland's Video and link to Koush's explanation of .dup vs .tar backup settings.
Just for grins and giggles (and with limited script reading skills), I decided to have a look at the installer script in TP CM9/10 zip package and found the following.
Code:
unmount("/system");
show_progress(0.500000, 0);
format("ext4", "EMMC", "/dev/store/cm-system", "0");
mount("ext4", "EMMC", "/dev/store/cm-system", "/system");
This confirms the fact that the CM9/10 zip will format ONLY the system partition for you during install, so if u want a clean install all that is needed (for CM9/10, not necessarily all roms) is to do a "wipe data/factory reset" (formats /data & /cache) and flash the zip.
So if u are just upgrading from a prior CM "nightly" to the current one, you can do a simpler "dirty install" by wiping/formatting cache and flashing the CM zip to retain your data (this assumes u have no file system corruption from earlier recoveries on your data partition).
I still stand on my general steps for "clean" & "dirty" installs via recovery since there isn't a guarantee that the rom developer setup the installer to do any formatting for you like CM9/10 does. The extra format shouldn't hurt in the long run (before the TP is obsolete anyway).
Sent from my "Up all night, sleep all day" HP CM9 Touchpad
sorry, it's a badly written post
1. Have to include a changelog
2. whether it's beneficial...
stayfidz said:
sorry, it's a badly written post
1. Have to include a changelog
2. whether it's beneficial...
Click to expand...
Click to collapse
PLease explain this statement better.
Are you referring to my OP, the previous post above yours, the whole thread, etc. Did you read through the thread and the "background" section to know what was going on with the TP recoveries before JcSullins' fixed it (not me or my work) or just look for a download link?
mpgrimm2 said:
PLease explain this statement better.
Are you referring to my OP, the previous post above yours, the whole thread, etc. Did you read through the thread and the "background" section to know what was going on with the TP recoveries before JcSullins' fixed it (not me or my work) or just look for a download link?
Click to expand...
Click to collapse
Hi, to the whole post, we're not all geeks by nature
1. By the way, what this recovery fixes, adds?
thanks again
You don't have to be a geek to "read and understand what you are doing first" (first statement in the op) before modifying your device. All users are expected to read and learn even a little bit. No one is going to spoon feed it to you.
Perhaps I am wrong, but it sounds like you are not bothering to read through posts 1 & 2. This thread isn't hundreds or thousands of posts long. There is even a link to a video by Roland Deschain about this Cwm6 next to the "contents" and an explanation on .dup vs .tar backups by Koush after the "contents".
Myself and others will help, but you have to be willing to roll up your sleeves and read a bit then come back with a question if u still actually have one.
Sent from my "Up all night, Sleep all day" EVO3D!
This was informative. I had no idea that there was a file corruption problem with older recoveries. That would explain a lot of issues I had. Just completely wiped my Touchpad back to factory (webOS default) then used ACME 3 to get CM10 back on with CWM6. Hope that solves my random issues. Thanks!
All the goo.im links are dead. Any other way to get this?
buddhag33k said:
All the goo.im links are dead. Any other way to get this?
Click to expand...
Click to collapse
Yes, head over to RolandDeschain's thread and download one of the cminstall.zip packages, its included in there.
[ROM GUIDE] How to install Jcsullins CM10/CM10.1 Unofficial Builds
Edit: Goo.im appears to be doing updates. Some of the files are back.
.

[Tutorial] LG Gpad v410 5.1 to 4.4 downgrade, root, & internal storage fix.

EDIT: If you are coming here for the first time, this guide should still work, but @PorygonZRocks has created a flashable zip that should deal with a lot of these issues automatically. You can check out his post here:
https://forum.xda-developers.com/showpost.php?p=75787067&postcount=699
This method will indirectly allow you to root the LG Gpad v410 after it has been upgraded to Lollipop 5.1.1. Yes. Rooting LG v410 Lollipop. It's through a downgrade, but it works.
It took a while to get working, but here's how I did it. The process is straightforward, but the details matter greatly. You will brick your device if you mess up. Please read everything *first* before you do anything. Be sure you understand the process. I'll try to explain what's going on along the way.
An external SD card is extremely helpful for this process. You *could* adb push everything, but that will tedious.
First, you need some files.
The 4.4.2 KDZ which is a TEST OS, but it can be rooted and it downgrades to a Bump'able bootlaoder:
http://forum.xda-developers.com/g-pad-10/general/kdz-lg-g-pad-7-0-v410-t3224867
The LG 2014 Flash Tool:
http://www.mediafire.com/download/fwrcd3pdj0svjtb/LG_Flash_Tool_2014.zip
Android LG Drivers:
https://www.androidfilehost.com/?fid=24052804347802528
Parted for Android. You can probably find it other places, but I found this file:https://dl.dropboxusercontent.com/u/84115590/LG%20G2%2016GB%20Solution/sdparted-recovery-all-files.zip
EDIT: There seems to be a lot of confusion here. My bad. All you need is the file named "parted" from this zip file - nothing else. Just put that one file in the root of your external SD card.
https://dl.dropboxusercontent.com/u/84115590/LG G2 16GB Solution/sdparted-recovery-all-files.zip linked from here: http://www.**********.com/your-32gb-lg-g2-shows-only-16gb-storage-space-heres-the-fix/
EDIT2: The dropbox link is down. I've attached the file directly.
The Candy5 ROM (This will potentially save you some manual steps. Somewhat optional, but highly recommended):
http://forum.xda-developers.com/g-pad-10/development/rom-candy5-g-pad-v410-lollipop-5-1-1-v2-t3111987
Flashify APK:
http://www.apkmirror.com/apk/christian-gollner/flashify/flashify-1-9-1-android-apk-download/
TWRP for the v410:
http://forum.xda-developers.com/g-pad-10/development/recovery-twrp2-8-5-0lgv400-410-t3049568
LG One Click Root:
http://forum.xda-developers.com/lg-g3/general/guide-root-lg-firmwares-kitkat-lollipop-t3056951
(You may use Purple Drake or whatever else you want. They all use the same root script as this does and the GUI is helpful for novices.)
Android SDK (specifically adb.exe. After installing go to SDK Manager and ensure that Android SDK Platform Tools is checked):
http://developer.android.com/sdk/index.html
For clarification below, when I have commands in "quotes" they are Windows commands. When they are in `backticks` they are commands that you run inside of ADB which actually run on your device....as root. Root can screw things up. Please be extra cautious. If you blame me for messing up your device I will laugh at you. But that's not gonna happen, right? Good. Let's go.
Now that you have everything, put it all into a folder where you can access it easily.
Install the LG Drivers.
Install Android SDK (or otherwise get adb.exe).
Extract all of the archives.
Move the KDZ to the LG Flash Tool 2014 folder.
Put the tablet into Download Mode by powering it off, holding VolUp, and plugging in the USB cable. Press VolUP when instructed. You must be in Download mode before continuing.
Run LGFlashTool2014.exe. Select the KDZ file. Click "CSE Flash". Click "Start". Select "English" and click OK. Do not change anything else.
WAIT for the flash to continue. If you really want to brick your device, here's a good opportunity.
The device will reboot into Android 4.4.2. You will only have 4GB of internal storage at this point. DON'T PANIC! We are fixing it.
Enable USB debugging.
Connect the device.
Install and run LG One Click Root. Wait for the device to be rooted before proceeding.
Copy the Flashify apk, TWRP image, and Candy5 ROM to your external SD card.
Install Flashify and flash TWRP to the recovery partition.
Use the Flashify menu to reboot in to recovery.
DON'T PANIC! You will get white vertical lines on the boot screen from now on. They only show up during boot animations. A small price to pay. This may be fixed at a later date. for the time being! Thanks to marcsoup's first post ever, we have a fix! Details below. PLEASE click this link and thank him!
Things get tricky here. Copy parted to your external SD card and then run "adb shell" from Windows to get a shell in TWRP.
In TWRP, unmount /data by tapping Mount > uncheck Data.
`cp /sdcard/parted /sbin/` This copies the parted binary to /sbin so it can be executed in the path. I had trouble running `/sdcard/parted`, but YMMV.
`chmod +x /sbin/parted` Make it executable.
`parted /dev/block/mmcblk0` Run parted against the internal mmc
`p` Prints the partition table.
`rm 34` Deletes partition 34 labeled "grow". This is the root of our problem. The KDZ apparently only creates a 4GB partition, I assume so the test build has maximum compatibility with all sized devices.
`rm 33` Deletes partition 33 "userdata"
`p` Print to verify
`mkpartfs` Create a partition and put a filesystem on it. If we only expand the partition it won't help us because the filesystem is still only 4 GB.
a) name: userdata
b) type: ext2 (the tool only supports ext2. This is ok for now.)
c) start: 3439MB (the end of part 32. IT MAY BE DIFFERENT FOR YOU!) Be sure you do not omit the MB part otherwise the offset will overwrite another critical partition.
d) end: 15.8GB (where "grow" ended above. IT MAY BE DIFFERENT FOR YOU!) Be sure you do not omit the GB part otherwise the offset will overwrite another critical partition.
`p` Verify. For me it did not name the partition properly. Gotta fix that.
(if necessary) `name 33 userdata` This is critical for mount to find it in /dev/block/platform/msm.sdcc.1/by-name/ on some/all ROMS.
`p`. Verify one last time. Compare it to my partition table in the attachments. If you want to brick, delete some random partitions here.
Flash Candy5 with TWRP. It's only 239 MB, so it will flash quickly. I do this because Candy5 will reformat mmcblk0p33 from ext2 to ext4 for you. It does this as part of it's system boot, apparently. If you install a different ROM that does not do this, you can reformat it by running `make_ext4fs /dev/block/mmcblk0p33`. If your ROM does not have make_ext4, it likely has some differnt method to make an EXT4 filesystem. `/system/bin/mke2fs -t ext4 /dev/block/mmcblk0p33` may work better. Just flash Candy5 and be done with it.
Tap Wipe > Swipe to Factory Reset.
Tap Reboot > System.
WAIT!!! It will take a minute for the ROM to start the first time. You will have white lines and and possibly a white screen. WAIT. It's moving the DEX files to cache, formatting a partition, creating default folders on the internal storage, and several other things. WAIT! When the screen goes dim or turns off then it's ready.
Cycle the display or turn it on. You should be at the Candy5 lock screen.
USB debugging is on by default. Run "adb shell".
`mount | grep userdata` Make sure mmcblk0p33 is mounted.
`df` Make sure /data is 11.3 GB (or whatever size it is on non-16GB devices).
HELL YEAH, you downgraded, rooted, and fixed the partition problem. Enjoy your tablet!
Thanks to dopekid313 for finding the KDZ.
Thanks to timmytim for Candy5.
Thanks to the creators of the root script, flashify, TWRP, and XDA for being so awesome.
Thanks to marcsoup for fixing a fix to the white lines.
Thanks to navin56 for the partition dumps. PLEASE thank his post!
White lines fix.
What we are going to do is flash the aboot partition with the stock image provided by navin56. I've removed the extra files from the dump, so simply download aboot.img.7z below. Unzip it using 7zip.
These commands are to be run in TWRP. Reboot to TWRP recovery and connect with "adb shell". All of the following commands will be run in ADB under TWRP. If you cannot figure out how to get here, please post in the thread and someone will help you. Onward:
If you do everything correctly then you don't have to reflash your ROM and you won't lose data. This process can be done any time after flashing the KDZ, even before you follow the steps above to resize the userdata partition. It's a completely separate process.
Unzip aboot.img.7z so you have the file named aboot.img. You should also make sure that aboot.img's MD5 sum is e97431a14d1cee3e9edba513be8e2b52. Do not flash the 7z file. Please.
Copy aboot.img to your external SD card. It should live at /sdcard/aboot.img
Boot to TWRP and run "adb shell"
`ls -al /dev/block/platform/msm_sdcc.1/by-name/` Let's make sure we are flashing the right partition. On my device "aboot" is /dev/block/mmcblk0p6. You should verify this on your device or you WILL brick your tablet.
`dd if=/dev/block/mmcblk0p6 of=/sdcard/aboot-fukt.img` Let's back up our current aboot partition before we go flashing things just in case there are unintended consequences later. Be sure you have the same partition that "aboot" referred to in the 4th step or you have just backed up the wrong partition.
`dd if=/sdcard/aboot.img of=/dev/block/mmcblk0p6` Be sure the file exists, is the correct aboot.img, and you are flashing the right partition. You have been warned!!
Reboot TWRP and enjoy your boot animations again.
If I missed anything, please let me know. As far as I know this is the very first tutorial that details what is necessary to accomplish this. Please hit the Thanks button on every thread that you visit to download files!
FAQ:
Q: Why do I only have 11.3 GB of space when my device is 16GB?
A: The entire internal SD card (eMMC) is 16 GB. Gotta have someplace to install the bootloader, recovery, android, the modem OS, the secondary bootloader, the cache, the resource and power manager, and all of the other partitions necessary for the table to operate. Please look at the second screenshot in the OP. All of those 33 partitions take up room on the internal card. Fortunately ALL of those partitions ONLY take up about 4.4 GB. Hence the 'userdata' partition is ~11.3 GB.
If anyone wants to use my work to create a flashable zip to make it easier for novices, please do so. My problem is solved and I don't have the time to create the zip. Please post any questions and I'll gladly answer them! I'm so stoked that we have a usable downgrade method now!
Thank You, Worked Great
Thanks for making this I was gonna do it but was to lazy lol and thanks for linking my thread and giving cred instead of just linking straight to the kdz thank you
grandamle91 said:
Thank You, Worked Great
Click to expand...
Click to collapse
Glad to be of help!
dopekid313 said:
Thanks for making this I was gonna do it but was to lazy lol and thanks for linking my thread and giving cred instead of just linking straight to the kdz thank you
Click to expand...
Click to collapse
Of course! If you hadn't obtained the firmware then we'd all still be looking for a solution. It pisses me off to no end when people try to take credit for other people's work. We all just need to realize and acknowledge that we are simply standing on the shoulders of those who did the work necessary for each of us to do our work.
I just noticed since we formatted the userdata it screws up TWRP. It won't mount Data and it says the settings are corrupted
grandamle91 said:
I just noticed since we formatted the userdata it screws up TWRP. It won't mount Data and it says the settings are corrupted
Click to expand...
Click to collapse
Is this after you've rebooted into Candy5 and the partition is reformatted as ext4 (or you've done so manually)? TWRP may not be able to mount an ext2 partition.
EDIT: I just tested this. Following my instructions and flashing to Candy5, TWRP sees mmcblk0p33 (userdata) as the full size and mounts it at /emmc.
For clarification, after you run the parted commands, it will mess with the partition table and TWRP will most likely not be able to see it to remount it - at least not until after a reboot. This is why you need an external SD card from which to install ROMs.
/data not mounted
Edit: nevermind. The partition 33 was still ext2. I had to run make_ext4fs /dev/block/mmcblk0p33 and now I am able to mount /data. Thanks.
Thanks for taking the time to help us.
I followed the steps and till 33 I am good. But once I am in Candy5, I am not able to adb shell (adb not recognizing device eventhough usb debugging is on). I rebooted to recovery and adb works there. But my /data partition is not enabled in TWRP. I am not able to check it either under Mount in TWRP.
Code:
mount | grep userdata
is empty
Code:
df
does not show data
I tried this and my tablet bootlooped. I was able to get into fastboot and restore. I would GREATLY appreciate it if someone who has the time, would kindly donate their valuable time to into making an exe zip or something.
gridironbear said:
I tried this and my tablet bootlooped. I was able to get into fastboot and restore. I would GREATLY appreciate it if someone who has the time, would kindly donate their valuable time to into making an exe zip or something.
Click to expand...
Click to collapse
At what point did it bootloop? What was the last step that you took before rebooting?
Zip
I would really appreciate a zip file as I have never been savvy with adb and for whatever reason it doesn't want to work on Windows 10.
drumm3rb0y said:
I would really appreciate a zip file as I have never been savvy with adb and for whatever reason it doesn't want to work on Windows 10.
Click to expand...
Click to collapse
A zip file for what part? The only part that requires ADB directly is to fix the internal storage. You absolutely have to flash the KDZ and then root before you can do anything. If you are on 5.x then you have no possible way to root, much less flash a zip file.
If you tell me what exactly you are having issues with I will try to help.
fatbas202 said:
A zip file for what part? The only part that requires ADB directly is to fix the internal storage. You absolutely have to flash the KDZ and then root before you can do anything. If you are on 5.x then you have no possible way to root, much less flash a zip file.
If you tell me what exactly you are having issues with I will try to help.
Click to expand...
Click to collapse
The adb part is the part im having issue with. Everything else is flashed already. I was wondering if you could make a zip for the adb part so I can just flash it through twrp.
thanks for the great help. it did work perfectly to regain the lost space.
what about white lines ? is there any solution for that problem ?
I have tried flashing back stock recovery extracted from kdz, dd' but didn't help.
Now i am thinking of flashing back the aboot.bin extracted from original kdz or i can dump ".img" from another working device. (i have 4 similar devices)
what is your opinion i m not a developer and i need your advise. should i go ahead and which partition should i dd ? aboot or abootb or boot ?
regards
shahidmianoor said:
thanks for the great help. it did work perfectly to regain the lost space.
what about white lines ? is there any solution for that problem ?
I have tried flashing back stock recovery extracted from kdz, dd' but didn't help.
Now i am thinking of flashing back the aboot.bin extracted from original kdz or i can dump ".img" from another working device. (i have 4 similar devices)
what is your opinion i m not a developer and i need your advise. should i go ahead and which partition should i dd ? aboot or abootb or boot ?
regards
Click to expand...
Click to collapse
I have no solid evidence of this, but I suspect that the white lines are caused by a display driver issue where when the bootloader hands over control of the display to the kernel it doesn't get reinitialized properly. I have no ideas as to how to get rid of that at the moment but if I stumble across something I'll be sure to post here.
While I'm not an Android developer, I've been a Linux admin for 10+ years and have a lot of experience with Android devices. I'd be really hesitant to go flashing things ad hoc. While Download Mode may save you if you flash the wrong thing, I'm not entirely sure what the limitations that you may run in to with a locked bootloader are.
After having this device for months on 5.x and FINALLY being able to downgrade and run custom ROMs with root, not seeing a boot animation is a pittance to pay. But I'll keep looking.
i have same problem entered in TWRP but when ADB sheel thorough DP tools it didn't connect to my device. i m also using windows 10
Do I need to Re-mount Data ? I press format data button at TWRP and mount data. It looks work great.
After all process, it shows 16Gb total at storage, 11.04GB available. it works perfectly.
I need the stock V41010d, so I reflash the stock rom rooted at [ROM][STOCK](V410 ONLY)KOT49I.V4101d | 4.4.2 | Rooted + Busybox
Now, my Gpad is at stock V41010d, but I have a question about the boot screen, is it still with white lines and white screen? Any method to fix it?
Hello,
Thanks for the great work. unfortunately I am facing some difficulty, starting from step# 16 "Things get tricky here", how to run"adb shell in TWRP?
also can I use minimal_adb_fastboot_v1.1.3_setup.exe as mentioned in the link in the OP http://www.droidviews.com/your-32gb-lg-g2-shows-only-16gb-storage-space-heres-the-fix/ ?
also I noticed the path have been used includes 'parted' folder, but the folder I have after unzipping the parted zip called 'sdparted-recovery-all-files', do I rename the folder to 'parted' instead?
please help and excuse my broken English.
I'm also having trouble with the adb shell step. When my device is powered on normally, adb commands work. However, in TWRP mode my computer can't recognize the tablet, mount properly, and copy over parted. All the steps have been identical to this point. Any ideas?
iphone5sf said:
Do I need to Re-mount Data ? I press format data button at TWRP and mount data. It looks work great.
After all process, it shows 16Gb total at storage, 11.04GB available. it works perfectly.
I need the stock V41010d, so I reflash the stock rom rooted at [ROM][STOCK](V410 ONLY)KOT49I.V4101d | 4.4.2 | Rooted + Busybox
Now, my Gpad is at stock V41010d, but I have a question about the boot screen, is it still with white lines and white screen? Any method to fix it?
Click to expand...
Click to collapse
You shouldn't need to remount or format data. The parted command nukes the filesystem and creates a new one formatted as ext2. At this point the running kernel has the old partition table loaded and won't know that the partition has been extended. Simply flash Candy5 and reboot at this point and it will reformat the userdata partition.
See above for the white lines during the boot animation. Known issue, no fix in sight, doesn't really matter.
nmnm4alll said:
Hello,
Thanks for the great work. unfortunately I am facing some difficulty, starting from step# 16 "Things get tricky here", how to run"adb shell in TWRP?
also can I use minimal_adb_fastboot_v1.1.3_setup.exe as mentioned in the link in the OP http://www.droidviews.com/your-32gb-lg-g2-shows-only-16gb-storage-space-heres-the-fix/ ?
also I noticed the path have been used includes 'parted' folder, but the folder I have after unzipping the parted zip called 'sdparted-recovery-all-files', do I rename the folder to 'parted' instead?
please help and excuse my broken English.
Click to expand...
Click to collapse
You only need the sdparted-recover-all-files.zip from that site. "parted" is not a folder, but the binary (without a file extension) inside of that zip file. Copy that file to /sbin and you are in business.
zmali1 said:
i have same problem entered in TWRP but when ADB sheel thorough DP tools it didn't connect to my device. i m also using windows 10
Click to expand...
Click to collapse
summonholmes said:
I'm also having trouble with the adb shell step. When my device is powered on normally, adb commands work. However, in TWRP mode my computer can't recognize the tablet, mount properly, and copy over parted. All the steps have been identical to this point. Any ideas?
Click to expand...
Click to collapse
I'd recommend installing the SDK and pulling the drivers from that. Alternatively, you can try the drivers here: https://github.com/koush/UniversalAdbDriver.
Technically, when I ran the "parted" commands I was actually booted in to rooted 4.4.2 from the KDZ; I wasn't actually in TWRP. It's just not a very recommended way of going about it. I explained how to run all of this from TWRP, but there's no technical reason that you *can't* run this from Android. You just *shouldn't* because you can't cleanly unmount the filesystem and it theoretically could cause filesystem corruption. I just figured that I don't care about that partition getting corrupted since it's getting wiped out.

[GUIDE] Formatting EXT4 to F2FS without losing internal storage & data

Hi everyone,
This is a simple guide on how to fomat ext4 to f2fs without losing any of the internal storage & data.
Cuz, nowadays many ROMs, specially the new marshmallow ROMs are having F2FS support. And f2fs has much better I/O perfomance when compared to Ext4 (it really boosts your bacon's read & write speed)
IMPORTANT: F2FS is useful only if the ROM & Kernel which you are using supports F2FS (it shoud be written in the description in the thread of the ROM & kernel). If it doesnt support, & you formatted partitions as f2fs, then maybe you wont be able to boot.
Code:
/* DISCLAIMER:
*
* Your warranty is... still valid?
*
* I am not responsible for bricked devices, dead SD cards,
* thermonuclear war, or you getting fired because the alarm app failed. Please
* do some research if you have any concerns about steps included in this guide
* before formatting the phone! YOU are choosing to make these modifications, and if
* you point the finger at me for messing up your device, I will laugh at you.
*
*/
First of all what is F2FS?
F2FS (Flash-Friendly File System) is a flash file system initially developed by Samsung Electronics for the Linux kernel.
The motive for F2FS was to build a file systemthat, from the start, takes into account the characteristics of NAND flash memory-based storage devices (such as solid-state disks,eMMC, and SD cards), which are widely used in computer systems ranging from mobile devices to servers.
Benefits:
- Much Increased I/O speed
- Increase life span of flash storage due to less write required
- Doesn't suffer file size limitation of 4GB​
Why F2FS is better than Ext4?
Because, it has much better I/O perfomance when compared to Ext4. It also has much higher write speeds. It is specially meant for eMMC card & to use its full potential. See various benchmarks & comparison of Ext4 & F2FS here: http://forum.xda-developers.com/showthread.php?t=2697069​
I even got very high UX I/O Perfomance Score in AnTuTu Benchmark (much higher than my old ext4 exodus cm12 ux score) (UX Score 29513 out of total score 56581) (Sultanxda CM13 build 4.4.2016, lightning kernel, /data & /cache formatted as F2FS): https://forums.oneplus.net/threads/cm13-what-is-your-antutu-score-in-cm13.440380 (see screenshot). ​
Why am I making a seperate guide? Isnt this very easy?
Cuz, many people (even I before) didnt know that formatting /data, /system & /cache to f2fs would wipe the internal storage too, and at later would end up crying after losing their precious internal storage files. This had happened to me a few weeks ago. And this involves some other steps too. So I am making this guide so that others wont lose their precious files.​​
Pre-Requisites:
OnePlus One (lol) & working usb cable
TWRP 3.0.1
ROM & Kernel that supports F2FS
Windows Laptop/PC with ADB Drivers & ADB 1.0.32 installed (how to install adb driver & adb is given in Steps 4 & 5) & with atleast 60GB Space in your PC.
70% battery in your bacon atleast.
Procedure:
If you are gonna wipe /system & /data for flashing new ROM (like a new cm13 rom), then first take titanium backup of all the required stuff.
Reboot to recovery mode (TWRP)
In TWRP, Go to Backup >> Tick all the partitions >> Go to options tab & enable compression (this will make the backup process slower but will make the backup files smaller, optional) >> Swipe to backup >> Wait until backup gets over. Dont cancel.
After the backup process is complete, go to twrp home >> Mount >> Enable MTP (if the button shows Disable MTP, that means MTP is already enabled) >> Now connect your opo to computer/laptop. In My Computer or This PC, it should show up as A0001 >> Now open the device A0001 in This PC/Computer >> Internal Storage >> Select everything (dont miss anything) >> Right click > Copy >> Now make a folder anywhere (I made it in root of C: drive) >> paste everything. This will take some time, wait till everything gets over. MTP is too slow & sometimes some files do not copy properly. Instead, do this failproof ADB method (for windows user): Install Universal ADB Driver from here (ignore if you have already installed adb)
Now download minimal adb & fastboot from here >> Open the downloaded file (Its a setup wizard) >> when it asks for installation path, change the default path to "C:\adb" (without quotes) & install it.
Now open command prompt (press win+R from keyboard, type cmd & press enter) & type the following one by one:
Code:
cd c:\adb
adb pull -p /sdcard c:\bacon_full_backup
The full backup is gonna take several minutes. Relax with some music until then. :good:
Now you are ready to go! WARNING: This step will wipe your /system completely. But dont worry. Everything is safe in your PC. Now go to TWRP Home >> Wipe >> Advanced Wipe >> tick system (verify if your ROM & kernel supports /system as f2fs, else skip this step) >> Repair or Change File System >> Change File System >> F2FS >> Swipe to change. Now your system partition is cleanly formatted to F2FS. [@Sultanxda's CM13 does not support /system as f2fs]
WARNING: This step will wipe your /data & internal storage (sdcard) completely!! . Go to TWRP Home >> Wipe >> Advanced Wipe >> tick data (verify if your ROM & kernel supports /data as f2fs, else skip this step) >> Repair or Change File System >> Change File System >> F2FS >> Swipe to change. Now your data partition is cleanly formatted to F2FS, & internal storage is empty (dont get freaked out, everything is in your PC!). [@Sultanxda's CM13 supports /data as f2fs.]
This step will wipe your /cache. Now go to TWRP Home >> Wipe >> Advanced Wipe >> tick cache (verify if your ROM & kernel supports /cache as f2fs, else skip this step) >> Repair or Change File System >> Change File System >> F2FS >> Swipe to change. Now your cache partition is cleanly formatted to F2FS. [@Sultanxda's CM13 supports /cache as f2fs.]
If you are flashing new ROM after wiping data & system, then skip the steps 12 & 13.
Now plug your opo into your PC & copy everything of the internal storage, which you copied erlier to your PC, back into the internal storage of OPO. This will take several minutes. MTP transfer is too slow. Instead, do the ADB method: Open a command prompt & type these commands one by one wait till it completes (will take a long time):
Code:
cd c:\adb
adb push -p c:\bacon_full_backup /sdcard
Now go to TWRP Home >> Settings >> tick use rm -rf instead of formatting (else while restoring the twrp backups, twrp will reformat the partitions as ext4 again).
Now go to twrp home >> restore >> select the latest backup (see the date & time in the name of the backup if you have multiple backups) >> tick every partitions >> tick enable md5 verification >> Swipe to restore.
Done.
Voila! Now your device is formatted as F2FS! Enjoy the much faster I/O read & write speed.
I actually made this guide here: https://forums.oneplus.net/threads/...-without-losing-internal-storage-data.439999/ & copy pasted in xda forum.
cool but i thought there would be no backup involved like windows where i changed from mbr to gpt without damaging data
Umm, So if I use 6.0.1 sultan I can format to f2fs except 'system' directory right?
That mean I need to skip step 6 . Am I right ?
Sorry for newb question XD
Oh my god.... This was the most obvious guide I have ever come across on XDA.... Please make a guide on how backup and restore my apps if I overheat and burn my phone?
dwaipayanray95 said:
Oh my god.... This was the most obvious guide I have ever come across on XDA.... Please make a guide on how backup and restore my apps if I overheat and burn my phone?
Click to expand...
Click to collapse
lol and apparently some people needs a 3 click guide and some full blown guide . hey, i respect the author for helping someone
#sychrome# said:
lol and apparently some people needs a 3 click guide and some full blown guide . hey, i respect the author for helping someone
Click to expand...
Click to collapse
No the author has has definitely put a great amount t of efforts to write.... I give him that.... I came to guide to find some other way of backing up the data from your internal storage partition directly... But copying g onto your laptop is something almost what everyone does... I think the warning that the OP gave after how formatting would erase the complete partition... I think it should indicate as to what happens.... He has stated that clearly too...
I was looking g for a better alternative
Might make sense to make a list of Roms and kernels that support F2FS, since people will come here out curiousity, and it would be the next logical step to find and flash a rom that support it.
Sent from my A0001 using XDA-Developers mobile app
the caf sultan 04/04/2016 suports system as f2fs? with Lightning Kernel v38?
hi. thanks for guide.
cd c:\adb
adb pull -p \sdcard c:\bacon_full_backup
Click to expand...
Click to collapse
but this lines dont work as should. for windows users this lines will work correctly (its work for me \ win 10 64)
cd c:\adb
adb pull -p /sdcard c:\bacon_full_backup
Click to expand...
Click to collapse
some things about 12 item:
for me adb dont want to work, because i wipe all partitions and didnt install the rom. After installing ROM, go to develop options and check adb debug, only after this step adb command in cmd was working well.
If i only convert to f2fs CACHE, so it lose internal storage & data?
Anzd said:
If i only convert to f2fs CACHE, so it lose internal storage & data?
Click to expand...
Click to collapse
Nope
so, can i do this tutorial on lastest stock cm13? or need custom rom?
Is F2FS stable yet? Last I heard it caused all sort of data corruption, freezing, etc.
How can I put a ROM on my phone after converting data and cache? In TWRP, mounting doesn't give me a storage device in Windows, and using ADB Sideload, it just gets stuck on 'starting service'. I plan to move from sultans CM12.1 up to CM13 but I dont know how to load a ROM zip onto the phone after converting the file system?
dwaipayanray95 said:
Oh my god.... This was the most obvious guide I have ever come across on XDA.... Please make a guide on how backup and restore my apps if I overheat and burn my phone?
Click to expand...
Click to collapse
For me, who just wants to flash (and destroy and flash and destroy again - 2nd bootloader ftw!) his 7 year old Samsung Galaxy S1, is this completely new. Never heard of f2fs before today.
For the SGS1, only roms from 5.x on supports f2sf. But its manditory to try the 6.x roms.
I thankfully stumbled across this guide - now im only in the need to figure out, which from with version on TWRP & CWM can do this trick, where i can found them and what i need to do, to be able to flash them. (If your handset is on android 2.2/2.3, its not that easy to change to an up-to-date version)
dogroll said:
Is F2FS stable yet? Last I heard it caused all sort of data corruption, freezing, etc.
Click to expand...
Click to collapse
Yes bro its totally stable! I am usng it in my OPO since I made this guide, and never experienced any issues so far.
monyozt said:
so, can i do this tutorial on lastest stock cm13? or need custom rom?
Click to expand...
Click to collapse
Stock COS13 doesnt support f2fs.
Anzd said:
If i only convert to f2fs CACHE, so it lose internal storage & data?
Click to expand...
Click to collapse
No
lapapunk said:
hi. thanks for guide.
but this lines dont work as should. for windows users this lines will work correctly (its work for me \ win 10 64)
some things about 12 item:
for me adb dont want to work, because i wipe all partitions and didnt install the rom. After installing ROM, go to develop options and check adb debug, only after this step adb command in cmd was working well.
Click to expand...
Click to collapse
Yup sorry for the mistake. Its a slash instead of a backslash in adb pull \sdcard.I have updated it.
Someone pointed out the same mistake in my OPO forums thread and had fixed it, but forgot to fix it in XDA thread.
hello i read the guide to convert filesystem, byt when i tick partition system and changhe file system with twrp 3.1.0 i can not chose f2fs is not present why? only ext2 ext 3 ext4 etc but not f2fs? why???
thanks

[SOLVED] Restore decrypted nandroid backup of FBE

Tried restoring a nandroid backup of the data partition with twrp.
also copied the /data/media partition back from an external copy.
when booting up the phone immediately reboots back into twrp with an error message:
Android Rescue Party...
The reported problem is:
'--reason=set_policy_failed_:/data/vendor'
the vendor partition seems to be intact and i do have a backup of it taken at the same time as the data backup, restoring it doesn't yield results..
i'm wondering if FBE is throwing it off, as the backup was taken when the phone was decrypted (within twrp) however the data on the partitions is referencing some sort of encryption key?
you may also exhibit the following error upon bootup of a restored nandroid backup.
immediately after booting, the phone reboots back into recovery.
viewing the log in twrp will show:
Android Rescue Party...
The reported problem is:
'--reason=set_policy_failed_:/data/bootchart'
1. the solution to this is editing fstab.​​under twrp or other recovery​mount /vendor from the mount icon.​​in twrp: Advanced > File Manager > /vendor/etc/fstab.qcom​select edit file under userdata, find where it says fileencryption=ice​rename fileencryption to encryptable.​​Original​
Code:
/dev/block/bootdevice/by-name/userdata /data ext4 noatime,nosuid,nodev,barrier=1,noauto_da_alloc,discard wait,check,fileencryption=ice,quota,reservedsize=512M
​​Modified​
Code:
/dev/block/bootdevice/by-name/userdata /data ext4 noatime,nosuid,nodev,barrier=1,noauto_da_alloc,discard wait,check,encryptable=ice,quota,reservedsize=512M
​save file.​
2. next delete the following directories:​
/data/unencrypted
/data/misc/vold/user_keys
3. Lastly delete any of the existing files from /data/system/ :​
locksettings.db
Gatekeeper.password.key
gatekeeper.pattern.key
locksettings.db-shm
locksettings.db-wal
recoverablekeystore.db
password.key
pattern.key
4. Reboot and re-encrypt​​
At this point rebooting from recovery will result in a running and successfully recovery backup.
one thing to note is the data and data/media partitions are at this point unencrypted
TRYING TO REINCRYPT NOW WILL FAIL to reencrypt got to settings > security > re set your pin or password for the phone
(optional) then select encryption and there will be an orange button to encrypt device.
the encryption process will take quite a while as it will reencrypt your entire phone.
The above doesn't work as it's trying to accomplish FDE, and the fstab line for encryptable=ice, isn't compatible with this.
i could not find an fstab string to follow the same option but for FBE.
​
Thanks for sharing, nice guide to disable forced FBE encryption! I think this applies to Android 12+ in general, not just OnePlus devices.
I ended up with the same problem on my Mi 10 Ultra with MIUI 13 after a /data partition restore and it was a real pain to solve ("set_policy_failed:..." rescue party error for different directories). It's strange though why it fails to set the fscrypt policy for existing directories with no policy, correct permissions and SELinux context...
(Btw: whether a fscrypt policy is applied to a directory ("is this directory encrypted?") can be checked with fscryptpolicyget in terminal.)
Unfortunately, this didn't directly solve my TWRP backup restore problem and I still had to do a manual restore, but now I can at least disable FBE and it's always nice to have actual control over the device you paid money for (you should really have control by default, but oh well...)
(Some of) the troubleshooting I did:
Like I mentioned, I first thought the issue might be with the SE linux context, so I tried running restorecon, but this didn't help - I eventually found that in init.rc, restorecon is usually already automatically run during each boot for directories under /data/... so running it manually makes no difference.
To edit /vendor/etc/fstab.qcom (or /system) on my device, I had to first disable the shared blocks EXT4 optional feature. I followed this nice guide to unpack/repack super.img. But this is missing the step for disabling shared blocks: when I tried to mount any of the unpacked images (e.g. vendor.img) as R/W, it failed with the useless generic error:
wrong fs type, bad option, bad superblock on ...
Click to expand...
Click to collapse
Then dmesg gave me another clue, but at the same time was still cryptic and not immediately helpful:
EXT4-fs (loop*): couldn't mount RDWR because of unsupported optional features (4000)`.
Click to expand...
Click to collapse
So I guess 4000 is the code for shared blocks and you can disable these with e2fsck -E unshare_blocks <your .img file or loop device> (and probably need a filesystem check with e2fsck -yf <file>). Again very annoying that these numerical feature codes are not mentioned anywhere in the e2fsck manual pages for example.
Anyway, I was finally able to either:
1. mount vendor.img on my PC (mount -o loop vendor.img /mnt/vendor) and edit the /mnt/vendor/etc/fstab.qcom right there before repacking the .img and flashing the new edited super.img to my device
or
2. just repacking the vendor.img with shared blocks disabled and size increased (resize2fs vendor.img <new size>) and flashing the new super.img without other modifications - this way /vendor can also be mounted as r/w in Android and changes made later (mount -o remount,rw /vendor).
The worst part is that in the end, even with decryption disabled and the keys deleted, the device still wouldn't boot after a /data restore from TWRP (and after multiple days spent on debugging )... I still had to manually extract the TWRP backup and move directories/files individually - thankfully no issues with app/ or data/ - I think the problem was with some files in either system/ or misc/, but idk for sure. I just manually went through and kept only what seemed important (saved wifi APs, BT devices, SMSs etc, but not saved accounts). And after this it finally booted with all my apps and (most of) my settings!
(Btw2: a TWRP/nandroid backup is apparently just a bunch of separate tar.gz files, not a split archive, so you can just extract them with for file in ../data.f2fs.win*; do echo "extracting $file..."; busybox tar -xzf $file; done)

Categories

Resources