[SCRIPT] (Depreciated) Wipe Encrypted Data Without Wiping Internal Storage

Search This thread

MNoisy

Senior Member
If I am currently in an unencrypted state (no passwords, no boot patterns required, etc), would I be able to restore a backup that was made in an encrypted state for my system and data partitions?

Essentially, are we limited by the CURRENT state of encryption for restoring images or are the backups affected by the state of encryption DURING the time the backup was made?
 

jollywhitefoot

Senior Member
Jul 21, 2014
2,147
899
Nashville
If I am currently in an unencrypted state (no passwords, no boot patterns required, etc), would I be able to restore a backup that was made in an encrypted state for my system and data partitions?

Essentially, are we limited by the CURRENT state of encryption for restoring images or are the backups affected by the state of encryption DURING the time the backup was made?

you are never in an unencrypted state with this device.

Also, this script is obsolete now that TWRP can handle the HTC encryption (starting with 3.0.2-3).
 
Last edited:

MNoisy

Senior Member
you are never in an unencrypted state with this device.

Also, this script is obsolete now that TWRP can handle the HTC encryption (starting with 3.0.2-3).

I understand not being in an unencrypted state hence the parentheses to explain the status further in my original post.

I also understand that this is no longer an issue with the newest TWRP. My question was about PREVIOUS backups.

I need an answer, not a critique. :laugh: But I do appreciate the additional details!
 

jollywhitefoot

Senior Member
Jul 21, 2014
2,147
899
Nashville
I understand not being in an unencrypted state hence the parentheses to explain the status further in my original post.

I also understand that this is no longer an issue with the newest TWRP. My question was about PREVIOUS backups.

I need an answer, not a critique. :laugh: But I do appreciate the additional details!

wasn't critiquing. I thought I did answer your quesiton. You never made an unencrypted backup.

how did you back up previously with TWRP (pre version 3)? The entire 25GB partition? If so, you can throw that out because it's useless.

---------- Post added at 03:49 PM ---------- Previous post was at 03:42 PM ----------

I understand not being in an unencrypted state hence the parentheses to explain the status further in my original post.

I also understand that this is no longer an issue with the newest TWRP. My question was about PREVIOUS backups.

I need an answer, not a critique. :laugh: But I do appreciate the additional details!

Are you asking if you can restore a backup that you made while you had a device password set now that you don't have a device password? If so...http://xdaforums.com/showpost.php?p=66931692&postcount=256

Read this post and the next few.

I'd recommend redoing the backup just to be safe, but Captain_Throwback's solution isn't hard either.

SO...if this is what you were talking about, this is not what you originally asked.
 

MNoisy

Senior Member
The backup was for system and data, not system image. It was performed before the TWRP version could handle encryption and done while security was enabled on the device (security to start/bootup)..

I am just toying around and about to start fresh again on 1.53.617.5 and thought I would see if it's possible to restore those previous backups since I am now in an "unencrypted state" (E.g. no required PIN/password/pattern to start device and no PIN/password/pattern before bootup.)

---------- Post added at 03:56 PM ---------- Previous post was at 03:53 PM ----------

Just answered my own question.

The answer is NO, we cannot restore backups from a password protected state, no matter what our current state is.

Thanks!
 

jollywhitefoot

Senior Member
Jul 21, 2014
2,147
899
Nashville
The backup was for system and data, not system image. It was performed before the TWRP version could handle encryption and done while security was enabled on the device (security to start/bootup)..

I am just toying around and about to start fresh again on 1.53.617.5 and thought I would see if it's possible to restore those previous backups since I am now in an "unencrypted state" (E.g. no required PIN/password/pattern to start device and no PIN/password/pattern before bootup.)

---------- Post added at 03:56 PM ---------- Previous post was at 03:53 PM ----------

Just answered my own question.

The answer is NO, we cannot restore backups from a password protected state, no matter what our current state is.

Thanks!

Did you get an error in twrp or something? Security data is in data partition, not system. you should be able to restore any system backup because the new version of TWRP handles system the same way as the old versions of twrp.

you're confusing me when you keep saying unencrypted state. There is no unencrypted state on this device. Data partition is always encrypted, regardless if you have a password set or not.
 

MNoisy

Senior Member
wasn't critiquing. I thought I did answer your quesiton. You never made an unencrypted backup.

how did you back up previously with TWRP (pre version 3)? The entire 25GB partition? If so, you can throw that out because it's useless.

---------- Post added at 03:49 PM ---------- Previous post was at 03:42 PM ----------



Are you asking if you can restore a backup that you made while you had a device password set now that you don't have a device password? If so...http://xdaforums.com/showpost.php?p=66931692&postcount=256

