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

Search This thread

YMatrix

Senior Member
Excellent tutorial. Just one Q though...
These commands through terminal:

$ su
# dd if=/dev/block/mmcblk0p7 of=/sdcard/efs_backup.img
# dd if=/dev/block/mmcblk0p2 of=/sdcard/modemfs_backup.img
# exit

means they must be performed from the phone while it's working (booted), or...?

thx.

Yes, just boot your phone and type them in the terminal.
As you can see from the commands, it saves the 2 images on your internal SD card.
 

Piachnp

Senior Member
Oct 9, 2012
104
24
New York
@YMatrix @KINGbabasula Ok, so I tried to be a responsible person and backup this files..... I don't know what the hell happened, I used this commands in terminal emulator:

$ su
# dd if=/dev/block/mmcblk0p7 of=/sdcard/efs_backup.img
# dd if=/dev/block/mmcblk0p2 of=/sdcard/modemfs_backup.img

Files were created without problem, but then i noticed that mi 3g connectivity was glitchy, and then realized that my Modemfs folder is empty: 0 files, 0 bytes. My backups are the correct size (10 and 16mb).
Tried to restore the modemfs image, but the folder is still empty. I DO NOT RECOMMEND THIS METHOD, just copy the folders as they are from a file explorer and be done with it..... i wish i had done this :(

EFS folder doesn't seem to have the same problem, don't know why. Does anyone know if i can get a modemfs "transplant" from another user with the same firmware ?? (my firmware is VSLP9 (Movistar Argentina firmware).
Just to be clear, 3G works sometimes, but most of the time (especially when switching over from wifi) i don't get any kind of data signal as if data mode was off...
 

YMatrix

Senior Member
@YMatrix @KINGbabasula Ok, so I tried to be a responsible person and backup this files..... I don't know what the hell happened, I used this commands in terminal emulator:

$ su
# dd if=/dev/block/mmcblk0p7 of=/sdcard/efs_backup.img
# dd if=/dev/block/mmcblk0p2 of=/sdcard/modemfs_backup.img

Files were created without problem, but then i noticed that mi 3g connectivity was glitchy, and then realized that my Modemfs folder is empty: 0 files, 0 bytes. My backups are the correct size (10 and 16mb).
Tried to restore the modemfs image, but the folder is still empty. I DO NOT RECOMMEND THIS METHOD, just copy the folders as they are from a file explorer and be done with it..... i wish i had done this :(

EFS folder doesn't seem to have the same problem, don't know why. Does anyone know if i can get a modemfs "transplant" from another user with the same firmware ?? (my firmware is VSLP9 (Movistar Argentina firmware).
Just to be clear, 3G works sometimes, but most of the time (especially when switching over from wifi) i don't get any kind of data signal as if data mode was off...

First of all the problem and your assumption it is connected to the backup you created is INCORRECT.
The 2 commands you quoted are a copy raw data process, thus what was there during the copy will be in the backup file.
I don't know why your modemfs is empty, and whether it is connected to your problem (could be a rom bug, communication problem etc.)
More over, the "copy+paste" process you advised should also work, BUT the dd command makes sure you backup the data (including time stamps and permissions) as is, making your backup exact, so your wishing of copying the folders via root explorer wouldn't have changed a thing.
 

Nishad1982

Senior Member
Sep 8, 2013
233
36
Dubai
modemfs is not empty - recheck

@YMatrix @KINGbabasula Ok, so I tried to be a responsible person and backup this files..... I don't know what the hell happened, I used this commands in terminal emulator:

$ su
# dd if=/dev/block/mmcblk0p7 of=/sdcard/efs_backup.img
# dd if=/dev/block/mmcblk0p2 of=/sdcard/modemfs_backup.img

Files were created without problem, but then i noticed that mi 3g connectivity was glitchy, and then realized that my Modemfs folder is empty: 0 files, 0 bytes. My backups are the correct size (10 and 16mb).
Tried to restore the modemfs image, but the folder is still empty. I DO NOT RECOMMEND THIS METHOD, just copy the folders as they are from a file explorer and be done with it..... i wish i had done this :(

EFS folder doesn't seem to have the same problem, don't know why. Does anyone know if i can get a modemfs "transplant" from another user with the same firmware ?? (my firmware is VSLP9 (Movistar Argentina firmware).
Just to be clear, 3G works sometimes, but most of the time (especially when switching over from wifi) i don't get any kind of data signal as if data mode was off...

I did the same and at first sight when I came to check the modemfs folder by ES File Explorer I was stunned to see it empty. But I changed settings of ES File Explorer - enabled hidden files, root explorer and went for properties of the folder - there are 68 files, 6 folders. You can also check from terminal by typing the following command:

$su
#cd /modemfs
#ls -la

Before doing anything else I would advise you to check in my way.
 

iiD4x

Inactive Recognized Contributor
Feb 21, 2013
1,276
1,924
Ar Riyadh
Xiaomi Mi 11i
guys plz the correct commands for using it in terminal emu ,
bcuz when i use adb shell :
C:\Users\ABUTAREG\Desktop\efsbackup\tools>adb shell
~ # su
su
# dd if=/dev/block/mmcblk0p7 of=/sdcard/efs_backup.img
dd if=/dev/block/mmcblk0p7 of=/sdcard/efs_backup.img
20480+0 records in
20480+0 records out
10485760 bytes transferred in 1.527 secs (6866902 bytes/sec)
# dd if=/dev/block/mmcblk0p2 of=/sdcard/modemfs_backup.img
dd if=/dev/block/mmcblk0p2 of=/sdcard/modemfs_backup.img
32768+0 records in
32768+0 records out
16777216 bytes transferred in 2.343 secs (7160570 bytes/sec)
# exit
exit
~ # exit
exit

C:\Users\ABUTAREG\Desktop\efsbackup\tools>adb pull /sdcard/efs_backup efs_backup

remote object '/sdcard/efs_backup' does not exist

C:\Users\ABUTAREG\Desktop\efsbackup\tools>adb pull /sdcard/modemfs_backup modemf
s_backup
remote object '/sdcard/modemfs_backup' does not exist
what i did wrong ?
 

iiD4x

Inactive Recognized Contributor
Feb 21, 2013
1,276
1,924
Ar Riyadh
Xiaomi Mi 11i
On the first command you forgot the .img file extension.
On the second command you added a space character after the "/"

Sent from my GT-I9070 using Tapatalk 4

where exactly ? i just used the commands on first post
so i copied and pasted it .. if it wrong edit it .

---------- Post added at 08:55 PM ---------- Previous post was at 08:48 PM ----------

On the first command you forgot the .img file extension.
On the second command you added a space character after the "/"

Sent from my GT-I9070 using Tapatalk 4

You did the backup commands correctly. The problems you had were with the syntax of the adb pull commands

Sent from my GT-I9070 using Tapatalk 4

Sorry dude , my english its not so well so please can u just QOUTE the command i should use i'll backup again , and i really dont know how i use PULL commands
i want detailed BACKUP and RESTORE commands pls :)

---------- Post added at 09:08 PM ---------- Previous post was at 08:55 PM ----------

@YMatrix is it like this ? i think u need to edit the command in first post because its without ".img" in pull command
C:\Users\ABUTAREG\Desktop\efsbackup\tools>adb shell
~ # su
su
# dd if=/dev/block/mmcblk0p7 of=/sdcard/efs_backup.img
dd if=/dev/block/mmcblk0p7 of=/sdcard/efs_backup.img
20480+0 records in
20480+0 records out
10485760 bytes transferred in 0.706 secs (14852351 bytes/sec)
# dd if=/dev/block/mmcblk0p2 of=/sdcard/modemfs_backup.img
dd if=/dev/block/mmcblk0p2 of=/sdcard/modemfs_backup.img
32768+0 records in
32768+0 records out
16777216 bytes transferred in 2.848 secs (5890876 bytes/sec)
# exit
exit
~ # exit
exit

C:\Users\ABUTAREG\Desktop\efsbackup\tools>adb pull /sdcard/efs_backup.img efs_ba
ckup
2535 KB/s (10485760 bytes in 4.039s)

C:\Users\ABUTAREG\Desktop\efsbackup\tools>adb pull /sdcard/modemfs_backup.img mo
demfs_backup
2514 KB/s (16777216 bytes in 6.516s)
 

shut_down

Senior Member
Sep 26, 2010
7,764
3,551
Belgrade
Samsung Galaxy S21 FE
where exactly ? i just used the commands on first post
so i copied and pasted it .. if it wrong edit it .

---------- Post added at 08:55 PM ---------- Previous post was at 08:48 PM ----------





Sorry dude , my english its not so well so please can u just QOUTE the command i should use i'll backup again , and i really dont know how i use PULL commands
i want detailed BACKUP and RESTORE commands pls :)

---------- Post added at 09:08 PM ---------- Previous post was at 08:55 PM ----------

@YMatrix is it like this ? i think u need to edit the command in first post because its without ".img" in pull command


Do not type # and $. It is there already (show do you have root access of not).





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 /sdcard/efs_backup.img 
adb push modemfs_backup /sdcard/modemfs_backup.img 
adb shell
su
d if=/sdcard/efs_backup of=/dev/block/mmcblk0p7 
dd if=/sdcard/modemfs_backup of=/dev/block/mmcblk0p2 
exit
exit






adb pull /sdcard/efs_backup efs_backup
adb pull /sdcard/modemfs_backup modemfs_backup



This is missing .img and path where to pull fille. Files will be in root of your sd card - use copy/paste like you would do for image, song or whatever.
 
Last edited:

YMatrix

Senior Member
@iiD4x The code on the OP was missing .img just like @shut_down said.
I fixed the OP code so it would be "Copy + Paste"-able to a Windows Command window (without the "#,$" which messed your script running.
The adb pull / push commands are just if you don't want to copy / paste the files via explorer window.
If you need any more help, feel free to ask.
Good luck!
 

iiD4x

Inactive Recognized Contributor
Feb 21, 2013
1,276
1,924
Ar Riyadh
Xiaomi Mi 11i
Do not type # and $. It is there already (show do you have root access of not).





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 /sdcard/efs_backup.img 
adb push modemfs_backup /sdcard/modemfs_backup.img 
adb shell
su
d if=/sdcard/efs_backup of=/dev/block/mmcblk0p7 
dd if=/sdcard/modemfs_backup of=/dev/block/mmcblk0p2 
exit
exit






adb pull /sdcard/efs_backup efs_backup
adb pull /sdcard/modemfs_backup modemfs_backup



This is missing .img and path where to pull fille. Files will be in root of your sd card - use copy/paste like you would do for image, song or whatever.

I know that i dont neet to type #,$
I just copied from cmd after i do it
.
The problem is in PAC 4.3 when I do restore nothing change ..




@iiD4x The code on the OP was missing .img just like @shut_down said.
I fixed the OP code so it would be "Copy + Paste"-able to a Windows Command window (without the "#,$" which messed your script running.
The adb pull / push commands are just if you don't want to copy / paste the files via explorer window.
If you need any more help, feel free to ask.
Good luck!



Sent from my GT-I9070 using xda app-developers app
 

YMatrix

Senior Member
I
The problem is in PAC 4.3 when I do restore nothing change ..

:silly: You should have said you're on CM Roms.
This process of backup and recovery is when you totally wipe your IMEI. On CM Roms, you don't wipe your IMEI but get a "global" one.
I am not sure why this happens (maybe @shut_down has more info on that), but a good way to work around it is by, reflashing stock, making sure your IMEI is back and then flash the CM Rom.
 

iiD4x

Inactive Recognized Contributor
Feb 21, 2013
1,276
1,924
Ar Riyadh
Xiaomi Mi 11i
:silly: You should have said you're on CM Roms.
This process of backup and recovery is when you totally wipe your IMEI. On CM Roms, you don't wipe your IMEI but get a "global" one.
I am not sure why this happens (maybe @shut_down has more info on that), but a good way to work around it is by, reflashing stock, making sure your IMEI is back and then flash the CM Rom.

i was on Stock , and flashed CM .
no 3G
IMEI Known
IMEI SV 01
Baseband Known

but 3g not working , why i dont know ..~!

so i tried the EFS restore and modemfs
still not workin
any suggestions
P.S : all CM Roms same problem , i tried SamiOS and 3g working also on stock .
 
Last edited:

iiD4x

Inactive Recognized Contributor
Feb 21, 2013
1,276
1,924
Ar Riyadh
Xiaomi Mi 11i
:silly: You should have said you're on CM Roms.
This process of backup and recovery is when you totally wipe your IMEI. On CM Roms, you don't wipe your IMEI but get a "global" one.
I am not sure why this happens (maybe @shut_down has more info on that), but a good way to work around it is by, reflashing stock, making sure your IMEI is back and then flash the CM Rom.

i was on Stock , and flashed CM .
no 3G
IMEI Known
IMEI SV 01
Baseband Known

but 3g not working , why i dont know ..~!

so i tried the EFS restore and modemfs
still not workin
any suggestions
P.S : all CM Roms same problem , i tried SamiOS and 3g working also on stock .

@YMatrix @shut_down i need help ..
 

Top Liked Posts

  • There are no posts matching your filters.
  • 7
    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 :D
    4
    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/ /dev/block/mmcblk0p2 
    # exit
    
    [/QUOTE]
    
    Thats wrong, to backup using cp use something like cp [original efs] [sdcard/backup folder]
    
    I guess it's better to use dd command for this purpose:
    
    dd if=/dev/block/mmcblk0p7 of=/sdcard/efs_backup.img
    
    dd if=/dev/block/mmcblk0p2 of=/sdcard/modemfs_backup.img
    
    To restore just switch if with of (input file / output file)
    
    Sent from my GT-I9070 using xda app-developers app
    3
    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...
    2
    Yeah that's why I asked. Wondering if I do anything wrong and it won't work when restoring.

    Copying the folders in theory should also work, its just safer to back them up using the DD command since you get the original structure, permissions, dates etc. of the partitions.
    Thus when restoring its as if you never tampered with them, while the "copy folder" method doesn't give you the original data structure.
    Again, it shouldn't make a difference (in theory), but we always like to be closest to the original ;)
    2
    Hi,

    I was trying to take backup of these folders, but before that, i thought of having a look at the actual folder in the root for their sizes.

    efs = 87 files, 12 folder. total six=ze is 4.84Kb
    modemfs = This folder is empty.

    Now please tell is if these are normal sizes. If it is normal then how come their backup is 10 & 16 Mb respectively.
    Regards,
    Fred

    I am surprised that your modemfs folder is empty :eek:
    As for the folder size vs. backup size, this is because that these folders are actually partitions on the phone. when backing up using DD / CP commands you are backing up the whole partition (even the "empty" bits of data), which is why you get the according sizes (these are the partition's sizes).