How to copy /data partition from HTC One M8? - One (M8) Q&A, Help & Troubleshooting

My HTC ONE M8 battery died and all SMS messages disappeared.
I badly need them back.
So my idea was:
1. to have a block by block backup of /data partition to a Linux or Windows box.
2. use some standard tools trying to find missing or corrupted or deleted files there. Find the one which has the messages.
3. extract the messages using something like mmssmsxml.py in the SMS Backup/Restore format and bring it back to the phone.
Unfortunately at this point I am still at #1 since this requires Rooting the device and rooting according to all posts is going to delete all data. So my questions are:
1) Can I do a "partial rooting" to just unlock /data partition?
This would give me opportunity to dd all data from the partition.
2) are there any other methods? Maybe the standard Unix/Linux way of booting a limited OS image (consisting of: boot, mount, parted, dd ...) so I could boot from SD and run the dd command and copy /data partition to the SD card and then bring it to the Linux computer.
Please help.

No way to do this that I know of, unless you happen to already by s-off: http://forum.xda-developers.com/htc-one-m8/help/root-losing-data-s-off-t3457817

redpoint73 said:
No way to do this that I know of, unless you happen to already by s-off: http://forum.xda-developers.com/htc-one-m8/help/root-losing-data-s-off-t3457817
Click to expand...
Click to collapse
So, is there a way to S-off the phone without wiping it out?

You can use ADB to make a backup without root.
adb backup -apk -shared -all -f C:\Users\NAME\backup.ab to backup everything. Replace "NAME" with your Windows username.
adb restore C:\Users\NAME\backup.ab to restore the backup, replacing "NAME" again, of course.
You can read more about it in this thread.

I have not used the adb backup but I was told, that it backs up only files. The new mmssms.db exists in the file system and currently has no messages. I need to have the full image of the partition in order to search all block marked "empty" which could potentially be blocks of the damaged (and disappeared) mmssms.db file in order to re-construct the file and get all sms messages from it. The new mmssms.db exists in the file system and currently has no messages.
Please correct me if I am wrong and I will be able to search the adb backup for missing blocks.
Regards.
Vladimir

rubashev said:
I have not used the adb backup but I was told, that it backs up only files. The new mmssms.db exists in the file system and currently has no messages. I need to have the full image of the partition in order to search all block marked "empty" which could potentially be blocks of the damaged (and disappeared) mmssms.db file in order to re-construct the file and get all sms messages from it. The new mmssms.db exists in the file system and currently has no messages.
Please correct me if I am wrong and I will be able to search the adb backup for missing blocks.
Regards.
Vladimir
Click to expand...
Click to collapse
I really don't know. I've never had a problem like this myself, but I thought I would suggest it as it's the only way to backup without a custom recovery that I know of. To flash a custom recovery you need to unlock your bootloader first, and that will wipe your phone.

Related

[Q] What are you using to backup your roms?

My HD2 can use clockworkmod from the bootloader to create a backup of sys & boot. Even windows had sprite backup to make a image of the rom.....so what do tilt users have to backup their rom so they can get back to a good copy of it or try a new rom without losing everything?
famewolf said:
My HD2 can use clockworkmod from the bootloader to create a backup of sys & boot. Even windows had sprite backup to make a image of the rom.....so what do tilt users have to backup their rom so they can get back to a good copy of it or try a new rom without losing everything?
Click to expand...
Click to collapse
You can backup data from within install menu(dont remember how its properly called)
And system well if you have a flashed image on sd card than there is no point to back it up.
-Arturo- said:
You can backup data from within install menu(dont remember how its properly called)
And system well if you have a flashed image on sd card than there is no point to back it up.
Click to expand...
Click to collapse
Some of us change our system as well such as custom kernels, customized framework's and additional tweaks to files such as the build.conf etc we'd rather not have to keep doing over.
famewolf said:
Some of us change our system as well such as custom kernels, customized framework's and additional tweaks to files such as the build.conf etc we'd rather not have to keep doing over.
Click to expand...
Click to collapse
Well the thing with system is that after you flash it ..it stays in the memory card then you can move it(back it up) to your computer and change it accordingly. So for example you have changed the framework in the system on your phone.... you can do the same with the backed up system on computer and it will take you not more then 15 seconds. You just open it with 7zip and the world is yours you can pretty much do whatever you want with it remove/add files replace them and so on....and that is all the files and folders in the system image. If you have ever removed/replaced/added files to a simple rar archive then you pretty much know how easy it is to edit a rom on your computer.
backing up your kaiser
Android is just Linux so you can do almost anything you can do in Linux if you can get to the shell. I use a program called Terminal Emulator from a guy called jackpal that I got from the Market. It will give you a command prompt so you can perform any Linux commands you like and if you type su it will act as super user and give you a # prompt.
I also went as far as writing my own userinit.sh that runs each time I boot and copies files from my data partition on NAND to the SD card. I just copy the /data/data, /data/app, /data/local, and /data/system folders to a folder named backup on the root of the SD card. The script also moves the previous backup to a folder called backup.old and if backup.old already exists it deletes it first.
This way if my phone reboots and data is corrupt I can use Root Explorer to copy the files in either backup or backup.old on my SD card back to NAND and my phone is restored.
You can also us the backup routines that are in the menu that comes up when you press the DPAD during the boot process but that backs up the entire data partition to the tune of 256MB and if there is corruption it really doesn't do much good.
As a side note you can mount the file created by the backup on any linux box using the mount command and a loop device. Once mounted you can just copy files that you need out and transfer them back to your phone using the SD card.

