Skip to content

Instantly share code, notes, and snippets.

@isDipesh
Created April 12, 2013 18:24
Show Gist options
  • Save isDipesh/5374061 to your computer and use it in GitHub Desktop.
Save isDipesh/5374061 to your computer and use it in GitHub Desktop.
Android SMS backup/restore w/ adb
#Backup:
adb remount
adb pull /data/data/com.android.providers.telephony/databases/mmssms.db mmssms.db
#Restore:
adb remount
adb push mmssms.db /data/data/com.android.providers.telephony/databases/mmssms.db
@porg
Copy link

porg commented Oct 17, 2013

I hope you perceive my comment as on topic.

I want to rely solely on local backups and no cloud backups, and not achieve this with custom recoveries (physical security loophole) such as CWM, etc.

I noticed that on stock Android 4.3 adb backup -apk -all -system -f /path/to/my/backup.ab is all but complete! All 3rd party apps are properly backed up and restored, but sms, call log and contacts, practically all basic phone features, are NOT backed up!

Then I tried CyanogenMod and set Settings > Developer options > Root Access (duplicate entry also under: Settings > System > Superuser > Settings > Superuser Access) to "Apps and ADB".
Then tried your command line, which failed with:
failed to copy '/data/data/com.android.providers.telephony/databases/mmssms.db' to '/my/path': Permission denied

Obviously "Root access to ADB" means something else (what???) but not "Run ADB as Root".
To run the adb deamon on the Android device as root can be achieved by adb insecure.
Then I could pull and push properly! After the push, the sms app still showed the for test purposes intentionally emptied state, but after a restart (of the app or the whole system), it showed the proper restored state.

@suamikim
Copy link

suamikim commented Feb 4, 2015

This works fine for sms and text in mms but it doesn't seem to backup photos/pictures sent via mms.
I'd really appreciate instructions on how to also backup photos & pictures from mms.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment