Hello everybody,
I'm wondering about the possibility of flashing TWRP not just in the recovery partition, but also to the recovery backup partition. As sometimes (like when dm verity is enabled) the phone may overwrite TWRP with stock recovery, there's an high risk of erasing the whole memory when you try to boot TWRP. I think it could be useful to have TWRP in both partitions. Even in the case something in TWRP doesn't work (never happened to me, but it's a possibility), and we don't have the original recovery, we could still use fastboot to flash the stock recovery.
Does it make sense or am I somehow wrong? If it's possible, can it be done by just making a TWRP flashable zip, editing the updater-script file to make it flash the recovery in the backup partition?
tremalnaik said:
Hello everybody,
I'm wondering about the possibility of flashing TWRP not just in the recovery partition, but also to the recovery backup partition. As sometimes (like when dm verity is enabled) the phone may overwrite TWRP with stock recovery, with the high risk of erasing the whole memory, I think it could be useful to have TWRP in both partitions. Even in the case something in TWRP doesn't work (never happened to me, but it's a possibility), and we don't have the original recovery, we could still use fastboot to flash the stock recovery.
Does it make sense or am I somehow wrong? If it's possible, can it be done by just using the TWRP flashable zip, editing the update-script file to make it flash the recovery in the backup partition?
Click to expand...
Click to collapse
I don't think there is a recovery backup partition.
Here it is:
{
"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"
}
If it wasn't there, how could the phone be able to restore the stock recovery by itself?
tremalnaik said:
Here it is:
If it wasn't there, how could the phone be able to restore the stock recovery by itself?
Click to expand...
Click to collapse
Well, if that was a backup recovery, then it should work to dd TWRP there.
I was always under the impression that the stock recovery was stored in the boot image somewhere.
I've prepared this script for flashing: considering it's the first time I mess up the updater-script for such an essential part of the system, can you confirm if it is correct, considering I'd put the TWRP image in the zip as recovery/recoverybak.img ?
Code:
ui_print("Flashing TWRP to recovery backup H850");
package_extract_dir("recovery", "/tmp");
set_perm_recursive(0, 0, 0777, 0777, "/tmp");
ui_print("Verifying ZIP contents...");
ui_print(" ");
apply_patch_check("/tmp/recoverybak.img", "9edc062fc9483652a9c57d185447a92a36d0f603") || abort("\"/tmp/recoverybak.img\" has failed verification.");
ui_print("Flashing. this might take a bit...");
ui_print(" ");
package_extract_file("recovery/recoverybak.img", "/dev/block/bootdevice/by-name/recoverybak");
ui_print(" ");
ui_print(" ");
ui_print(" ");
ui_print(" Finished... ");
ui_print(" ");
ui_print("Zip by Tremal Naik");
ui_print("Template by autoprime - thx");
ui_print(" ");
i've also checked that both recovery partition and recoverybak partition are the same size, about 41MB, so twrp should fit.
Flashing with dd, according to the TWRP website can be done with
Code:
su
dd if=/sdcard/twrp.img of=/dev/block/platform/soc/624000.ufshc/by-name/recovery
so replacing "recovery" with "recoverybak" should do the job.
tremalnaik said:
I've prepared this script for flashing: considering it's the first time I mess up the updater-script for such an essential part of the system, can you confirm if it is correct, considering I'd put the TWRP image in the zip as recovery/recoverybak.img ?
i've also checked that both recovery partition and recoverybak partition are the same size, about 41MB, so twrp should fit.
Flashing with dd, according to the TWRP website can be done with
so replacing "recovery" with "recoverybak" should do the job.
Click to expand...
Click to collapse
Sorry, looks like you are more knowledgeable on the subject as I don't even know what all that code means. :crying: Any other people know?
The bottom one should work as far as I can tell. If it doesn't, it should throw an error.
Related
Hi,
here comes Recovery for Play of Team FreeXperia.
Download here: (Beta1 - Update 20.06.2011 - 18:28h GMT+1)
http://www.multiupload.com/VC3JRZ74H0
Broken:
Cannot backup&restore boot partition (kernel related)
To test use this command:
fastboot boot recoveryPLAY.img
Button mapping: (thanks Logseman)
Back- Back
Home/Vol UP - Up
Menu/Vol DOWN - Down
Search - OK
Please DO NOT FLASH! This recovery is designed to work just as recovery, if you flash it to your device it will NOT boot system anymore!
Please test and report functions. If there are errors please include EXACT outpot of errormessage.
Thanks to Blagus for his Xperia Play Kernel!
To gain root on every ROM (Stock ones too) just flash the attached RootXperia.zip via Recovery
Regards
Bin4ry & Team FreeXperia
I assume we need to install the custom kernel first?
No! You have NOT to install custom kernel to use this.
Just issue the command i wrote on your windows console. Then phone boots into recovery!
Regards
Logseman said:
I assume we need to install the custom kernel first?
Click to expand...
Click to collapse
The recovery image is structured exatcly as boot.img, with the difference in executable files - regular boot.img boots Android system from /system partition, while recovery boots into... well, recovery
So, since it's structured just as boot.img, you have to pack kernel inside as well. That's where, in this case mine, zImage comes in handy instead of unpacking SE's special boot.img structure, it was easier to take zImage from standard boot.img.
ive just tried it now, boots into CWM fine, im going to try a nandroid and report back
It looks weird in this DDMS capture, but in the phone it looks all right (black background, orange text). I've had no error messages of any kind.
Button mapping:
Back- Back
Home/Vol UP - Up
Menu/Vol DOWN - Down
Search/Power - OK
{
"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"
}
This capture looks funny
But important is how it looks on device. I doubt that ddms cannot capture 32bit framebuffers
Regards
Bin4ry
Ok, i did a nandroid, rebooted, booted back into bootloader and fastboot erased /system/, pushed the recovery back and tried to restore /system/ but i get the error " Error formatting system " i also get the same error in the mounts & storage menu can i flash the nandroid image from fastboot?
*edit* no it wont let me flash it from fastboot, it tells me the image is too large lol probably because i moved some widgets and lwp's to /system/, no worries i'll flash the image in the development section.
Recovery booted fine, did a nandroid backup worked fine, not sure i want to follow suit and delete a load of stuff and try restore. will wait to see what androhero and bin4ry can figure out first with andro's issue
mehmehmen said:
Recovery booted fine, did a nandroid backup worked fine, not sure i want to follow suit and delete a load of stuff and try restore. will wait to see what androhero and bin4ry can figure out first with andro's issue
Click to expand...
Click to collapse
try and clear cache, see if you get the same error? if the action works it wont matter if cache gets formatted
I hope you can help me figure this out, because right now I am astonished at least.
I've been poking around with ClockworkMod, and getting a couple of errors. I know there is an error reporting utility inside CWM, "Report Error" in "advanced" so I made use of it. However, the log would save to "/sdcard/clockworkmod/recovery.log".
Since I'm using the custom kernel, I'm not able to use the sdcard as it seems to be improperly mounted. It shows as mounted in CWM, I unmounted it and remounted it again to no avail... though it can be mounted on the computer properly.
However, that's not the point. I thought I'd do a search on "recovery" with Root Explorer, wanting to find the Recovery.log somewhere else. And boy, did I find it. I found the two recovery logs I saved inside the folder /data/system/dropbox . I happen to have DB installed in my Android. But not only that, I found my kmsg logs, and boot logs, registered there as well.
Hereby I attach the two recovery logs. Does it make sense that these kinds of logs are saved in such a folder? Am I worrying unnecessarily?
this is one of the reaons why google take root access off us in the first place isnt it?
Thanks for the logs.Dunno why they was stored in DB folder
@AndroHero:
Yes just restore the img files from backup via fastboot flash.
Regards
Bin4ry
where excatly do i put the play recovery.img?
crispyduckling said:
where excatly do i put the play recovery.img?
Click to expand...
Click to collapse
just put it in the same folder as fastboot.exe
When backing up the progress bar doesn't work and it can take some minutes, so just be patient when doing a back-up.
Are their any specific options you like us to play with?
AndroHero said:
just put it in the same folder as fastboot.exe
Click to expand...
Click to collapse
cheers mate
okay so i formatted the cache and it comes back
Cach wipe complete.
E:Can't Mount /cache/recovery/log
E:Can't Open /cache/recovery/log
E:Cant mount /cache/recovery/last_log
E:Cant Open /cache/recovery/last_log
it wiped cache ok but is this error something i need to be worried about in away before attempt wipe and restore of system with my nandroid?
Do not bother trying to restore a nandroid backup: the /system partition won't get formatted and the operation will be cancelled.
The back-up made a cache.img, data.img, system.img and a .android_secure.img
I assume I can flash the system.img with fastboot like I used to do when rooting through fastboot? Could safe me the bloatware removal trouble after I get into a bootloop (yet again ).
Avoid and pass by a fool and a madman
Wow, great post and great work bro, this post is very informative indeed. I hope that you can finish you tool soon, I can help testing it if you need testers.
wga0 said:
Universal Image Extractor:
{
"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"
}
It seems that I succeeded in making the Universal Image Extractor. With the latest update engine, it works on any ota for any brand, any version, including the incremental also. But still, lots of work remained....
Complete Fastboot ROMs:
Now, you can build the complete Fastboot ROMs with some more info in your phone, even if your phone's manufacture never release it. To make it complete, you need to include the other roms which is not inside the ota(update.zip), and some more info such as partition type&align, because android has dynamic partitions and it can be changed between the different versions. If your roms were deleted and the partition info gone, you need it definitely.
Unfortunately, this(backup other roms not contained in the ota) requires root or rooted recovery. If you done root, backup all of your roms except userdata, all of the partition info, and keep it safe. If possible, make the fastboot rom yourself with those files/info. In black shark 2/pro cases, fortunately, the partition info is not changed upto now...
First, these code should come first to recover the partition info. It does re-partitioning and align including the two slots.
Code:
%fastboot_cmd% flash partition:0 gpt_both0.bin
%fastboot_cmd% flash partition:1 gpt_both1.bin
%fastboot_cmd% flash partition:2 gpt_both2.bin
....(all partitions)
In BS2/pro cases, it has align.bin info. It also should be flashed here to align the partition position
Second, the bootloader needed to be changed as the fastboot roms uses, and reboot into bootloader again. In cases that the bootloader has changed, extreme caution is required. If compatibility is not guaranteed, never try this (Fastboot ROMs). When doing this, flash only one bootloader to check the boot compatiblity, and after reboot successfully, flash the other slot.
Code:
%fastboot_cmd% flash abl_a abl.img
%fastboot_cmd% reboot-bootloader
timeout /t ....
In BS2/pro Android 10 cases, it's changed completely, you should never try this (Fastboot ROMs)
Third, re-setting and flash all the roms (including which is not inside the ota) are required to be fully recovered
Code:
%fastboot_cmd% oem simconfig set SS
%fastboot_cmd% flash avb_custom_key pkmd.bin
%fastboot_cmd% erase ddr
%fastboot_cmd% erase userdata
%fastboot_cmd% erase ....(all security key related)
%fastboot_cmd% flash roms...
More than Fastboot ROMs & Factory OTAs:
And now with the tool, it seems that I found a way to build a flashable update.zip, same as the factory OTA or Fastboot ROMs. It seems like it has both pros. It doesn't require rooting, unlocking bootloader, etc... Even if your phone's manufacturer never release the factory OTA, even if your phone never boot(bricked), you still could build and flash(update/rollback/recover) it without rooting & unlocking...
Here's the idea. (I found this inside the update_engine & OTA packaging sources)
With the universal image extractor, you can build any images and that images are stock(factory) images signed by the manufacturer. So, if I add(import) that ota packaging sources into the tool, I can build the factory OTA itself anytime with the tool. But unfortunately, although that factory OTA contains all signed, stock images & info, zip file itself isn't signed by the manufacturer and rejected by the system. (can't be flashed using 1027 code). Then... what if I can use it in bootloader or recovery? Stock recovery of BS has only one function, factory reset. Then fastboot?
It seems that I found a way to build an update.zip, same as the Factory OTA but can be used in bootloader, and a way to update(not flash) it in bootloader, bypassing the signature check of update.zip itself. So ideally, it doesn't require anything root or unlock, and can be updated and boot successfully through the locked bootloader because all of the images inside the zip are signed by manufacturer. Further, you don't need to push it into phone anymore. After entering bootloader, one command is enough. It's easier and powerful than both Fastboot and Factory OTA images. (not as powerful as complete Fastboot ROMs that contains all the roms which is not in OTAs...)
A bad things is..... this is just an possibility(idea) found inside the source codes currently.... and requires a lots of works in windows, like the universal image extractor.
Click to expand...
Click to collapse
Thank you for your thread. I'm going to study this!
Hi sorry if i post in bad section so i need help i downloaded an CWM ClockWorkMod Recovery for SM-G318H Samsung Galaxy Trend 2 lite i apply the update so it was almost done but an error marked in red and reboot after update failure.
Any suggestion it happens with any zip file for Temp Recovery i have here an picture :crying:
I Attached an picture with the failure so if you have any suggestion reply there.
P.S. I Don't trust changing permanent recovery and even download mode odin.
@AlinTecsan
You used phone's Stock Recovery to flash something other than the phone's signed Stock ROM. Hence you got "E: signatue verification failed" error.
Flashing CWM on stock recovery
jwoegerbauer said:
@AlinTecsan
You used phone's Stock Recovery to flash something other than the phone's signed Stock ROM. Hence you got "E: signatue verification failed" error.
Click to expand...
Click to collapse
This i know so i try flashing the CWM so this not work so to sign the custom recovery with signed stock rom so how i fix thanks for replying
@AlinTecsan
Look inside here.
Looked Here
jwoegerbauer said:
@AlinTecsan
Look inside here.
Click to expand...
Click to collapse
I Looked here so fastboot it flash and erase sorry so my phone will not support the advanced boot options and no match found for my model at all so thanks again for the link
Use TWRP instead of CWM
@AlinTecsan
It’s true that CWM Recovery is a widely used recovery, but it’s not anymore in the league, now it’s TWRP all the way up with no contender around!
Since the software company which developed CWM Recovery has stopped building its versions anymore, there are no new releases of CWM Recovery released within the last 5 years what are ready to be used on mainstream Android devices.
Take note that TWRP can get successfully flashed on A/B systems.
TWRP Will work for my device?
jwoegerbauer said:
@AlinTecsan
It’s true that CWM Recovery is a widely used recovery, but it’s not anymore in the league, now it’s TWRP all the way up with no contender around!
Since the software company which developed CWM Recovery has stopped building its versions anymore, there are no new releases of CWM Recovery released within the last 5 years what are ready to be used on mainstream Android devices.
Take note that TWRP can get successfully flashed on A/B systems.
Click to expand...
Click to collapse
Does have what have cwm?Like factory reset apply update from sdcard sideload cache wipe reboot and change theme i would like to try hope the file is compatibile with my device before to start i will backup the stock recovery :good:
AlinTecsan said:
Does have what have cwm?Like factory reset apply update from sdcard sideload cache wipe reboot and change theme i would like to try hope the file is compatibile with my device before to start i will backup the stock recovery :good:
Click to expand...
Click to collapse
{
"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"
}
I Flash an 2.8.7.0 TWRP
jwoegerbauer said:
Click to expand...
Click to collapse
It work fine so i need to change to red if possible so work good so i sent pictures soon I like to know how i restore the stock recovery i backup the whole firmware so i like to change to red .TWRP Work with all devices?
@AlinTecsan
You have to re-flash device's Stock ROM to get device's Stock Recovery back.
Stock ROM And recovery
jwoegerbauer said:
@AlinTecsan
You have to re-flash device's Stock ROM to get device's Stock Recovery back.
Click to expand...
Click to collapse
I have to say i extract from my correctly firmware code the recovery.img so i will made an tar file or i guess to restore recovery stock in case of problem so i know with .tar.md5 backups.
I just want to finally try and install a custom rom into my Mi A3 which I rooted a while ago. I know I need this tool called TWRP, after encountering a myriad of errors trying to follow this guide step-by-step, I finally got to the point when I need to type "fastboot boot twrp.img" to boot into TWRP temporarily. But alas that couldn't be so easy now could it... Now I get this thing
{
"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"
}
and it's 11:41 PM and I'm about to burst a vein. I made an account solely to make this post because I can't seem to get an actual answer anywhere else... Any ideas before I give up?
is the bootloader unlocked ?
i think i got same message and it was because i forgot this.
I think there are better guides. Not sure what state your system is in. I would re-install the stock rom and start afresh. Unlock your bootloader, check which slot 'a' or 'b' is the current slot, and then follow the instruction of the Custom ROM you are trying to install. It might need TWRP but Lineage Recovery is equally as good.
#1jonna said:
is the bootloader unlocked ?
i think i got same message and it was because i forgot this.
Click to expand...
Click to collapse
Yes sir it very much is, don't think it'd have been possible to get this far otherwise
bjlabuk said:
I think there are better guides. Not sure what state your system is in. I would re-install the stock rom and start afresh. Unlock your bootloader, check which slot 'a' or 'b' is the current slot, and then follow the instruction of the Custom ROM you are trying to install. It might need TWRP but Lineage Recovery is equally as good.
Click to expand...
Click to collapse
how do I do this?
2. does Lineage Recovery even work on Mi A3s? I don't find anything about this device on their website
Follow the guide in the thread 'Slot A is destroyed'.
bjlabuk said:
Follow the guide in the thread 'Slot A is destroyed'.
Click to expand...
Click to collapse
I assume this means I can just go back to magisk and hit restore images, then return to fastboot and switch to slot b and install twrp there?
ㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤ said:
View attachment 5554333
I assume this means I can just go back to magisk and hit restore images, then return to fastboot and switch to slot b and install twrp there?
Click to expand...
Click to collapse
As I said, as I am not sure what state your system is in I would suggest 're-installing' the stock rom from your PC, rather than 'restoring' an image from your phone. If you have backed up your data etc (eg on Google Drive) you can restore it after you have re-installed the stock rom. You can then start again from scratch.
The latest stock rom fastboot images can be found here
https://xiaomifirmwareupdater.com/miui/laurel/
Tbh I haven't restored an image from magisk myself so I can't confirm what you are proposing, though yes I switched to slot b and installed TWRP.
You might also want to read this article on A/B partitions
https://www.xda-developers.com/how-...ess-updates-affect-custom-development-on-xda/
Try this
https://play.google.com/store/apps/details?id=com.smartpack.smartflasher
Flash TWRP installer through the app
Just a few tips when you do get to TWRP:
Disable dm-verity
Format data and wipe cache after you flash the new rom before first boot
Use a patched boot method instead of flashing magisk in TWRP on custom ROMs. High chance of soft brick.
DM me if you need help.
Hello,
I need help for TWRP on my Samsung Galaxy A20e. My device is rooted for a while and TWRP is newly installed. But the problem is when I try to backup something, I got an error while creating the folder TWRP with the mension of operation not permited. I also have a problem when I touch the Install button, I see a list of folders with random generated names like in the photo. Can anybody help me to solve this problem? I can give more informations if needed.
Thanks for helping !
{
"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"
}
your device is encrypted. you must disable encryption and factory reset device in order to become TWRP functional, as TWRP cannot handle samsung encryption. or use other backup method such as Migrate.
Ok I tried what you wrote but it works only while I don't boot my device after factory reset it. If it happens, the encryption enables automatically and I can't backup anymore. Do you have a solution for this ?
you must disable encryption in /vendor/etc/fstab.samsungexynos7884
(can maybe done with zip)
https://forum.xda-developers.com/t/recovery-unofficial-twrp-3-4-0-0-for-galaxy-a20e-a202f.4141767
How am I supposed to do that ? I tried everything with this file. There is a mount option for /data "filencryption=ice". I tried to delete this with a file editor in the stock system but when I reboot my phone it reappears. When I this this in TWRP the system can't boot.
https://forum.xda-developers.com/t/recovery-unofficial-twrp-3-4-0-0-for-galaxy-a20e-a202f.4141767
Click to expand...
Click to collapse
This link cannot help me because it is just a tutorial and when I do exactly like in i get the same results. I don't unerstand why my phone has this problem and not others. If you have other ideas i would be good
there is download for Disable_Dm-Verity_ForceEncrypt_03.04.2020.zip flashable zip which is supposed to patch fstab (last step in tutorial). you must mount system/vendor writeable (checkbox in TWRP)
aIecxs said:
there is download for Disable_Dm-Verity_ForceEncrypt_03.04.2020.zip flashable zip which is supposed to patch fstab (last step in tutorial). you must mount system/vendor writeable (checkbox in TWRP)
Click to expand...
Click to collapse
I tried installing this zip file from the SD card but it didn't boot (locked on samsung logo) so I did a factory reset with TWRP and after configuring, I got the same results than before.
- in TWRP double check your vendor partition is separate partition (or directory inside system partition)
- in TWRP terminal make sure partition is mounted rw
Code:
mount /system w
mount /vendor w
mount
- install Disable_Dm-Verity_ForceEncrypt_03.04.2020.zip
- in TWRP terminal double check fstab.samsungexynos7884 file fileencryption= flag is gone
Code:
cat /vendor/etc/fstab.*
- in TWRP - wipe - format data - type yes
Thanks for the instructions. It works perfectly ! I am just an idiot because I didn't wipe /data in TWRP but I just swiped to factory reset. Thank you a lot !
maybe I was misleading you with factory reset. might be that TWRP factory reset just behaves like simple wipe, where only files are deleted excluding /data/media
formatting whole partition is required for removing encryption.
edit: Please note if you're interested in undo the patch, you must restore vendor partition. you can of course add the fileencryption= flag back with text editor yourself. However that requires linux line endings (LF) so you can't use Windows text editor (CRLF) that's why you should use Notepad++ and enable view for invisible chars with (π) button. Do not simply copy file back into /vendor you will lose file permissions. Do not use sed you still would lose secontext. only copy content of file into old existing file like this.
Code:
cat /tmp/fstab.new > /vendor/etc/fstab.samsungexynos7884
Btw if you're running custom ROM (such as LineageOS) it's possible to break samsung encryption and use AOSP encryption as fallback by deleting keystore.mdfpp.so and keystore.msm8953.so from /vendor/lib/hw. This way you can use TWRP on encrypted device.