[Q] [TMobile] IMEI Back up/ Restore

Simply put, do you have a verifiable way to do this?
Currently there is not. There is a thread in general discussing this problem. I hope we find a way soon. Take caution when flashing.
Sent from my SGH-T999 using xda premium
This is from the SGSII I9100 General section. I thought that since my phone was messed up, I'd give it a try,
but it was a no go. This does tell me a couple of things though. 1. CWM does copy the efs folder, and 2. I do not think the IMEI is there, but since I'm unsure when I lost my IMEI it is of course a guess.
[GUIDE] Recover your IMEI in 9 steps.
1. Running on a stock rooted ROM. Used Rom Toolbox. Created a folder called tempefs. copied the efs folder into tempefs.
2. Deleted the efs folder...rebooted the phone got a message that Factory Mode was on.
3. Went to restore the efs folder from my tempefs and it was GONE! I did not copy it to my external SD!
Phone still worked fine, but now a big box with System information is displayed.
4. Did a CWM recovery and back to normal except this time it restored CM9...so, the efs folder IS included, however, my IMEI # is still 0.
5. Started over...this time copied the efs folder to my external sd card.
6. Deleted the efs folder and rebooted phone. Note: Phone did not come back up into Factory Mode...running CM9.
Further, this "4) go to EFS folder using root explorer, and delete "nv_data.bin", "nv_data.bin.md5"." did not
apply.
7. Copied my imei folder from my external sd to the efs folder.
8. Copied my redata.bin file from my external sd to the efs folder.
9. copied my redata.bin file again
10. renamed my redata Copy.bin to redata.bak
11. Used Terminal and typed the following:
su <enter>
chown 1001:radio /efs/redata.bin <enter>
gave me this error message: Unable to chown redata.bin : Read only file system 10
12. I went in an changed the permissions of the file to all read all write and all execute and tried again.
same error message.
So, there ya have it. I have now received my replacement phone, so if any of you very smart dudes out there have any suggestions, I can compare stock vs. screwed at this point.
If you are willing to do some experimentation, we may be able to validate a backup/restore. Try doing this just as a proof-of-concept, though it may or may not be illegal (modifying an IMEI is illegal in several countries). You should only need to be rooted on the old phone for all the below
Without your SIM card in the old phone (we dont want the carrier knowing this happened :angel
1. Backup your old phones current /efs with the following command:
Code:
dd if=/dev/block/platform/msm_sdcc.1/by-name/efs of=/external_sd/efs_backup.img
(If you arent on a CM rom, you might need a different path for /external_sd/
2. Backup your new phones /efs with the same command. Done with the new phone (I aint trying to get that one messed up to )
3. Copy both files somewhere
4. Copy the new phone's efs backup to your old phone to something like /external_sd/efs_new.img and run the following to restore the new phones efs to your old phone:
Code:
dd if=/external_sd/efs_new.img of=/dev/block/platform/msm_sdcc.1/by-name/efs
Reboot (without the SIM) the old phone and see if it shows up with the new phone's IMEI info. If it does then I think we can say the above command can successfully backup and restore the efs data. At that point, restore the corrupted efs back over the old phone so that you dont have two phones with the same IMEI.
And use adb, not terminal emulator. You really do not want to make a typo with those dd commands. I strongly suggest people get a putty binary that has adb connectivity. And use bash on the phone.
I will check this out...I have 6 days to return my phone. Too damn tired tonight though. Thanks!
Sent from my SGH-T999 using xda premium
lumbu said:
If you are willing to do some experimentation, we may be able to validate a backup/restore. Try doing this just as a proof-of-concept, though it may or may not be illegal (modifying an IMEI is illegal in several countries). You should only need to be rooted on the old phone for all the below
Without your SIM card in the old phone (we dont want the carrier knowing this happened :angel
1. Backup your old phones current /efs with the following command:
Code:
dd if=/dev/block/platform/msm_sdcc.1/by-name/efs of=/external_sd/efs_backup.img
(If you arent on a CM rom, you might need a different path for /external_sd/
2. Backup your new phones /efs with the same command. Done with the new phone (I aint trying to get that one messed up to )
3. Copy both files somewhere
4. Copy the new phone's efs backup to your old phone to something like /external_sd/efs_new.img and run the following to restore the new phones efs to your old phone:
Code:
dd if=/external_sd/efs_new.img of=/dev/block/platform/msm_sdcc.1/by-name/efs
Reboot (without the SIM) the old phone and see if it shows up with the new phone's IMEI info. If it does then I think we can say the above command can successfully backup and restore the efs data. At that point, restore the corrupted efs back over the old phone so that you dont have two phones with the same IMEI.
And use adb, not terminal emulator. You really do not want to make a typo with those dd commands. I strongly suggest people get a putty binary that has adb connectivity. And use bash on the phone.
Click to expand...
Click to collapse
Awesome idea, but it did not work. Any other ideas?
zonly1 said:
Awesome idea, but it did not work. Any other ideas?
Click to expand...
Click to collapse
We can go through each block device one by one to try to find where the data is stored. But this could lead to an actual brick of the old phone, and I dont want you to do anything that might cause T-Mobile to charge you for something that they say voided the warranty. The rest of the backup commands (excluding /system, /data, /cache and recovery) would be:
Code:
dd if=/dev/block/platform/msm_sdcc.1/by-name/aboot of=/external_sd/aboot_backup.img
dd if=/dev/block/platform/msm_sdcc.1/by-name/backup of=/external_sd/backup_backup.img
dd if=/dev/block/platform/msm_sdcc.1/by-name/boot of=/external_sd/boot_backup.img
dd if=/dev/block/platform/msm_sdcc.1/by-name/fota of=/external_sd/fota_backup.img
dd if=/dev/block/platform/msm_sdcc.1/by-name/fsg of=/external_sd/fsg_backup.img
dd if=/dev/block/platform/msm_sdcc.1/by-name/grow of=/external_sd/grow_backup.img
dd if=/dev/block/platform/msm_sdcc.1/by-name/modem of=/external_sd/modem_backup.img
dd if=/dev/block/platform/msm_sdcc.1/by-name/modemst1 of=/external_sd/modemst1_backup.img
dd if=/dev/block/platform/msm_sdcc.1/by-name/modemst2 of=/external_sd/modemst2_backup.img
dd if=/dev/block/platform/msm_sdcc.1/by-name/pad of=/external_sd/pad_backup.img
dd if=/dev/block/platform/msm_sdcc.1/by-name/param of=/external_sd/param_backup.img
dd if=/dev/block/platform/msm_sdcc.1/by-name/persist of=/external_sd/persist_backup.img
dd if=/dev/block/platform/msm_sdcc.1/by-name/rpm of=/external_sd/rpm_backup.img
dd if=/dev/block/platform/msm_sdcc.1/by-name/sbl1 of=/external_sd/sbl1_backup.img
dd if=/dev/block/platform/msm_sdcc.1/by-name/sbl2 of=/external_sd/sbl2_backup.img
dd if=/dev/block/platform/msm_sdcc.1/by-name/sbl3 of=/external_sd/sbl3_backup.img
dd if=/dev/block/platform/msm_sdcc.1/by-name/ssd of=/external_sd/ssd_backup.img
dd if=/dev/block/platform/msm_sdcc.1/by-name/tz of=/external_sd/tz_backup.img
I really dont know what each of these does, so if I were you I wouldnt listen to me or try this. But if you want to experiment and are not worried about what T-Mobile might do, backing each of these up on the new phone and going through restoring one by one on the old one should let us figure out what device actually needs to be backed up.
Or we could wait for some people smarter than me who can figure this out without risking a brick.
------
Edit
-----
Before trying to restore, try backing them up on both phones. Then do an md5sum on each image to see which might be the same between the two. Cross those off the list of what to try restoring.
There's a user names Geek that is working on a fix...looks promising! Thanks for all the help!
Sent from my SGH-T999 using xda premium

[Q] adb backup sizes?

Hi,
I'm just trying to backup my HOX to do a post-JB factory reset. I'm a bit concerned about the size of backup files I'm getting from adb - they seem very small!
adb backup -apk -all -nosystem -f backup.ab
for example, gives a backup.ab file of 253Mb. Can that be right? I understood those flags would include all non-system apps (not on the phone storage), not just their settings, and I'd have expected a lot more than that. Storage in Settings tells me I'm using 6.xxGb of "app storage" and about 4Gb of the 25Gb phone storage.
I know actual figures depend on personal usage, I just wanted to know whether people thought those seemed like correct ballpark figures.
adb would seem to be my only option real option since I don't want to root until I'm out of warranty.
Thanks,
Allan
That's only the system partition and it sounds about right.
To fully backup your phone you would want system, data, boot, and sdcard (not usually done as it's not erased for most things).
(Easiest way I know is to a backup like that using CWM or TWRP recoveries)
Thanks, that's reassuring that it doesn't seem anything's wrong with the backup.
I'd really rather not root to use any of the more powerful backup solutions but I recognise that means I'm more limited with what I can do.
I think I'll rebackup with adv to cover the last few days and then just go for it.
Thanks again!

error restoring /data

Hi!
Today i've tried to restore my nandroid backup from philz recovery. It restores boot and system but when it comes to data it's saying: error while restoring /data. So for now it seems that my data partition is lost
Anybody experienced this issue? Is there any workaround?
(I'm on stock 14.3.A.0.757 with locked bootloader)
Thanks!
Yes, I had the same issue. I could't find any fix. For now I am only doing backups with TWRP and regularly manually save files on the computer.
I notified [NUT] here already, http://forum.xda-developers.com/showpost.php?p=53100495&postcount=239
zxz0O0 said:
Yes, I had the same issue. I could't find any fix. For now I am only doing backups with TWRP and regularly manually save files on the computer.
I notified [NUT] here already, http://forum.xda-developers.com/showpost.php?p=53100495&postcount=239
Click to expand...
Click to collapse
what do you mean by manually save files on computer? do you copy+paste android/data folder to your computer as a backup?
No, if you simply do that you will lose permissions. I create a tar file on the phone and copy this tar file to my computer (using adb or terminal emulator)
Finally I've successfully restored some of my applications with app called Nandroid Manager * ROOT.
@zxz0O0
i see and what terminal emulator do you use?
well i kinda wonder since i hate restoring backup from pc companion coz it takes ages, i would like to ask if this is pausible since haven't tried yet..
im gonna copy android/data folder and paste it on my computer as backup then i'm gonna do crazy stuff on my phone, re-install my files from store again and start restoring game saves by copying android/data from my pc backup to my phone.. will it work? will it screw permission as well?
The app is called "Terminal emulator". If you copy data to windows computer you will lose permissions because linux and windows are different.

Way to backup and restore from PC (no root)?

At the moment I dont' want to unlock,root the phone and install TWRP because I'm fine with stock Rom, but there's a way to backup to pc and restore from pc as we can with TWRP recovery?
Thanks
failax said:
At the moment I dont' want to unlock,root the phone and install TWRP because I'm fine with stock Rom, but there's a way to backup to pc and restore from pc as we can with TWRP recovery?
Thanks
Click to expand...
Click to collapse
ADB Backup
https://9to5google.com/2017/11/04/how-to-backup-restore-android-device-data-android-basics/
Google search link with 1.590.000 hits
My command line is:
Code:
adb backup -apk -shared -all -system -f C:/user/Pixel2XL/adb_backup/mmddyy.ab
This backs up all user apps and data, all system apps and data, and shared storage (internal SD card)
Pkt_Lnt said:
ADB Backup
https://9to5google.com/2017/11/04/how-to-backup-restore-android-device-data-android-basics/
Google search link with 1.590.000 hits
My command line is:
Code:
adb backup -apk -shared -all -system -f C:/user/Pixel2XL/adb_backup/mmddyy.ab
This backs up all user apps and data, all system apps and data, and shared storage (internal SD card)
Click to expand...
Click to collapse
Actually, you might want to include
Code:
-obb -keyvalue
*if you want to backup your games and any "apps that perform key/value backups"
What a great idea @Pkt_Lnt! I wish I realized this when I was planning to root and wanted to backup as best I could...
I'm purely just wondering, why include "-apk -shared" & "-system" when you have an option of "-all"? And isn't including "-f" meant to backup a specific file?
P.S. nevermind (on the -all & -system), after reading the help on the command, -all doesn't cover system apps...
Also, in terms of restoring.... would this method depend on root access for full restoration? does this method even backup settings and "personalizations" without root access (at least when backing up)?
simplepinoi177 said:
Actually, you might want to include
Code:
-obb -keyvalue
*if you want to backup your games and any "apps that perform key/value backups"
What a great idea @Pkt_Lnt! I wish I realized this when I was planning to root and wanted to backup as best I could...
I'm purely just wondering, why include "-apk -shared" & "-system" when you have an option of "-all"? And isn't including "-f" meant to backup a specific file?
P.S. nevermind (on the -all & -system), after reading the help on the command, -all doesn't cover system apps...
Also, in terms of restoring.... would this method depend on root access for full restoration? does this method even backup settings and "personalizations" without root access (at least when backing up)?
Click to expand...
Click to collapse
1 - I was trying to teach the poster above to fish, not trying to do the fishing for him. That said, I'm not a gamer, that "-obb" is not relevant to me.
2 - backup -f file Write an archive of the device's data to file.
This Reference
I do not see your "-keyvalue" in that ADB Command Reference doc, you might want to verify that before using it.
This is my actual command line from today. I'm on Linux, so I tried to make this easier for the Win crowd, knowing the tilde_backslash_path would throw 99% of those who might read this for a loop!
Code:
[email protected] ~ $ adb backup -apk -shared -all -system -f ~/Pixel2XL_adb_backup/backup05172018.ab
3 - ADB commands to not require root. Restore has always worked for me, and as you might guess, I have many "adb grant permissions" in use. :good:
For the rest of your questions, sorry I don't have time to do that research for you. All I use is the This Reference above, if that does not provide what you are asking, try this.
Pkt_Lnt said:
1 - I was trying to teach the poster above to fish, not trying to do the fishing for him. That said, I'm not a gamer, that "-obb" is not relevant to me.
2 - backup -f file Write an archive of the device's data to file.
This Reference
I do not see your "-keyvalue" in that ADB Command Reference doc, you might want to verify that before using it.
This is my actual command line from today. I'm on Linux, so I tried to make this easier for the Win crowd, knowing the tilde_backslash_path would throw 99% of those who might read this for a loop!
Code:
[email protected] ~ $ adb backup -apk -shared -all -system -f ~/Pixel2XL_adb_backup/backup05172018.ab
3 - ADB commands to not require root. Restore has always worked for me, and as you might guess, I have many "adb grant permissions" in use. :good:
For the rest of your questions, sorry I don't have time to do that research for you. All I use is the This Reference above, if that does not provide what you are asking, try this.
Click to expand...
Click to collapse
Cool...thanks for answering what you could...I was merely curious; I didn't mean/intend/imply that you do the research for me or anything. Yea, I know absolutely nothing about Linux and it's environment; so I/we appreciate you converting it to the "windows crowd" as well as "spelling it out" for me in the format you wrote it all out in your post. I, myself, have root and use TWRP for the backups...I was just trying to expand the knowledge...
Thanks again!

Categories

Resources