Formatting /data for a custom "ROM" ??? NO !!! - Xiaomi Mi CC9 / Mi 9 Lite Guides, News, & Discussi

Hi all,
A lot of people here and there are struggling to boot their new custom roms.
To be short :
=========
format /data (not wipe) is " NOT " mandatory for every new rom installed like many think because this will erase the whole " internal storage ".
To avoid that, just do a simple " wipe ". Then go (with the TWRP file manager) to /data and delete the residual "encryption" folders and files and keep only /media folder.
Doing " format " is only needed when you change your file system (for a kernel reason) : ext4 <=> f2fs !!!
Don't use any " Encryption disabler .zip ", otherwise your FOD will not work !!!
That's all.

Just to be clearer, you have to delete all inside /data, unless /media folder.

Salieri99 said:
Just to be clearer, you have to delete all inside /data, unless /media folder.
Click to expand...
Click to collapse
I think the problem with the term 'delete' is that people will think you mean 'wipe'. 'Wipe' and 'format' actually mean different things. The latter is what is actually required.

This method will not Work at 100%
It depends on the encryption Key from the Rom
Deleting /Data without deleting Media will simply Work to have a bootable State of the flashed Rom but your internal Data will be encrypted and your Rom cant decrypt /Data/media anymore also the Recovery after reboot.
it Happens because of a different Decryption Key in /Data
For Safety and Security reasons i would Not recommend doing this, unless you have a Backup.

Smilex93 said:
This method will not Work at 100%
It depends on the encryption Key from the Rom
Deleting /Data without deleting Media will simply Work to have a bootable State of the flashed Rom but your internal Data will be encrypted and your Rom cant decrypt /Data/media anymore also the Recovery after reboot.
it Happens because of a different Decryption Key in /Data
For Safety and Security reasons i would Not recommend doing this, unless you have a Backup.
Click to expand...
Click to collapse
1.the rom boots and can't decrypt data anymore ??? wtf is this ??? a new science ???
2.where do you think encryption keys are stored ??? in the cloud ???
3. a device with FOD requires encryption in data otherwise the FOD will not work !
4. how do you think i built the TWRP for this device ???? (check my first thread in the forum for this device)
You should never talk about things you don't know very well !!!
The world is upside down these days ... and i'm really bored with idiocracy !

Sorry If i have Not so much knowledge.
But i have done your steps above
Went from Evo X to Derpfest Rom
Everything was fine then i realised my Internal Storage was encrypted.
Maybe i forgot to mention ive used Official Twrp Not your twrp, also maybe its my own mistake
Thank you for your serious words.

Smilex93 said:
Sorry If i have Not so much knowledge.
But i have done your steps above
Went from Evo X to Derpfest Rom
Everything was fine then i realised my Internal Storage was encrypted.
Maybe i forgot to mention ive used Official Twrp Not your twrp, also maybe its my own mistake
Thank you for your serious words.
Click to expand...
Click to collapse
All devices with FOD (fingerprint on display) require encryption to work (These are the new standard policies by Qualcomm & Google). If you use a decryption script that you can find here and there ... your FOD will not work !!! It's not a normal fingerprint ... can you understand ???
My TWRP was made 3 months before the official one. It's built by stock official blobs from xiaomi !
The official TWRP uses a generic kernel not official kernel by xiaomi ! So there are and will be always
some stuffs missings !!! That's why there are many people struggling with backups and rom installations !

im almost got it.
But the only except is Dirty unicorns Rom, they need always an internal storage format.
They are not using Public keys
maybe i known why from alex cruz

gringo80 said:
All devices with FOD (fingerprint on display) require encryption to work (These are the new standard policies by Qualcomm & Google). If you use a decryption script that you can find here and there ... your FOD will not work !!! It's not a normal fingerprint ... can you understand ???
My TWRP was made 3 months before the official one. It's built by stock official blobs from xiaomi !
The official TWRP uses a generic kernel not official kernel by xiaomi ! So there are and will be always
some stuffs missings !!! That's why there are many people struggling with backups and rom installations !
Click to expand...
Click to collapse
if i am just going from Miui EU to New or older MIUI Eu roms ... will i have be encrypted also or not ?

