Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,732,479 Members 49,398 Now Online
XDA Developers Android and Mobile Development Forum

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

Tip us?
 
YMatrix
Old
(Last edited by YMatrix; 8th November 2013 at 10:27 PM.)
#1  
YMatrix's Avatar
Senior Member - OP
Thanks Meter 186
Posts: 507
Join Date: Feb 2013
Default [SOLVED][Guide] How to backup EFS + Modemfs folders

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, 949 views)
Phone: Samsung Galaxy S5 G900H / Samsung Galaxy S Advance I9070
Base: Stock KitKat / JellyBean UBLPK
Rom: Stock / CyanogenMod 11

The Following 7 Users Say Thank You to YMatrix For This Useful Post: [ Click to Expand ]
 
BOOTMGR
Old
#2  
Recognized Contributor
Thanks Meter 1537
Posts: 673
Join Date: Aug 2010
Location: Ahmedabad
Quote:
Originally Posted by YMatrix View Post
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 world aint all sunshine and rainbows, its a very mean and nasty place and I dont care how tough you are, it will beat you to your knees and keep you there permanently if you let it.
You, me, or nobody, is gonna hit as hard as life; but it aint about how hard you hit, its about how hard you can get hit and keep moving forward, how much you can take and keep moving forward.
Thats how winning is done...
Donate me some "Thanks" if i've helped you...
The Following 2 Users Say Thank You to BOOTMGR For This Useful Post: [ Click to Expand ]
 
YMatrix
Old
(Last edited by YMatrix; 28th June 2013 at 07:38 AM.)
#3  
YMatrix's Avatar
Senior Member - OP
Thanks Meter 186
Posts: 507
Join Date: Feb 2013
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
Phone: Samsung Galaxy S5 G900H / Samsung Galaxy S Advance I9070
Base: Stock KitKat / JellyBean UBLPK
Rom: Stock / CyanogenMod 11

 
KINGbabasula
Old
(Last edited by KINGbabasula; 28th June 2013 at 09:49 AM.)
#4  
KINGbabasula's Avatar
Recognized Developer
Thanks Meter 3262
Posts: 1,967
Join Date: Jan 2013
Location: Treviso

 
DONATE TO ME
Quote:
Originally Posted by YMatrix View Post
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
My Github

IF EVERYONE STARTS "JUST ASKING" IMAGINE THE MESS XDA WOULD BE

The Following User Says Thank You to KINGbabasula For This Useful Post: [ Click to Expand ]
 
YMatrix
Old
#5  
YMatrix's Avatar
Senior Member - OP
Thanks Meter 186
Posts: 507
Join Date: Feb 2013
Quote:
Originally Posted by KINGbabasula View Post
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?
Phone: Samsung Galaxy S5 G900H / Samsung Galaxy S Advance I9070
Base: Stock KitKat / JellyBean UBLPK
Rom: Stock / CyanogenMod 11

 
KINGbabasula
Old
#6  
KINGbabasula's Avatar
Recognized Developer
Thanks Meter 3262
Posts: 1,967
Join Date: Jan 2013
Location: Treviso

 
DONATE TO ME
Quote:
Originally Posted by YMatrix View Post
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
My Github

IF EVERYONE STARTS "JUST ASKING" IMAGINE THE MESS XDA WOULD BE

 
YMatrix
Old
#7  
YMatrix's Avatar
Senior Member - OP
Thanks Meter 186
Posts: 507
Join Date: Feb 2013
Quote:
Originally Posted by KINGbabasula View Post
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)?
Phone: Samsung Galaxy S5 G900H / Samsung Galaxy S Advance I9070
Base: Stock KitKat / JellyBean UBLPK
Rom: Stock / CyanogenMod 11

 
KINGbabasula
Old
#8  
KINGbabasula's Avatar
Recognized Developer
Thanks Meter 3262
Posts: 1,967
Join Date: Jan 2013
Location: Treviso

 
DONATE TO ME
Quote:
Originally Posted by YMatrix View Post
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
My Github

IF EVERYONE STARTS "JUST ASKING" IMAGINE THE MESS XDA WOULD BE

The Following User Says Thank You to KINGbabasula For This Useful Post: [ Click to Expand ]
 
YMatrix
Old
#9  
YMatrix's Avatar
Senior Member - OP
Thanks Meter 186
Posts: 507
Join Date: Feb 2013
Quote:
Originally Posted by KINGbabasula View Post
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.
Phone: Samsung Galaxy S5 G900H / Samsung Galaxy S Advance I9070
Base: Stock KitKat / JellyBean UBLPK
Rom: Stock / CyanogenMod 11

 
KINGbabasula
Old
#10  
KINGbabasula's Avatar
Recognized Developer
Thanks Meter 3262
Posts: 1,967
Join Date: Jan 2013
Location: Treviso

 
DONATE TO ME
Quote:
Originally Posted by YMatrix View Post
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
My Github

IF EVERYONE STARTS "JUST ASKING" IMAGINE THE MESS XDA WOULD BE


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes