[Q] Create a .img file of the system partition - Moto G Q&A, Help & Troubleshooting

I bought a Moto G(XT1031) last week. I rooted it, and before removing any system apps, created a backup in TWRP of the system and boot partitions.
Now, I have the 8GB model(couldn't find a 16GB one cheap enough) and so I would like to create a .img of the system and boot partitions. I still have the TWRP backup, however I want to remove it from my phone as it's eating up almost a GB of precious space.
I've seen some assorted stuff on how to pull .img files from the phone, but I' m not sure which ones will work with mine. Any help would be appreciated!

You could use: adb pull /sdcard/TWRP c:/MotoG_Backup/TWRP
Now you can delete that folder from phone.
Then if you want to restore TWRP Backup: adb push c:/MotoG_Backup/TWRP /sdcard/TWRP/
Alternatively:
ADB Dumping Methods: *ROOT REQUIRED*
You need to grant the SuperSU permission popup that will appear on your phone.
System:
adb shell su -c "dd if=/dev/block/platform/msm_sdcc.1/by-name/system of=/sdcard/system.img"
adb pull /sdcard/system.img​

lost101 said:
You could use: adb pull /sdcard/TWRP c:/MotoG_Backup/TWRP
Now you can delete that folder from phone.
Then if you want to restore TWRP Backup: adb push c:/MotoG_Backup/TWRP /sdcard/TWRP/
Alternatively:
ADB Dumping Methods: *ROOT REQUIRED*
You need to grant the SuperSU permission popup that will appear on your phone.
System:
adb shell su -c "dd if=/dev/block/platform/msm_sdcc.1/by-name/system of=/sdcard/system.img"
adb pull /sdcard/system.img​
Click to expand...
Click to collapse
Why, thank you sir! I was unaware that you can push files to your device while in the recovery! That is why I wanted a system image file.
Thanks again!

Related

Unerasable files pushed via ADB

Hi,
I recently pushed a folder (Download) to the sdcard of my OnePlus One via ADB in recovery. Now, I can't delete any of the files inside that folder via any (root) browser.
How can I fix that?
Thanks.
If you are unlocked, install Root Explorer, or the like, and check the directory permissions. Mine is set to 777, and I can delete it if I wish. Or you can change the permission of the files inside, and delete those, as you wish.
There are likely adp commands, as well. Perhaps someone will show with that know-how.
I tried that, though it unfortunately doesn't work via root browser.
I'll try it via adb later today.
adb remount (to gain rw-access to root partition)
adb shell rm -f <path to file> (to delete the apk)

[GUIDE] Asus fonepad 7 k012 - extSDCard write fix & hosts tweak - NO rooting

I wanna post this guide cuz i searched around and couldnt find any method for kitkat and lollipop, get full sd card write WITHOUT permanent ROOTING.
Some may say: just root, make changes with root file manager, and unroot from superSU. BUT, for this device, from what i experienced, the option for full uninstall/complete unroot, in superSU app, will just hang and do nothing .
I use IntelAndroid-FBRL 05-16-2015 Public Trail Release, made by @social-design-concepts - a really big thanks :good:.
http://forum.xda-developers.com/showpost.php?p=60770086&postcount=352
The tweaks may work on other intel based devices, when temporary CWM recovery is triggered.
Reboot tablet in fastboot/droidboot mode - vol+ and power until asus logo apears.
Install intel android drivers - there are over 8mb limit of .7z files, so i cant add them here, just search intelandroiddrvsetup1.1.5.zip.
Connect tablet to pc with usb cable.
Unzip IntelAndroid-FBRL-05-16-2015-PTR.7z from @social-design-concepts and enter launcher.bat
type ACCEPT after reading the warning
Now:
- chose T2 if u are using Kitkat
- chose T4 if u are using Lollipop
Tablet reboots and after some screen artefacts (is normal) you are in temporary CWM recovery, which has a temporary root adb shell.
Keep tablet connected to pc.
Now download ADBfolder.7z, decompress it, and open inside a command prompt/window.
In this window insert commands, each followed by enter:
adb devices
adb shell id
adb shell mount /system
adb shell mv /system/etc/hosts /system/etc/hosts.bak
adb push hosts /system/etc/hosts
adb shell chmod 0644 /system/etc/hosts
adb shell mv /system/etc/permissions/platform.xml /system/etc/permissions/platform.xml.bak
adb push platform.xml /system/etc/permissions/platform.xml
adb shell chmod 0644 /system/etc/permissions/platform.xml
adb shell reboot
The tweaks remain even after factory reset.
For removing the tweaks, in case of installing oficial updates through OTA or manual, trigger again temporary CWM recovery, enter ADB folder, open command window and use these commands, each followed by enter:
adb devices
adb shell id
adb shell mount /system
adb shell rm /system/etc/hosts
adb shell mv /system/etc/hosts.bak /system/etc/hosts
adb shell rm /system/etc/permissions/platform.xml
adb shell mv /system/etc/permissions/platform.xml.bak /system/etc/permissions/platform.xml
adb shell reboot
It can be done, for lazy ones , with pasting these commands in two .bat files (one for install, other for remove), but I wanted ppl to see what is actually happening.
You can use another hosts file, but keep in mind the /system has limited space, so large ones may not fit.
b0by said:
I wanna post this guide cuz i searched around and couldnt find any method for kitkat and lollipop, get full sd card write WITHOUT permanent ROOTING.
Some may say: just root, make changes with root file manager, and unroot from superSU. BUT, for this device, from what i experienced, the option for full uninstall/complete unroot, in superSU app, will just hang and do nothing .
I use IntelAndroid-FBRL 05-16-2015 Public Trail Release, made by @social-design-concepts - a really big thanks :good:.
http://forum.xda-developers.com/showpost.php?p=60770086&postcount=352
The tweaks may work on other intel based devices, when temporary CWM recovery is triggered.
Reboot tablet in fastboot/droidboot mode - vol+ and power until asus logo apears.
Install intel android drivers - there are over 8mb limit of .7z files, so i cant add them here, just search intelandroiddrvsetup1.1.5.zip.
Connect tablet to pc with usb cable.
Unzip IntelAndroid-FBRL-05-16-2015-PTR.7z from @social-design-concepts and enter launcher.bat
type ACCEPT after reading the warning
Now:
- chose T2 if u are using Kitkat
- chose T4 if u are using Lollipop
Tablet reboots and after some screen artefacts (is normal) you are in temporary CWM recovery, which has a temporary root adb shell.
Keep tablet connected to pc.
Now download ADBfolder.7z, decompress it, and open inside a command prompt/window.
In this window insert commands, each followed by enter:
adb devices
adb shell id
adb shell mount /system
adb shell mv /system/etc/hosts /system/etc/hosts.bak
adb push hosts /system/etc/hosts
adb shell chmod 0644 /system/etc/hosts
adb shell mv /system/etc/permissions/platform.xml /system/etc/permissions/platform.xml.bak
adb push platform.xml /system/etc/permissions/platform.xml
adb shell chmod 0644 /system/etc/permissions/platform.xml
adb shell reboot
The tweaks remain even after factory reset.
For removing the tweaks, in case of installing oficial updates through OTA or manual, trigger again temporary CWM recovery, enter ADB folder, open command window and use these commands, each followed by enter:
adb devices
adb shell id
adb shell mount /system
adb shell rm /system/etc/hosts
adb shell mv /system/etc/hosts.bak /system/etc/hosts
adb shell rm /system/etc/permissions/platform.xml
adb shell mv /system/etc/permissions/platform.xml.bak /system/etc/permissions/platform.xml
adb shell reboot
It can be done, for lazy ones , with pasting these commands in two .bat files (one for install, other for remove), but I wanted ppl to see what is actually happening.
You can use another hosts file, but keep in mind the /system has limited space, so large ones may not fit.
Click to expand...
Click to collapse
where can i get this ADBfolder.7z?

[Completed] [Q] Trouble with getting back on stock with Stock Nandroid Backups

I ran into bit of a problem with my HTC One m7 and I have to return to a stock ROM. There are a couple issues with this as there are no RUU files for a Bell Mobility (Canada) phone but there is a stock nandroid backup http://forum.xda-developers.com/showthread.php?t=2428276
So I downloaded the nandroid backup and attempted to restore it through CWM. Problem is I cannot seem to locate the unzipped folder in CWM restore when running the recovery on my phone. I have a mac so adb commands are slightly different and I am unsure to how to properly push the folder into the CWM backups. I also tried in Android File Transfer but the backups folders are hidden. Could anyone possibly direct me on how to properly attempt to do so? It would be much appreciated.
Thanks
RobotRob said:
I ran into bit of a problem with my HTC One m7 and I have to return to a stock ROM. There are a couple issues with this as there are no RUU files for a Bell Mobility (Canada) phone but there is a stock nandroid backup http://forum.xda-developers.com/showthread.php?t=2428276
So I downloaded the nandroid backup and attempted to restore it through CWM. Problem is I cannot seem to locate the unzipped folder in CWM restore when running the recovery on my phone. I have a mac so adb commands are slightly different and I am unsure to how to properly push the folder into the CWM backups. I also tried in Android File Transfer but the backups folders are hidden. Could anyone possibly direct me on how to properly attempt to do so? It would be much appreciated.
Thanks
Click to expand...
Click to collapse
Hello, and welcome to XDA!
Too bad the M7 doesn't come with a card slot. If it did, you could have made a "last known bad" backup with CWM to make CWM create the appropriate backup folders on the MicroSD and then dump the right backup into that folder. Ah well.
I would adb push the backup files, one by one to internal storage (something like /sdcard, can "adb shell" to poke around for the right path), and then "adb shell" in to copy/move the files to the right CWM backup folder (I used TWRP for so long, I forget the full path).
But then again, i looked for the guide you may have followed:
> HTC One (M7) > One (M7) Q&A, Help & Troubleshooting > [GUIDE] Return to stock for Canadian HTC One Users
You need to have TWRP, not CWM, to read this nandroid.
Follow the steps in the first post, and you should be good to go (any questions can go in that thread as well). Hope this helps.
joel.maxuel said:
Hello, and welcome to XDA!
Too bad the M7 doesn't come with a card slot. If it did, you could have made a "last known bad" backup with CWM to make CWM create the appropriate backup folders on the MicroSD and then dump the right backup into that folder. Ah well.
I would adb push the backup files, one by one to internal storage (something like /sdcard, can "adb shell" to poke around for the right path), and then "adb shell" in to copy/move the files to the right CWM backup folder (I used TWRP for so long, I forget the full path).
But then again, i looked for the guide you may have followed:
> HTC One (M7) > One (M7) Q&A, Help & Troubleshooting > [GUIDE] Return to stock for Canadian HTC One Users
You need to have TWRP, not CWM, to read this nandroid.
Follow the steps in the first post, and you should be good to go (any questions can go in that thread as well). Hope this helps.
Click to expand...
Click to collapse
Hey man thanks for replying. So I flashed the TWRP (which I actually had previously) and now I am just having trouble locating the actual backup folder, it seems to be no existent. I did step 4 so the Backup folder should be created then right? Now im on step 6 but I cant find the folders. Maybe im missing soemthing..
RobotRob said:
Hey man thanks for replying. So I flashed the TWRP (which I actually had previously) and now I am just having trouble locating the actual backup folder, it seems to be no existent. I did step 4 so the Backup folder should be created then right? Now im on step 6 but I cant find the folders. Maybe im missing soemthing..
Click to expand...
Click to collapse
If you are on a custom ROM, your /sdcard/ folder may be called something else. Trace your steps by doing this from a console on your PC (with the cable connected between, and ADB debugging enabled):
Code:
adb shell
cd /sdcard
ls
cd TWRP
ls
cd BACKUPS
ls
cd <OUTPUT FOLDER of LAST COMMAND>
ls
cd <OUTPUT FOLDER of LAST COMMAND>
ls
You may get stuck on line two, maybe along the lines of "No such file or directory". If so, replace step two with:
Code:
cd /storage
ls
cd <OUTPUT FOLDER of LAST COMMAND - should start with sdcard>
All this will give you the path in which to push the files to.
Also, don't be afraid to use the experts found in that guide by posting there. I don't have an M7 so I am basing my thoughts off different devices.
Hope this helps.
joel.maxuel said:
If you are on a custom ROM, your /sdcard/ folder may be called something else. Trace your steps by doing this from a console on your PC (with the cable connected between, and ADB debugging enabled):
Code:
adb shell
cd /sdcard
ls
cd TWRP
ls
cd BACKUPS
ls
cd <OUTPUT FOLDER of LAST COMMAND>
ls
cd <OUTPUT FOLDER of LAST COMMAND>
ls
You may get stuck on line two, maybe along the lines of "No such file or directory". If so, replace step two with:
Code:
cd /storage
ls
cd <OUTPUT FOLDER of LAST COMMAND - should start with sdcard>
All this will give you the path in which to push the files to.
Also, don't be afraid to use the experts found in that guide by posting there. I don't have an M7 so I am basing my thoughts off different devices.
Hope this helps.
Click to expand...
Click to collapse
Hey man, thanks for your help. I was able to find the correct path by doing a backup, just of boot.img in recovery and that shows where the file is stored /data/media/0/TWRP/BACKUPS/serial number/backup#.
So now I am trying to access the path through adb shell (so I can push the stock files) but I am geting "Permission denied".
Do I need S-Off to go about doing this??
RobotRob said:
Hey man, thanks for your help. I was able to find the correct path by doing a backup, just of boot.img in recovery and that shows where the file is stored /data/media/0/TWRP/BACKUPS/serial number/backup#.
So now I am trying to access the path through adb shell (so I can push the stock files) but I am geting "Permission denied".
Do I need S-Off to go about doing this??
Click to expand...
Click to collapse
Just need to enter "su" (without the quotes, for super user) after entering shell, before copying the files. Hope this helps.
joel.maxuel said:
Just need to enter "su" (without the quotes, for super user) after entering shell, before copying the files. Hope this helps.
Click to expand...
Click to collapse
I entered shell. Then entered su , but it still says Permission denied..?
joel.maxuel said:
Just need to enter "su" (without the quotes, for super user) after entering shell, before copying the files. Hope this helps.
Click to expand...
Click to collapse
Sorry I... I uninstlaled supersu app by accident so that makes sense... Re-installed it and will try to push files.
joel.maxuel said:
Just need to enter "su" (without the quotes, for super user) after entering shell, before copying the files. Hope this helps.
Click to expand...
Click to collapse
I can reach the path no problem now in su with adb shell /data/media/0/TWRP/BACKUPS/serial#/backupfolder/
but what is the proper command to copy the unzipped nandroid backup files to the phone?
RobotRob said:
I can reach the path no problem now in su with adb shell /data/media/0/TWRP/BACKUPS/serial#/backupfolder/
but what is the proper command to copy the unzipped nandroid backup files to the phone?
Click to expand...
Click to collapse
Hi,
That would be (while outside of the unzipped folder):
Code:
adb push <name of unzipped folder> /data/media/0/TWRP/BACKUPS/<serial#>/
e.g: (example partially modified for my smartwatch)
Code:
adb push 2015-11-09-LCA43 /data/media/0/TWRP/BACKUPS/04a0e5ac02a27e76/
Then when you are in TWRP, look for the name of the unzipped folder.
EDIT: BTW, you may have permission errors this way like you did before in the exploring phase. So you may need to:
Code:
adb push <name of unzipped folder> /data/media/0/
adb shell
su
mv <name of unzipped folder> /data/media/0/TWRP/BACKUPS/<serial#>/
joel.maxuel said:
Hi,
That would be (while outside of the unzipped folder):
Code:
adb push <name of unzipped folder> /data/media/0/TWRP/BACKUPS/<serial#>/
e.g: (example partially modified for my smartwatch)
Code:
adb push 2015-11-09-LCA43 /data/media/0/TWRP/BACKUPS/04a0e5ac02a27e76/
Then when you are in TWRP, look for the name of the unzipped folder.
EDIT: BTW, you may have permission errors this way like you did before in the exploring phase. So you may need to:
Code:
adb push <name of unzipped folder> /data/media/0/
adb shell
su
mv <name of unzipped folder> /data/media/0/TWRP/BACKUPS/<serial#>/
Click to expand...
Click to collapse
I still get permission errors when trying to push it to /data/media/0/
Ill try doing it to /sdcard/ , then adb shell , su , mv <name of unzipped folder>/data/media/0/TWRP/BACKUPS/<serial#>/
joel.maxuel said:
Hi,
That would be (while outside of the unzipped folder):
Code:
adb push <name of unzipped folder> /data/media/0/TWRP/BACKUPS/<serial#>/
e.g: (example partially modified for my smartwatch)
Code:
adb push 2015-11-09-LCA43 /data/media/0/TWRP/BACKUPS/04a0e5ac02a27e76/
Then when you are in TWRP, look for the name of the unzipped folder.
EDIT: BTW, you may have permission errors this way like you did before in the exploring phase. So you may need to:
Code:
adb push <name of unzipped folder> /data/media/0/
adb shell
su
mv <name of unzipped folder> /data/media/0/TWRP/BACKUPS/<serial#>/
Click to expand...
Click to collapse
Thanks so mucb man! I had to adb push to /sdcard/, for some reason pushing to /data/media/0/ was still giving me permission denied. Once pushed, I did the following to move it to the correct path;
adb shell
su
mv 'nandroid backup unzipped folder' /data/media/0/TWRP/BACKUPS/serial#/
Then ran recovery and restored the stock backup.
Worked.
One big problem... I had to restore because my IMEI was gone when I flashed custom ROM. So after all of this, my IMEI is still unkown and lost. I do know what my IMEI nukber is though because I wrote it down. Is there anway I can get it back??
RobotRob said:
Thanks so mucb man! I had to adb push to /sdcard/, for some reason pushing to /data/media/0/ was still giving me permission denied. Once pushed, I did the following to move it to the correct path;
adb shell
su
mv 'nandroid backup unzipped folder' /data/media/0/TWRP/BACKUPS/serial#/
Then ran recovery and restored the stock backup.
Worked.
One big problem... I had to restore because my IMEI was gone when I flashed custom ROM. So after all of this, my IMEI is still unkown and lost. I do know what my IMEI nukber is though because I wrote it down. Is there anway I can get it back??
Click to expand...
Click to collapse
So your EFS partition got borked. That's not good.
Unfortunately, even with the IMEI number known on paper, there is very little you can do to get that repaired. I will suggest this thread:
> HTC One (M7) > One (M7) Q&A, Help & Troubleshooting > [Q] No IMEI or Baseband
Read it head-to-toe before adding a post, so you have an idea as to which are the right questions to ask. EFS is unique to the device, and once it's gone, (in almost all cases) it can only be rebuilt through a warranty service unfortunately. Which is why I do full block backups before I really mess around with a device. But, hindsight is 20/20.
Sadly there is nothing else I can suggest. Glad you made it this far though.
Best of luck!
joel.maxuel said:
So your EFS partition got borked. That's not good.
Unfortunately, even with the IMEI number known on paper, there is very little you can do to get that repaired. I will suggest this thread:
> HTC One (M7) > One (M7) Q&A, Help & Troubleshooting > [Q] No IMEI or Baseband
Read it head-to-toe before adding a post, so you have an idea as to which are the right questions to ask. EFS is unique to the device, and once it's gone, (in almost all cases) it can only be rebuilt through a warranty service unfortunately. Which is why I do full block backups before I really mess around with a device. But, hindsight is 20/20.
Sadly there is nothing else I can suggest. Glad you made it this far though.
Best of luck!
Click to expand...
Click to collapse
Ok thanks for all your help. I had only wanted to get it back to stock so I could unlock the phone from the carrier and put a new im card in it.

How do I adb pull root directories (like "/system"?) to my Windows PC??

Hi there, I'm trying to pull root directories like /system and /data without any luck. My purpose it to have them on my PC as a backup, and be able to browse them to pull out apps and pieces of data as necessary if it ever becomes necessary.
Device: Nexus 6P (North American version)
ROM: Stock 6.0.1 Rooted, using Wugfresh Nexus Root Toolkit and SuperSU
PC OS: Windows 7 PC (64 bit)
Adb is working properly and I can easily pull non-root directories like "/sdcard" and so on. I'd like to be able to backup the entire root directory ("/") or at least the child directories (like "/system" and "/data", etc.) Unfortunately, when I try
Code:
adb pull -p "/system" "C:\somewhere"
it skips a bunch of files, so I need to come up with a better method.
I've tried
Code:
adb root
and it tells me it's already running in root mode.
I try
Code:
adb remount
and it does this properly, but doesn't change the effects of all the commands I've tried.
When I run
Code:
adb shell
it enters shell and gives me # by default, so seemingly it is giving me su permission by default?
*** Oddly, when I enter "su" while in shell, it tells me "/sbin/sh: su: not found" which seems odd to me. I think it's possibly that SuperSU is installed as systemless root, or there's something else screwy here, so I guess I'm not sure how to proceed. Still, if that were case, why would adb already be running as root, and why would shell automatically give me the #?
Any help is appreciated!!
Thanks!

How to access data folder from non-rooted device?

A few weeks ago one of my important apps started crashing on open.
Since I have important informaiton saved on that app I need to obtain it.
Is there a way to access that package folder (and that app is not debuggable) with adb or shell?
When I try to access via adb and shell the result it Permission denied.
I can't root the phone, so this is out of the quesiton.
I'm using Google Pixel 1 with Android 10 Build - Build/QP1A.191005.007.A3)
There isn't any way to access /data/data/ as a normal user or shell user, the only user able to access that is root, at least according to the permissions.
You could try to backup using "adb backup package", then you could apply this backup back on another phone or on this same app after reinstalling it.
bystroy said:
A few weeks ago one of my important apps started crashing on open.
Since I have important informaiton saved on that app I need to obtain it.
Is there a way to access that package folder (and that app is not debuggable) with adb or shell?
When I try to access via adb and shell the result it Permission denied.
I can't root the phone, so this is out of the quesiton.
I'm using Google Pixel 1 with Android 10 Build - Build/QP1A.191005.007.A3)
Click to expand...
Click to collapse
Temporarily root phone's Android, means add su cmdlet what is suitable, and then mount the partition in question as RW by means of ADB applying su.
Example:
Code:
adb devices
adb push <SU-BINARY> / data/local/tmp/
adb shell "chmod +x /data/local/tmp/su"
adb shell "/data/local/tmp/su -c 'mount -t auto -o rw,remount <PARTITION-IN-QUESTION>'"
adb pull "<DIRECTORY-TO-PULL>" <LOCATION-ON-PC>

Categories

Resources