gringo80 said:
Hi all,
A lot of people here and there are struggling to boot their new custom roms.
To be short :
=========
format /data (not wipe) is " NOT " mandatory for every new rom installed like many think because this will erase the whole " internal storage ".
To avoid that, just do a simple " wipe ". Then go (with the TWRP file manager) to /data and delete the residual "encryption" folders and files and keep only /media folder.
Doing " format " is only needed when you change your file system (for a kernel reason) : ext4 <=> f2fs !!!
Don't use any " Encryption disabler .zip ", otherwise your FOD will not work !!!
That's all.
Click to expand...
Click to collapse
To avoid encryption problems between flashing different roms the easiest thing to do is just go to lockscreen settings and delete the PIN or Pattern, this will delete the FP stored as well and you can then flash any rom you want without issues. No more encryption problems and no need to flash any zips and kill the FOD.
Also, I always wipe data as well as "internal storage" if changing roms, there's nothing wrong with that... That way I have a perfectly clean start.

gringo80 said:
Hi all,
A lot of people here and there are struggling to boot their new custom roms.
To be short :
=========
format /data (not wipe) is " NOT " mandatory for every new rom installed like many think because this will erase the whole " internal storage ".
To avoid that, just do a simple " wipe ". Then go (with the TWRP file manager) to /data and delete the residual "encryption" folders and files and keep only /media folder.
Doing " format " is only needed when you change your file system (for a kernel reason) : ext4 <=> f2fs !!!
Don't use any " Encryption disabler .zip ", otherwise your FOD will not work !!!
That's all.
Click to expand...
Click to collapse
U used some roms or only your lineage?

This is exactly what I was searching for!
Does this apply to other phones as well? The ones for which ROM developers always ask to format the internal storage on the phone (OnePlus 6T for me)?
Now that I've finally found this thread, I'd like to also know, is encryption the only culprit due to which it's recommended to format all the data? If yes, why wouldn't one simply remove their screen-lock (I assume that will decrypt any data on the phone), change ROM without formatting internal storage and then keep another screen-lock?

Actually, encryption issues jumping from ROM to ROM is more complicated than that if you don’t know what encryption type is used by the ROMs.
A. Sometimes you might need to format (not just wipe) the data partition. If you format the data partition before flashing the new ROM, then you must reboot OrangeFox immediately afterwards, and, most definitely, before doing anything else.
B. If you are moving from a ROM that uses a different encryption protocol (eg, from FDE ROM to FBE ROM or vice-versa), then you must format the data partition preferably after flashing the new ROM, and then boot to system.
C. If you are moving from a stock ROM to a custom ROM (or vice versa), then you must format the data partition.
D. If you boot the newly flashed ROM, and it gets stuck forever on the Google/Android logo, or just dumps you at fastboot or straight back to OrangeFox, this might be a sign that you need to format the data partition.
source : https://wiki.orangefox.tech/en/guides/flashing

You are right Just
gringo80 said:
Hi all,
A lot of people here and there are struggling to boot their new custom roms.
To be short :
=========
format /data (not wipe) is " NOT " mandatory for every new rom installed like many think because this will erase the whole " internal storage ".
To avoid that, just do a simple " wipe ". Then go (with the TWRP file manager) to /data and delete the residual "encryption" folders and files and keep only /media folder.
Doing " format " is only needed when you change your file system (for a kernel reason) : ext4 <=> f2fs !!!
Don't use any " Encryption disabler .zip ", otherwise your FOD will not work !!!
That's all.
Click to expand...
Click to collapse
Thats right just changed my Rom for Crdroid to Spark I didnt format data just WIPED it. The rom Boots up clean. I also deleted the ANDROID folder in case. there were nothing else in the DATA. You must have to Flash Force Decrypt file after flashing a rom

Related

To CM13 users. DO NOT USE ENCRYPTION. details and fix if you've already done inside

just fyi. cm13 has no option to decrypt once you've encrypted it, twrp cannot mount encrypted drives (atleast most of the time i've heard a few say it can that's why i tried it but 2.8.7.0 doesn't even ask for a password or try to decrypt in my case)
so pretty much once you encrypt your stuck with the rom you have unless you have this magical twrp that asks for decrypt password.
also to make things worse, twrp can't format and cm13 changes the sdcard path so although it sees the external sd it can't flash files from it (atleast on g3)
so the only way to fix is to boot into android, backup your internal storage to sdcard or computer
reboot into twrp run a manual format on /data/ from terminal command, then reboot, copy your twrp backup to internal sd, go back to recovery and flash backup, then copy internal sdcard files back to internal drive (from sd or computer backup)
the command to format is the following
mke2fs -T ext4 /dev/block/mmcblkXpXX (NOTE: REPLACE THE XpXX with the proper values for your device) you can find these values by asking in your device forums, or downloading a partition info app that will tell you and i'm sorry i can't remember the one i used, but this is the best way to be sure because even diff device variants sometimes have diff partition tables based on phone provider.
*edit* just for personal peace of mind i remind everyone that every device is diff and i cannot guarantee positive results but this 100% worked for me everything is back to normal.
I did this a few months back and ended up flashing factory images via adb and starting all over again which sucked
Very useful information. :good:
TWRP v3.0.0 can use the adopted storage device (encrypted SD card) now.
Seems it's been fixed because I am successfully using cm13 with twrp 3.0, albeit with visible performance loss.
I just want to say thanks a lot for this. I can once again mount my /data partition.

/data Filesystem change GUIDE from Ext4 to F2FS WITH Restoring ROM Data

//////////// USE IT AT YOUR OWN RISK AND I AM NOT RESPONSIBLE FOR ANY FAILURE OR BRICKED DEVICES /////////////////
THIS IS NOT a PUBLICITY for Any ROM or KERNEL
They are Simply just what i use
I have successfully changed my data partition to F2FS and using arter kernel as well
Also I have managed to get the Data back in place so after the whole operation all my ROM data are intact
NOTE THAT YOUR ROM & KERNEL MUST SUPPORT F2FS TO BE ABLE TO BOOT
Note that changing any partition filesystem from a type to another will require formatting that partition
From what i understood converting /system and /cache to f2fs is useless hence I converted /data only as it the main partition that you write on
First of all your internal storage is in /data/media/0 path and hence it will be wiped
I used the official TWRP to be sure of no issues
Take care of the 12th step as if it was missed you will start from scratch >> CRITICAL
Note that Fstab file already contains DFE so if you are unecrypted like my case flashing Fstab keeps me unencrypted without flashing DFE
Now let's start the operation of converstion of/data from ext4 to f2fs in a step by step guide
1- BOOT TO RECOVERY
2- TAKE A FULL NANDROID BACKUP ( MOST IMPORTANT IS THE DATA PARTITION )
3- TAKE A FULL CLONE OF YOUR INTERNAL STORAGE while you are in TWRP( To PC either via MTP or adb command and i prefer the adb method as it ensure that all your files are copied including hidden files )
4- WIPE > Format Data > Yes ( it is a factory reset and all your internal storage will be wiped )
5- Reboot to recovery again
6- Wipe > Advanced Wipe > Check Dalvik , cache , system and Data > Wipe and DONOT reboot to recovery
7- Connect cable again and copy the FSTAB Tools ZIP file only
9- Flash the FSTAB TOOLS File
9- Wipe > Advanced Wipe > Check Data ONLY > Repair or Change file system > F2FS > Change File system
10-Copy via cable whatever you need from your internal storage or the whole of it as your wish
11-Ensure that the TWRP Backup you took in step 2 is copied to internal storage again
12-GO TO TWRP SETTINGS and Tick the 3rd option in the first TAB ( it is called use rm -rf instead of formatting )
13-The above step ensured that when you restore Data partition TWRP won't format it again to ext4 and leave it as f2fs
14-Restore > Choose your fresh Backup > RESTORE DATA PARTITION ONLY ( you will see a message that you are restoring a backup taken of ext4 filesystem , donot worry it worked in my case )
15-Flash the following in order : Vendor > ROM > Fstab File ( NOT the tools one ) > Gapps > Arter97 kernel > Reboot
16-You should boot to the OS with all your data ( settings ) like they were intacted and now the /data partition is f2fs
17-Restore your internal storage if you still didnot do it in step # 10
18-Reboot to recovery and Flash Magisk ( optional )
Notes :
- I though that 4th step was useless however it is mandatory as it erases Vendor or something similar
- I though that 6th step is duplicate to 4th step and was useless however without it TWRP didnot change filesystem to F2FS
- The FSTAB must be flashed after every vendor update ( it can be before or after ROM in the sequence , the most important that it is after every Vendor BEFORE YOU BOOT )
- I didnot flash magisk in step # 15 as crCroid recommends that you boot to system one time before you flash magisk
- crDroid default kernel doesnot support f2fs and if i didnot flash arter97 i wouldnot be able to boot
- By this setup i cannot go back to crDroid default kernel anymore unless f2fs is supported by it
- If ROM doesnot support f2fs the system wouldnot Boot as it would not be able to understand the /data partition filesystem
- Ofcourse any Kernel and ROM combo that supports F2FS should be valid to apply this guide
Finally thanks for all the Devs for thier hard work and dedication , You all made our POCO a lovely BEAST
I think this thread is belong to guides&news and discussion forum
thanhnvt194 said:
I think this thread is belong to guides&news and discussion forum
Click to expand...
Click to collapse
Yes i you are right but do not know how to move thread from a forum to the other
Thanks @shouk_1987, good guide. Any chance you can provide a link to the FStab files mentioned in your post?
Is this arter kernel specific? I used shadow kernel and the fstab changes are flashed with the kernel
dgrasley said:
Thanks @shouk_1987, good guide. Any chance you can provide a link to the FStab files mentioned in your post?
Click to expand...
Click to collapse
They are in arter kernel thread in the OP
Thread moved to the correct section.
LTT
So, does this work with crDroid? I ask because both rom and kernel must apparently support f2fs and @gwolfu has indicated crDroid does not.
piet8stevens said:
So, does this work with crDroid? I ask because both rom and kernel must apparently support f2fs and @gwolfu has indicated crDroid does not.
Click to expand...
Click to collapse
crDroid Kernel doesnot for now
While the ROM does
What about my apps and its data, can I restore it back?
Edikuun said:
What about my apps and its data, can I restore it back?
Click to expand...
Click to collapse
Read the guide carefully
You will br able to restore everything but the most part that needs patience is restoring internal storage
works on miui ?
RubenPCA said:
works on miui ?
Click to expand...
Click to collapse
Didnot try but saw other users says it works
Which kernels/ROMs are supported?
Shished said:
Which kernels/ROMs are supported?
Click to expand...
Click to collapse
Read in the OP of the ROM / Kernel you want
A lot aupport f2fs now
a great guide . Any way to do the same(restore data) if ee wanna go back from f2fs to ext4? just in case.
Debraj903 said:
a great guide . Any way to do the same(restore data) if ee wanna go back from f2fs to ext4? just in case.
Click to expand...
Click to collapse
Didnot try but I believe it is the same concept
My internal storage went from 30GB free to 15GB free
Edikuun said:
My internal storage went from 30GB free to 15GB free
Click to expand...
Click to collapse
I am the opposite I have 2 gb increase
Least version for Poco is 64 gb , which version do u have ?
shouk_1987 said:
I am the opposite I have 2 gb increase
Least version for Poco is 64 gb , which version do u have ?
Click to expand...
Click to collapse
It's okay now, I forgot to delete my twrp backup and titanium backup. Anyways, nice guide! Successfully converted to f2fs

0 mb in TWRP internal storage

I searched for an answer and noticed it's a common issue. I am trying to flash a kernel on to my already flashed rom. I was wondering if there is a more current fix. More importantly, how can this be avoided in the future. Thank you guys!
Its caused by a bug/error with either the filesystem or encryption.
Did you wipe data after flashing the new ROM? Data from stock usually doesn't work with custom ROMs.
Do you have a PIN/password on Android?
Are you using the latest build of TWRP?
Press the menu button at the bottom of the screen in TWRP and post what the error message is in the red text.
It's caused by no root access
djhulk2 said:
It's caused by no root access
Click to expand...
Click to collapse
Something is probably wrong with the data partition. TWRP should always have root access.
Try in TWRP:
Wipe > Format Data > Slide to format
This will erase the data partition, so backup everything to a PC in Android first if needed. It should allow TWRP to mount /data again.
KemikalElite said:
Something is probably wrong with the data partition. TWRP should always have root access.
Try in TWRP:
Wipe > Format Data > Slide to format
This will erase the data partition, so backup everything to a PC in Android first if needed. It should allow TWRP to mount /data again.
Click to expand...
Click to collapse
I've debated on doing this. I'm not worried about losing pictures texts etc as they're backed up.
I read that it essentially leaves the device with no OS. If that's wrong please let me know!
I have found that if I choose Slot A and reboot system it reboots me in to TWRP. If I choose Slot B it runs the OS like normal (except I still have issues using Facebook and it's services).
The ROM works and I can perform all the custom mods on it. I just want to flash a kernel and the problem persists. 0 mb in storage.
It's trial and error at this point. Fail fast fail forward. I have another phone I can use but I love the OnePlus. Any help will be appreciated!
https://andi34.github.io/faq/faq_twrp.html
I'm not willing to risk it until I know how to get the custom ROM on to the storage to flash it.
Yes formating by typing in yes will wipe it all,everything including pictures, with no rom on it at all. If u choose to do that, don't close twrp. Instead you should be able mount after wards, once mounted transfer the magisk zip, twrp, and your custom rom(has to be 1.5gb not 200mb through magisk). Flash magesik, install ram disk twrp, install rom. That was a method I've done before but if u want to keep everything there is other way
fastboot boot twrp.img, that command boots twrp if u have it or don't, installing to ram disk makes it permant...this boot command is just a one time thing each time. It's what I do when new firmware update, I loose root but I regain it each time
Never heard of formating data removing the OS, that would be if you wipe the system and normal wipe is like a factory data reset and therefore will not wipe your phone of the OS
djhulk2 said:
Yes formating by typing in yes will wipe it all,everything including pictures, with no rom on it at all. If u choose to do that, don't close twrp. Instead you should be able mount after wards, once mounted transfer the magisk zip, twrp, and your custom rom(has to be 1.5gb not 200mb through magisk). Flash magesik, install ram disk twrp, install rom. That was a method I've done before but if u want to keep everything there is other way
fastboot boot twrp.img, that command boots twrp if u have it or don't, installing to ram disk makes it permant...this boot command is just a one time thing each time. It's what I do when new firmware update, I loose root but I regain it each time
Click to expand...
Click to collapse
I attempted to format. It said
"failed to mount /data (device or resource busy)
"unable to mount storage"
Try this in recovery, sometimes its known to work.
Wipe > Advanced Wipe > Check Data and press Repair or Change File System > Change File System > Change it to EXT2.
Repeat the same process selecting Ext4
Wipe > Advanced Wipe > Check Data and press Repair or Change File System > Change File System > Change it to back to EXT4.
Try formatting data after this.
drey4211 said:
I attempted to format. It said
"failed to mount /data (device or resource busy)
"unable to mount storage"
Click to expand...
Click to collapse
Since you dont care about the data on the phone I would just do 1 of 2 things. 1st I would reflash twrp on to you phone if that doesn't work then I would just grab the fastboot ROM and just flash your phone back to full stock reroot and install twrp from scratch. I would not try to start repairing partitions. I wouldn't want to worry about screwing up the EFS partition
Well in an update, I formatted the
Storage and now I'm stuck in bootloader screen. It's unlocked but I'm having a hard time flashing a ROM through adb.
I use the twrp version 3.3.1-2
Best would be to just use fast command to boot it
But it should be under wipe/format data/then type in yes
That was what I was trying to have you avoid. If your can boot to fastboot download the fastboot ROM I told you to and run the flash-all.bat file. If your on 9.5.8 make sure you use the fastboot ROM of the same version. Do not flash azip of a different version firmware like 9.5.7.
It happens to me any time I'm in twrp and flash a rom then reflash twrp. It doesn't matter if I flash Magisk or not the issue always happens. What I do is use a USB C flash drive and plug it in when I want to flash/backup a rom. This way I can always access it. After flashing any rom then booting I'm always able to access my internal storage again. It seems like a bug in twrp.
The strange part is when this bug happens your files are encrypted in a 0 folder but you can still copy from your PC to your internal storage while in twrp.
I essentially soft bricked my device. Called OnePlus and they got me up and running. That's awesome that they have that service!
Are you removing all security? Pattern, pin and fingerprints? Are you decrypted? Never had an issue with flashing a ROM causing these issues which is why I'm asking. Something you've done at some point is causing this
I'm not sure what that was. Ironically enough I am now stuck in TWRP boot loop. Hopefully I can figure this out otherwise I have to call oneplus again.
I will admit I may not know everything but it's trial and error. I don't have anyone to really teach me this so I try to read the forums and learn. You guys have been great!
ajsmsg78 said:
It happens to me any time I'm in twrp and flash a rom then reflash twrp. It doesn't matter if I flash Magisk or not the issue always happens. What I do is use a USB C flash drive and plug it in when I want to flash/backup a rom. This way I can always access it. After flashing any rom then booting I'm always able to access my internal storage again. It seems like a bug in twrp.
The strange part is when this bug happens your files are encrypted in a 0 folder but you can still copy from your PC to your internal storage while in twrp.
Click to expand...
Click to collapse
I've the same issue.. did you find a fix? So annoying

Do I need to format data (deleting everything) to install lineageOS?

Hello, forum!
My current Pixel 2 is using the stock google system but I haven't updated the OS since March, partly because it's rooted
and the update process is not as easy.
Now that google said it'd only support the phone till this December, I'm thinking to install lineageOS.
However according to its installation guide:
...
3. Now tap Wipe.
4. Now tap Format Data and continue with the formatting process. This will remove encryption and delete all files stored in the internal storage.
...
It's surprising that it need clear internal storage?
p.s. I may also think about installing Resurrection Rom. Does it require 'formatting data' then?
Afaik you must back up everything before installing new ROM, because when you install custom ROM you will wipe and format system and it will erase everything in your internal storage
If its rooted try modded version of twrp to backup your internal data as well
armuttaqin said:
Afaik you must back up everything before installing new ROM, because when you install custom ROM you will wipe and format system and it will erase everything in your internal storage
Click to expand...
Click to collapse
No, it's not, nobody wipes /data/media during rom replacement only /data.
However if his bootloader is locked, bootloader unlock will wipe everything, so before switching from stock a backup is must.
Alright, guys. Thanks for the input. Guess I'll just backup the internal storage and do as told.

[QUESTION] How to mount /system partition in TWRP or OrangeFox ?

I recently started flashing my Poco X3 with a new rom and some mods, but I quickly realized that when I was flashing my G-Apps package that my /system partition didn't have the free space required to install this package.
I did a bit of research and found out that with TWRP or OrangeFox recovery you could increase the partition size by going into: Wipe > Selecting the partition you want > Fix Partition.
So the next logic step was to try and replicate the same thing on my own phone, but when I went on my custom recovery, I saw that my /system partition wasn't appearing, so I tried to manually mount it by going into the mount option but that did not work, also tried in the terminal by typing "mount /system" but that did nothing saying that "partition /system is not in fstab".
So now I'm completely stuck because to change my ROM I need to wipe the /system partiton which apparently doesn't exist and both recoveries do not work.
PS: I tried this method on all of the recoveries present on the Forum.
I'm asking you guys if you have any idea how to fix this issue or if I have to wait until someone releases a new recovery that is actually fixed ? Thank you.
AFAIK you can't and you shouldn't mess with system partition in any "old standard" way in Poco X3 NFC ... for now it will can make more damage than benefits... you should flash gapps with minimal size that can be safely flashed and install the rest from Play... you want to know more? learn about dynamic partitions used in our phone, I just know that recoveries are patched so people can't brick their phones anymore...

Categories

Resources