2

I know that unlocking bootloader does wipe the /data partition. However, can it also wipe the /storage partition and others, too?

user167294
  • 21
  • 2
  • It wipes all data on the internal storage... Data on an SD card setup as portable/external storage is not touched in most cases, it is recommended to remove an SD card prior to unlocking the bootloader just in case though. – acejavelin Aug 24 '17 at 20:36
  • So your answer is: It wipes 100% of the phone? – user167294 Aug 24 '17 at 20:37
  • Yes, all user data, apps, music, pictures, videos, etc... unless they are stored on an SD card configured as portable storage. It will essentially be as "blank" as the day it came out of the box from the manufacturer, except as noted. – acejavelin Aug 24 '17 at 20:38
  • Then, after unlocking, relocking is possible? – user167294 Aug 24 '17 at 20:40
  • Nexus, Pixel, or OnePlus... yes... Otherwise it depends on the device, some can and some can't be, but they all have a "flag" of somekind to indicate it was once unlocked. For example, in Moto devices they have a Bootloader Status number, it is 0 when locked, but if relocked becomes 2, and it can not be set back to 0 ever. – acejavelin Aug 24 '17 at 20:43
  • I m not using these: Samsung and/or US carriers, etc. Mine is LG. – user167294 Aug 24 '17 at 20:44
  • I don't believe LG devices can be "relocked"... but your comment makes me think you don't understand what you are unlocking. Unlocking the bootloader and unlocking the SIM (carrier unlock) are completely different, I have only been referring to bootloader unlock. – acejavelin Aug 24 '17 at 20:45
  • 1
    Note: I unlocked the bootloader on my Huawei P8 GRA-UL00, and my user data wasn't wiped. I'm not sure why, but it is possible user data does not get wiped in some instances. – George Tian Aug 25 '17 at 01:37

2 Answers2

3

There is nothing like storage partition. What you see under /storage/emulated is a FUSE implementation of /data/media/userID. Whenever you unlock or relock the bootloader, fastboot causes factory reset of the device which wipes data and cache partitions. No bit of data escapes it, including what you see under /storage.

Source:

printf("oem unlock requested:\n");
printf("\tUnlocking forces a factory reset and could\n");
printf("\topen your device up to a world of hurt.  If you\n");
printf("\tare sure you know what you're doing, then accept\n");
printf("\tin %d seconds via 'fastboot oem unlock_accept'.\n",
Firelord
  • 25,084
  • 20
  • 124
  • 286
  • Think of it that way: whichever partition accumulated user generated data gets to be wiped. They mostly include data and cache partition under normal circumstances (no deliberate tampering that is). – Firelord Aug 24 '17 at 22:04
  • When we say data is wiped during oem unlock can that operation be conceived of as like a calloc operation that zeros out that block of memory on the relevant partition? Or is the wiping basically a deletion in the filesystem but the data may still be physically present on the disk where something like the dd command could potentially recover it? – jxramos Jul 04 '21 at 08:02
  • 1
    @jxramos implementation of oem unlock is vendor specific and is not publicly disclosed, so I don't really know how data wipe takes place. – Firelord Jul 04 '21 at 12:44
0

It wipes the complete storage when the bootloader has never been unlocked. If it has been unlocked it just wipes /data as far as I have experienced this on my oneplus x. (Onyx)

Booming
  • 138
  • 5