Read this post and the next few.

I'd recommend redoing the backup just to be safe, but Captain_Throwback's solution isn't hard either.

SO...if this is what you were talking about, this is not what you originally asked.

No, that is not what I was asking. Was able to finally test and determined the answer was no.

Thanks!
 

Top Liked Posts

  • There are no posts matching your filters.
  • 23
    Update: The latest TWRP is already capable of decrypting data. This method is now unnecessary and depreciated. Use factory reset in TWRP menu instead

    Disclaimer: This mod will wipe your data. I am not responsible for data loss after using this mod.
    I tested on my device several times, it's working for me so internal storage is always preserved, but I cannot guarantee if anything is messed up on your side. Please read the post carefully before using this mod!
    Always backup your important data before modifying your phone's software!


    To compensate the mistake I have done in the modified SuperSU script (I fixed it eventually though :p), I decided to release a mod I consider quite useful for most people.
    I've used the 10 for quite some time, and I've been messing with it from day 1.
    Since the encryption is required for the phone to have proper radio signal (more info here), we are forced to keep our devices encrypted.
    And because HTC uses proprietary encryption method, TWRP is unable to decrypt our data partition, which causes the recovery unable to read anything from data.
    This is actually quite a big problem. If you want to full wipe and clean flash your favorite custom rom, the "Factory Reset" option in TWRP is not available, so you are forced to wipe the whole data partition, which will cause all your personal files stored in internal storage to be removed.
    If you're a flashaholic like I am, you are forced not to store anything important in the phone storage because it will be wiped every time trying to clean flash a rom.
    To breakthrough this inconvenience, I created this flashable zip to accomplish something similar to the "Factory Reset" option in TWRP.

    Requirement: You have to use the systemless root of SuperSU to use this mod. If you want to flash the wipe script with SuperSU, flash SuperSU first, then flash the wipe script.
    Important: If you have chosen "Require PIN/password/pattern to start device" in the "Secure startup" page during the initial setup, you CANNOT use this mod!
    If you have to enter your PIN/password/pattern before your device booted up, this means that you have secure startup enabled. You CANNOT use this mod!
    If secure startup is enabled and you flash this zip, your encryption will be messed up and you will have to format the whole data partition eventually to make your phone working again.


    After flashing the mod, your data will not be wiped immediately in recovery because we cannot do so. It will wipe the data AFTER you rebooted back to system. It will reboot again after the wipe is done. If you flashed SuperSU at the same time with this mod, you will experience 2 consecutive reboot loops. This is normal behavior, don't panic.

    If devs are interested in including this zip into your rom, you can use it in the same way as SuperSU:
    Code:
    package_extract_dir("wipe", "/tmp/wipe");
    run_program("/sbin/busybox", "unzip", "/tmp/wipe/wipe.zip", "META-INF/com/google/android/*", "-d", "/tmp/wipe");
    run_program("/sbin/busybox", "sh", "/tmp/wipe/META-INF/com/google/android/update-binary", "dummy", "1", "/tmp/wipe/wipe.zip");
    For those who are interested in what this zip actually do, here is a brief explanation:

    If secure startup is disabled, data will be decrypted as soon as the device booted up. We can only access data after it is decrypted. So our only choice is to wipe data after the device has booted up.
    I created a script to wipe all data except SuperSU app, su binary image, and your internal storage.
    SuperSU will automatically run scripts inside the directory /su/su.d, so after putting the script into the folder, SuperSU will the wipe script at boot time.
    The problem is: su.img is also located in /data, how can we push files into the image? Fortunately, our master Chainfire has thought of this problem. The image /cache/su.img will be merged with /data/su.img during boot. So I just need to place the script into /cache/su.img, then Chainfire's script will do all the rest of the work automatically. If you're interested in the merging process, take a look at launch_daemonsu.sh in the ramdisk of a SuperSU modified boot for more details.
    4
    So I guess now that TWRP is able to decrypt, this script isn't necessary anymore?
    Yeah it is not necessary any more :)
    :good::good::good:
    3
    So I guess now that TWRP is able to decrypt, this script isn't necessary anymore?
    2
    huh? Ever since I began rooting phones, I would wipe system, data and cache before a clean flash of a rom. I guess I never knew the rom does it for you. I thought the rom just over wrote the system possibly leaving remnants of the old system which could lead to issues which is why devs advise to full wipe when switching roms.
    Ah, a full wipe is only applicable to data buddy, if a rom dev doesn't wipe system before their installation, they need a good slap with a frozen kipper.

    Cache is entirely optional
    1
    Is this helpful in regards to initial routing and flashing a rom or only afterwards to flash a new one?