Question EFS Backup for F926B - Samsung Galaxy Z Fold3

Many guides recommend to backup the EFS partition before installing any ROMs "just in case".
Unfortunately, I cannot find any up-to-date manual on how to do so the proper way in case of the Fold 3.
Guides I do find either suggest to copy some images from a specific /dev/block with dd, which seems to be e outdated as non-existant on the Fold 3 or are incomplete by recommending to only copy the content of the folder /efs with a root explorer or mention EFS Professional which at least for me fails with some obscure array/dimension/whatnow error message just when attemping to even only get the partitions.
In the Dr. Ketan - thread, the developer suggested to use TWRP but here, is also unclear whether being suitable now or not, also in terms of half the stuff being encrypted nowadays. Uargh.
So how do all of you back this up if it is common sense that it is oh so important?

If you are rooted, the dd method can be done quite simple either on a terminal emulator or with adb shell.
If using terminal:
su
then
dd if=/dev/block/by-name/efs of=/sdcard/efs_backup.img
If using adb shell:
adb shell
then
su
then
dd if=/dev/block/by-name/efs of=/sdcard/efs_backup.img
Or you can just back it up with TWRP, it should give you the option to do it.

Thanks a lot. I used dd in Termux in the root context and the resulting file size is 20 MB. Hope it is what I need as that EFS backup thing somehow has something of "hopefully, one never needs it".
By the way, the attempt to use TWRP for that fails as it only recognizes the internal storage which is shown as 0MB, probably due to the encryption.

Related

[HOW TO] /efs Folder backup + Restore NV_DATA.BIN

I’ve compiled a quick guide to instruct how to make a copy of the /efs folder. I’ve found in many threads suggestions about backing up this folder but the methods itself are very general. Most of the times they suggest to “root and copy the folder” with Root Explorer or similar, but usually it’s not that easy or it just doesn't work for everyone (my case).
This guide ASUMES you have read this Excellent Guide by Darkstrikerfirst:
H E R E <-- Make sure to read the ADB Guide.
I recommend doing this with a Mobile just taken out of the box or with any Official ROM of its Service Provider. If you have already Flashed your phone with another ROM but its working fine, then you can use that /efs also.
Why the /efs folder?
This is a very sensitive system folder that contains Phone-specific information such as the IMEI (encrypted in the nv_data.bin), wireless devices MAC addresses, product code (also in the nv_data.bin), and much more. Often users trying to change product codes or trying to unlock the mobile will end up corrupting data in this location.
Why back it up?
Well, let’s resume it saying that backing-up this little folder will keep you away from Samsung service centers.
***WARNING: I take no responsibility to any damage caused by the methods cited and/or written here. Their sole purpose is to back-up data and not to alter in any way the integrity of the original files of the mobile***
Please don’t ask how to recover your IMEI if you have previously messed your SGS without backing up this folder. I’m not familiar with such methods plus it is UNRELATED to this thread.
What you will need:
Rooted SGS to get permissions as a SU (Super User) and perform the backup
I would suggest learning a little about the terminal commands used (in case you are not familiar with them), as it’s better to know what you are doing rather than typing strings like a little chimp without knowing what they are; if you are a little lazy, then you have a good chance bricking your mobile.<- Busybox Commands(or Google them)
Terminal Emulator by Jack Palevich (available from the market) <-Terminal Emulator or use ADB which is included in the SDK Development Tools
IMPORTANT: If getting "error: device not found" under ADB (happened to me under CM7 2.3.4), you need to update your ADB drivers. Go HERE and follow the instructions to download the USB Driver for Windows, Revision 4 (Nexus S Support). Then update the drivers under your Windows Device Manager.
--------------------------------------
Backup commands
--------------------------------------
Depending on the type of root, you might have to use “busybox” at the beginning of the sting or just the string:
The standard prompt of terminal (adb) is a $ sign. Once you enter “SU” it will become a # Sign.
***NOTE: Make sure to keep an eye on the screen of your SGS during this process, because it will request SU permissions; else, you will get an error (just if it’s the first time). In Terminal Emulator you will need to reset the app after granting permissions cause it usually freezes***
*Remember: to use ADB you need to enable USB DEBUGGING under Applications/Development in your SGS. Once you are finished with the files, you need to turn it off so you can get the files.
Code:
su
tar zcvf /sdcard/efs-backup.tar.gz /efs or
busybox tar zcvf /sdcard/efs-backup.tar.gz /efs
After this, you will end up with the file efs-backup.tar.gz in your INTERNAL SDCARD, which is a “tarball” or a ZIP of the /efs folder. That file is your backup. You can expand it with Winrar.
In another forum I also saw a recommendation to back up the st13 under /dev/block which can support greatly to recoveryour IMEI in case of a screw-up:
Code:
su
cat /dev/block/stl3 > /sdcard/efs_dev-block-stl3.img or
busybox cat /dev/block/stl3 > /sdcard/efs_dev-block-stl3.img
Same thing, the target is the INTERNAL SDCARD, so go ahead and copy the file.
----------------------------
nv_data.bin - Restore
----------------------------
In case you screwed your IMEI by playing with the nv_data.bin and you are experiencing issues like:
Fake IMEI (usually 004999010640000)
Unable to download apps from the market
Unable to unlock your SIM card using your PIN
Weird apps are downloading automatically from the market
Blinking SIM card icon on the top tray… ETC
You may want to upload your fresh copy of this file back to the phone. Use this commands:
(thanks to Methyldioxide method to recover the product code http://forum.xda-developers.com/showthread.php?t=780509 )
Copy the file from your backup (efs-backup.tar.gz) and paste it in the INTERNAL SDCARD:
Code:
cp /sdcard/nv_data.bin /efs/nv_data.bin
rm -rf /efs/nv_data.bin.md5 OR
busybox rm -rf /efs/nv_data.bin.md5
Reboot your SGS
The md5 hash/signature is removed (rm) as the system will generate a new one.
**Most likely your SIM code won’t work after this and you won’t be able to log into the phone**
Pop off your SIM card, boot your SGS and execute the following commands to change ownership of the file under ADB or Terminal as well:
Code:
su
busybox chown 1001:1001 /efs/nv_data.bin or
chown 1001:1001 /efs/nv_data.bin
Hope this can help anyone with doubts. Cheers!
An alternative to the backup part is to use Root Explorer and zip the whole /efs folder onto your external sd card. (or wherever you want)
How about a method to restore the IMEI if you never had a good back up to begin with ?
Candanga said:
Please don’t ask how to recover your IMEI if you have previously messed your SGS without backing up this folder. I’m not familiar with such methods plus it is UNRELATED to this thread.
Click to expand...
Click to collapse
EarlZ said:
How about a method to restore the IMEI if you never had a good back up to begin with ?
Click to expand...
Click to collapse
How did you manage to miss that?
EarlZ said:
How about a method to restore the IMEI if you never had a good back up to begin with ?
Click to expand...
Click to collapse
had the feeling you would be here LMAO..
funny thing
the other day i messed up nv_data.bak trying to get my old product code back
the phone would not recognise the sim card
i deleted the whole /efs folder and the phone made a new one
i got my imei but no product code
sim card started working everything looked ok appart from sgs tools reporting nothing as phone !?!
i did restore /efs from a backup i had and then my product code came back
weird though
I was on jpo when all this happened
pele78 said:
had the feeling you would be here LMAO..
Click to expand...
Click to collapse
I guess you find it entertaining if people messed up their IMEI, well we all have our kinkiness.
EarlZ said:
I guess you find it entertaining if people messed up their IMEI, well we all have our kinkiness.
Click to expand...
Click to collapse
@EarlZ - I myself was a victim of this, but I managed to make a duplicate of my nv_data.bin as per instructions of the guide that I was following to unlock my SGS.
The only "tip" that I can give you (geez.. Im going against my own disclaimer lol ) is to try to flash it back to JM1 or the earliest release of your mobile. I think I remember to get my IMEI back doing this, but then lost it flashing to a newer ROM. AGAIN, my "research" didn't go past this as I managed to get my IMEI back, reason why I got inspired to throw this little guide.
Hope this can get you started on your IMEI recovery journey.
Cheers mate.
The restore should also be done with tar - in this way you won't lose the permissions on the files.
ingineru said:
The restore should also be done with tar - in this way you won't lose the permissions on the files.
Click to expand...
Click to collapse
Just for future reference (in case I need it ) can you give us the full command line?
Thanks
Thanks for the HowTo.
I ended up deleting my nv_data files in order to restore the backup files to get back the orig product code. As far as I can tell, it worked perfectly.
Code:
busybox rm -rf /efs/nv_data.bin
busybox rm -rf /efs/nv_data.bin.md5
In case you really boink your EFS
I wanted to add a small piece to this thread that not really consolidated anywhere I can fine. I toasted my /EFS yesterday - to the point of no cellular unless I was at JF6. I couldn't use tar because I'd get "out of room" errors and "numerical value out of range". I mean I SERIOUSLY borked the /EFS. But then I've been flashing this phone from the day it was available from AT&T.
I used ODIN to restore my /EFS. I have a permanent generic IMEI.
There are several good threads on backup of the /EFS, but not on restoring. If you follow the OP post to backup, here's a good discussion on how to restore.
http://forum.xda-developers.com/showthread.php?t=882039
What wasn't clear in Da_G's thread is the you don't have to use DD to use ODIN to restore. There's no discussion on using the .img file to restore. That's scattered across a couple of threads and lots of reading. I'm not a linux guy, so I had to figure this out. . . .
Deep in rotohammer's following thread, there is a discussion about using a cat .img file to do create an ODIN .rfs file that allows you to restore from ODIN.
http://forum.xda-developers.com/showthread.php?t=850359
So here's what I did to restore my /EFS to functional. You MUST have a backup of your functional /EFS using either dd or cat and ADB installed.
On your PC do the following:
c:\Android\tools> adb shell
$ su (you're now on your phones Android command line; watch your home screen on the phone in case Superuser comes up asking for permission)
#
Now we're going to take the efs_folder_backup_stl3.img that you did with the cat file and make it usable by ODIN. Change directory locations to your cat .img location. Mine is on /sdcard/external_sd/.
#cd /sdcard/external_sd/
#busybox cat efs_folder_backup_stl3.img > /sdcard/efs.rfs (this is the key step!!)
# cd /sdcard
# tar -cf efs.tar efs.rfs
# exit
$ exit
Now your back at your PC. Do the following step to get the .tar file off your phone.
c:\Android\tools> adb pull /sdcard/efs.tar
Almost done. Move the efs.tar file to the same direction as ODIN and the follow the last directions in Da_G's thread. I'll post them below for just for clarity.
"Now, get into download mode, open odin, stick efs.tar in PDA slot, and press start. Bam! EFS fixed"
This worked for me, several times. Once you have the /EFS directory in ODIN flashable tar format - you really have to work hard to brick your phone.
Hope this helps!
If I flash back to stock using ODIN, would that also put things back to right ?
@bsc7080xsc
It should. You might have to do a factory reset if the device shows as locked, but otherwise it's worked for me many times.
Hi
backedup my efs folder through this thread in combination with roto.
cellgeek in your post you say : " busybox cat efs_folder_backup_stl3.img > /sdcard/efs.rfs (this is the key step!!)"
But i never made an .img file/folder.
both the dd and cat created an rfs file which i turned to tar.
am i missing a step?
thank you for your little extra guide.
that's a very useful Candanga
several times saved my ass
thanks !
Thank you VERY much OP, that worked for me
Sorry to revive if this is old;
Why won't rm -rf /efs/nv_data.bin.md5 work in terminal? It gives me an error along the lines of this is a read-only file etc?
geesamsungs said:
Sorry to revive if this is old;
Why won't rm -rf /efs/nv_data.bin.md5 work in terminal? It gives me an error along the lines of this is a read-only file etc?
Click to expand...
Click to collapse
Try "busybox rm -rf /efs/nv_data.bin.md5"
Thanks that was very useful but I have a problem here.
When I copy my nv_data.bin file to efs directory I can only change the ownership but not the group!
I tried both of this:
su
busybox chown 1001:1001 /efs/nv_data.bin or
chown 1001:1001 /efs/nv_data.bin
Click to expand...
Click to collapse
and
su
busybox chown radio:radio /efs/nv_data.bin or
chown radio:radio /efs/nv_data.bin
Click to expand...
Click to collapse

The "data destroyer" - Quick way to back up any partition

Here is a quick way to back up any partition on your device. We'll use mmcblk0p8 as an example. ( partition reserved for Kernel image)
Download terminal emulator from market.
1. Go to your internal SD card, make a file on the root of it called "DISK_BACKUP" then put another file in that one called "partition8"
2. Open terminal emulator, type the following commands without quotes and hit enter after each line:
"su" (it will ask for root permission, grant it)
"dd if=/dev/block/mmcblk0p8 of=/storage/sdcard0/DISK_BACKUP/partition8 bs=4096 conv=notrunc,noerrors"
Done. To restore it, put the file paths in the command so the backup directory is called out first, and the partition is called out second, but leave the "if" and "of" in the same order in the command. A very useful partition to have backed up is your EFS, and maybe your recovery and boot partitions as well. efs is mmcblk0p3.
You can do this for any partition on the device. Make sure you give it a dedicated file to write into though. Don't just say "of=/storage/sdcard0" because it will write take no prisoners and likely write over something you didn't want it to.
Very powerful command, take precaution, but very useful as well. dubbed the "data destroyer" by many.

[Tutorial] Manual TA partition management (Win/OS X/*nix)

There are tools that do this automatically for you, but to date they only work on Windows and as a general rule of thumb it is a bad idea to blindly run scripts found on the internet on your computer, even if the author doesn't mean any harm, things can go wrong. Furthermore it is generally a good idea to actually learn how your device works rather than just using tools that do everything for you.
However if you do not feel up to the task, and you are running Windows, you can use this automated tool instead if you want.
Fair warning: Flashing your TA partition is dangerous stuff, do this wrong and you can most certainly hard-brick your device. I will not take any responsibility at all for anything you deem might have (or might not have) been a result of these procedures, be it bricked devices, lost DRM-keys, your milk going sour, your computer exploding, your friends computer exploding, repetitive stress injury, the loss of any limbs and/or digits or literally anything else.
General requirements before getting started:
Android SDK platform-tools (namely ADB)
Rooted Sony Xperia Z1 Compact
For this guide I am going to assume you know how ADB works and that you know how to get access to ADB in your preferred operating system.
Backing up your TA partition
For this part you will need both a locked and rooted Xperia Z1 Compact (this method works, follow the rooting part only). Ok, you don't actually need a locked device, but the most common reason for backing up this partition is to keep your DRM-keys intact, and this means your device needs to be locked.
Steps:
Open your favourite terminal emulator
Acquire a shell with your device (adb shell)
Acquire a root shell with your device (su)
dd if=/dev/block/platform/msm_sdcc.1/by-name/TA of=/sdcard/TA.img
md5 /dev/block/platform/msm_sdcc.1/by-name/TA /sdcard/TA.img
Verify that the hashes match!
Leave root shell (exit)
Leave device shell (exit)
adb pull /sdcard/TA.img TA.img
Use your favourite tool to verify the hash hasn't changed after copying to your computer (openssl md5 TA.img)
Put this file (and the hash) in a safe place, this is your TA backup.
Restoring your TA partition
For this part you will need your TA partition backup and the matching rooted Xperia Z1 Compact (literally the exact same device you got the backup from). You will also need to restore an unmodified stock boot partition (a boot partition from any ROM claiming to work on locked bootloaders will do fine) prior to restoring the TA partition backup, otherwise you will not be able to boot after restoring the TA partition. Also, do not attempt this with someone elses TA partition, I haven't personally tried it but I am told you will hard-brick your device! It sucks but if you've lost your DRM keys then you will not be able to recover them.
Steps:
Open your favourite terminal emulator
adb push TA.img /sdcard/TA.img
Acquire a shell with your device (adb shell)
Acquire a root shell with your device (su)
If you have the hash you read during the backup procedure stored, now is a good time to verify that it still matches the backup
dd if=/sdcard/TA.img of=/dev/block/platform/msm_sdcc.1/by-name/TA
md5 /dev/block/platform/msm_sdcc.1/by-name/TA /sdcard/TA.img
Make absolutely certain that the hashes match!
If they don't, DO NOT REBOOT YOUR DEVICE!
Leave root shell (exit)
Leave device shell (exit)
Done!
Good luck! If I have helped you, please click the thanks button!

Help modifying: ZTE Lever LT (Z936l)

I have been trying for 3 days straight now to modify this phone. So far I have been able to get temp root using king root, and am able to us ADB as su. That's as far as I've gotten. Neither CWM nor TWRP are compatible with my phone. I was going to attempt to manually port CWM to my phone, but I have no idea how to dump the recovery image. I would really like to install some custom firmware on this thing, but it is seeming to be impossible. How can i pull the recovery image off my phone? I've tried using a dozen apps now to try and backup my recovery image but none are doing what I need.The lack of any information or support online is making me rage hard.Wtf dude. Someone please help me.
Please forgive me for double posting. But I could really use some help dumping the rom. I've tried everything. All the guides I'm finding are 2-3 years old.
try this
stock system.img, boot.img, & recovery.img from someone who has not yet installed TWRP or supersu. To do this, install kingroot 4.5 and terminal emulator and run kingroot to get temp root. Then open terminal emulator and enter the following commands without the ""
"su"
"cd /dev/block/platform/7824900.sdhci/by-name"
"dd if=boot of=/sdcard/boot.img"
"dd if=recovery of=/sdcard/recovery.img"
"dd if=system of=/sdcard/system.img"
You will need to make sure you have at least 3GB of internal storage space before doing this just to be safe. The system.img will probably be about 1.5GB I did this and I got all three files saved to the root of my sd card. it would be easier for you do do this your self I am over my data cap so I cant upload the file
Anyone ever find a working root? I just got this phone a week ago and it is pretty dam good phone for the money. I need root so I can tether.
I also am waiting for root this phone is beast and I want compile a custom kernel for it but with root and a source I can't do jack sqwat.

forget encryption key reset - format /sdcard /data

Few days ago I decide to encrypt my phone. And as I want to install nightly so I rebooted and it want the password but then I discover I can't remember I tried adb shell but it says that I do not have permission (sudo does not works). So what should I basically do now? use terminal/ adb shell in TWRP and format /data and /sdcard with dd, or what is way to do it correctly? I come across to this https://android.stackexchange.com/questions/33398/cannot-factory-reset-after-encrypting#48264 but it's 4 years old I do not get completely "Substitute /dev/block/mmcblk0p12 and ext4 according to the recovery filesystem table (for /data). " part. I've LG G2.
Thanks Rob
roberto32 said:
Few days ago I decide to encrypt my phone. And as I want to install nightly so I rebooted and it want the password but then I discover I can't remember I tried adb shell but it says that I do not have permission (sudo does not works). So what should I basically do now? use terminal/ adb shell in TWRP and format /data and /sdcard with dd, or what is way to do it correctly? I come across to this https://android.stackexchange.com/questions/33398/cannot-factory-reset-after-encrypting#48264 but it's 4 years old I do not get completely "Substitute /dev/block/mmcblk0p12 and ext4 according to the recovery filesystem table (for /data). " part. I've LG G2.
Thanks Rob
Click to expand...
Click to collapse
I'm not an expert on this but since every device's partition map is unique, dd should be given the specific partition offsets and filesystem type for your device when performing any destructive operations or else you run the risk of bricking your device when using dd to write to your internal flash. That's what the "substitute" part is about because it varies from device-to-device.
I would suggest checking on one of LG G2 forums here, someone there can probably give you the proper parameters. (Here is the general LG G2 section, there are also some others eg for particular carriers like T-Mobile US)
I've already asked there but no answer. I'll rahter specifically ask about how to find partition table map. Thanks anyway

Categories

Resources