FORUMS

Optimize Battery Life with This Useful App

Battery life is an important aspect of your smartphone, especially if you use it for more … more

The OnePlus 2 & The Year of Smartphone Compromises

We are very close to entering the last third of 2015, and we have now seen many of … more

OnePlus 2 Teardown, Major Android Vulnerability – XDA TV

The OnePlus 2 has been officially released. That and much more news is … more

What Do You Think About Fingerprint Scanners?

More and more phones are featuring fingerprint scanners, and with many promising … more

[SOLVED][Guide] How to backup EFS + Modemfs folders

539 posts
Thanks Meter: 192
 
By YMatrix, Senior Member on 28th June 2013, 06:47 AM
Post Reply Subscribe to Thread Email Thread
Hello!

So I recently stumbled upon some information that while flashing all kinds of Roms, you might lose your IMEI, thus being left over with a nice paper weight.
To my understanding this information is stored in the EFS folder (though according to this thread it is actually stored in modemfs).
I googled around and saw many options: PC software, terminal commands, apps etc.
Since each phone utilizes this option in different ways, which would be a good way to backup these folders in case of emergency on the S Advance?

Thanks!

SOLUTION:

These are the commands from the ADB shell, but can also be used within the terminal.

Backup Process:
Code:
adb shell
su
dd if=/dev/block/mmcblk0p7 of=/sdcard/efs_backup.img
dd if=/dev/block/mmcblk0p2 of=/sdcard/modemfs_backup.img 
exit
exit
adb pull /sdcard/efs_backup.img efs_backup.img
adb pull /sdcard/modemfs_backup.img modemfs_backup.img
Restore Backup Process:
Code:
adb push efs_backup.img /sdcard/efs_backup.img
adb push modemfs_backup.img /sdcard/modemfs_backup.img
adb shell
su
dd if=/sdcard/efs_backup.img of=/dev/block/mmcblk0p7 
dd if=/sdcard/modemfs_backup.img of=/dev/block/mmcblk0p2 
exit
exit
Thanks to @mr.harsh and @KINGbabasula for help and KINGbabasula for making the script!
Please note that the restore commands haven't been tested out, but theoretically its supposed to work.
If someone has made a backup and wiped his EFS folder, he wont mind testing it out
Attached Files
File Type: zip efsbackup.zip - [Click for QR Code] (457.2 KB, 2662 views)
Last edited by YMatrix; 8th November 2013 at 10:27 PM.
The Following 7 Users Say Thank You to YMatrix For This Useful Post: [ View ]
 
 
28th June 2013, 07:19 AM |#2  
BOOTMGR's Avatar
Recognized Contributor
Flag Ahmedabad
Thanks Meter: 2,939
 
More
Quote:
Originally Posted by YMatrix

Hello!

So I recently stumbled upon some information that while flashing all kinds of Roms, you might lose your IMEI, thus being left over with a nice paper weight.
To my understanding this information is stored in the EFS folder (though according to this thread it is actually stored in modemfs).
I googled around and saw many options: PC software, terminal commands, apps etc.
Since each phone utilizes this option in different ways, which would be a good way to backup these folders in case of emergency on the S Advance?

Thanks!

in the terminal type:
Code:
su
cp /dev/block/mmcblk0p7 /sdcard/efs_backup
cp /dev/block/mmcblk0p2 /sdcard/modemfs_backup
check that efs_backup is 10MB and modemfs_backup is 16MB.And this is for JB.I don't know about GB but most probably they'll be same...
The Following 2 Users Say Thank You to BOOTMGR For This Useful Post: [ View ]
28th June 2013, 07:33 AM |#3  
YMatrix's Avatar
OP Senior Member
Thanks Meter: 192
 
More
Thank you for your quick reply.
I tested it out and got the sizes you said.
The restore process, if ever needed, is the same cp command only changing the source and destination?
Whats the difference between the CP command and the DD command?
Any way to do this from recovery or ADB?

Sent from my GT-I9070 using Tapatalk 4 Beta
Last edited by YMatrix; 28th June 2013 at 07:38 AM.
28th June 2013, 09:46 AM |#4  
KINGbabasula's Avatar
Recognized Developer
Flag Treviso
Thanks Meter: 4,888
 
Donate to Me
More
Quote:
Originally Posted by YMatrix

Thank you for your quick reply.
I tested it out and got the sizes you said.
The restore process, if ever needed, is the same cp command only changing the source and destination?
Whats the difference between the CP command and the DD command?
Any way to do this from recovery or ADB?

Sent from my GT-I9070 using Tapatalk 4 Beta

Via adb:
Code:
adb shell
$ su
# cp /dev/block/mmcblk0p7 /sdcard/efs_backup
# cp /dev/block/mmcblk0p2 /sdcard/modemfs_backup
# exit
$ exit
adb pull /sdcard/efs_backup %cd%\efs_backup
adb pull /sdcard/modemfs_backup %cd%\modemfs_backup
Last edited by KINGbabasula; 28th June 2013 at 09:49 AM.
The Following User Says Thank You to KINGbabasula For This Useful Post: [ View ]
28th June 2013, 09:48 AM |#5  
YMatrix's Avatar
OP Senior Member
Thanks Meter: 192
 
More
Quote:
Originally Posted by KINGbabasula

Via adb:

Code:
adb shell
$ su
# cp /dev/block/mmcblk0p7 /sdcard/efs_backup
# cp /dev/block/mmcblk0p2 /sdcard/modemfs_backup

Thank you!
Why use the CP command and not the DD command? Or in this case it doesn't really matter?
28th June 2013, 09:51 AM |#6  
KINGbabasula's Avatar
Recognized Developer
Flag Treviso
Thanks Meter: 4,888
 
Donate to Me
More
Quote:
Originally Posted by YMatrix

Thank you!
Why use the CP command and not the DD command? Or in this case it doesn't really matter?

cp=copy dd=copy, convert, format. See my reply. I updated
28th June 2013, 09:56 AM |#7  
YMatrix's Avatar
OP Senior Member
Thanks Meter: 192
 
More
Quote:
Originally Posted by KINGbabasula

cp=copy dd=copy, convert, format. See my reply. I updated

Still don't get the difference DD / CP
As for the commands you posted, I was asking for the restore process, so I am guessing it will look like this:
Code:
adb shell
$ su
# cp /sdcard/efs_backup /dev/block/mmcblk0p7 
# cp /sdcard/modemfs_backup /dev/block/mmcblk0p2 
# exit
$ exit
Is there a "push" command also (to be used like the pull command)?
28th June 2013, 10:01 AM |#8  
KINGbabasula's Avatar
Recognized Developer
Flag Treviso
Thanks Meter: 4,888
 
Donate to Me
More
Quote:
Originally Posted by YMatrix

Still don't get the difference DD / CP
As for the commands you posted, I was asking for the restore process, so I am guessing it will look like this:

Code:
adb shell
$ su
# cp /sdcard/efs_backup /dev/block/mmcblk0p7 
# cp /sdcard/modemfs_backup /dev/block/mmcblk0p2 
# exit
$ exit
Is there a "push" command also (to be used like the pull command)?

I'm not sure but i think that you need to use dd to restore because you are going to flash 2 partition like flashing kernel.
You can do this (i repeat Im not sure)
Code:
adb push efs_backup /sdcard/efs_backup
adb push modemfs_backup /sdcard/modemfs_backup
adb shell
$ su
# dd if=/sdcard/efs_backup of=/dev/block/mmcblk0p7 
# dd if=/sdcard/modemfs_backup of=/dev/block/mmcblk0p2 
# exit
$ exit
Pay attention cause if you dd to a wrong partition you may brick
The Following User Says Thank You to KINGbabasula For This Useful Post: [ View ]
28th June 2013, 10:06 AM |#9  
YMatrix's Avatar
OP Senior Member
Thanks Meter: 192
 
More
Quote:
Originally Posted by KINGbabasula

I'm not sure but i think that you need to use dd to restore because you are going to flash 2 partition like flashing kernel.

Pay attention cause if you dd to a wrong partition you may brick

Hmmm, so this is a pickle.
Wrong partition is always a problem, but since I also checked a thread by @frapeti, I am assuming the partition numbers are correct, though I don't know about the commands. Since we saved using CP shouldn't we also restore using CP? Otherwise I would say save using DD and then restore using DD.
28th June 2013, 10:08 AM |#10  
KINGbabasula's Avatar
Recognized Developer
Flag Treviso
Thanks Meter: 4,888
 
Donate to Me
More
Quote:
Originally Posted by YMatrix

Hmmm, so this is a pickle.
Wrong partition is always a problem, but since I also checked a thread by @frapeti, I am assuming the partition numbers are correct, though I don't know about the commands. Since we saved using CP shouldn't we also restore using CP? Otherwise I would say save using DD and then restore using DD.

No because cp copy the content of the partition. dd format the partition then copy in the partition
28th June 2013, 10:11 AM |#11  
YMatrix's Avatar
OP Senior Member
Thanks Meter: 192
 
More
Quote:
Originally Posted by KINGbabasula

No because cp copy the content of the partition. dd format the partition then copy in the partition

Oh, alright, so to sum up so people can use this for future reference:

Backup Process:
Code:
adb shell
$ su
# cp /sdcard/efs_backup /dev/block/mmcblk0p7 
# cp /sdcard/modemfs_backup /dev/block/mmcblk0p2 
# exit
$ exit
Restore Backup Process:
Code:
adb push efs_backup /sdcard/efs_backup
adb push modemfs_backup /sdcard/modemfs_backup
adb shell
$ su
# dd if=/sdcard/efs_backup of=/dev/block/mmcblk0p7 
# dd if=/sdcard/modemfs_backup of=/dev/block/mmcblk0p2 
# exit
$ exit

Read More
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes