[Pretty Simple Question] Gdisk -l /dev/sdb# not showing a table - AT&T LG G2

In Ubuntu, using the command gdisk -l /dev/sdb(39, in my case) doesn't fill up the table of numbers. Any help?
IF you don't know what I'm talking about, refer to this post: http://forum.xda-developers.com/showthread.php?t=2582142

zub74 said:
In Ubuntu, using the command gdisk -l /dev/sdb(39, in my case) doesn't fill up the table of numbers. Any help?
IF you don't know what I'm talking about, refer to this post: http://forum.xda-developers.com/showthread.php?t=2582142
Click to expand...
Click to collapse
Disregard this post.

Related

Man Pages

If anybody is interested I split the busybox man page up into lots of different text files and wrote a small script to call less on them when the 'man' command is invoked (because I missed having man pages in the terminal)
[UPDATE] Added install script because updating ROMS removes files and I don't want to types this crap everytime I update my ROM.
Using Install script:
Extract man_pages.zip and place folder on sdcard
$ sh /sdcard/man_pages/man_install (as root of course)
Using ADB to install:
Extract man_pages.zip onto Desktop
$ adb remount
$ adb push Desktop/man_pages/man.txt to /system/bin
$ adb push Desktop/man_pages/man /system/usr/share/man
$ adb shell
# mv /system/bin/man.txt /system/bin/man
# chmod 755 /system/bin/man
# exit
Using your phone to install:
Put Extracted man_pages.zip folder in /sdcard
$ mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
$ cp /sdcard/man_pages/man.txt /system/bin/man
$ chmod 755 /system/bin/man
$ cp -r /sdcard/man_pages/man /system/usr/share/
$ mount -o remount,ro -t yaffs2 /dev/block/mtdblock3 /system
Usage:
$ man [program]
If no program name is given, all possible options are listed (highly
recommended that you pipe it through more).
$ man | more # enter for next line, space for next page.
When viewing a man page use the following to navigate:
back one page: 'b'
back half page : 'u'
backward one line: 'return', 'e' or 'j'
forward one page: 'space' or 'f'
forward half page:: 'd'
forward one line: 'k' or 'y'
quit: 'q'
Updated files [6-22-09]
-renamed ckear.man to clear.man (just in case anybody forgot how to
invoke 'clear')
-updated man script to show possible pages when invoked with no
argument.
-combined files to one zip file which includes an installer script)
Known Issues:
-Formatting is corrupted when using through adb shell on Windows machine (affects the entire instance of cmd.exe).
thx a ton for this...
i, for one, really appreciate it!
bump for night crew.
also, I added this to the informative threads list
A few other noob tips
This is awesome! Thanks so much!
A few helpful tips:
--If you get the "cannot copy: Read-only file system" error when you're trying to push the files in adb, enter:
adb remount
--From within a man page, hit spacebar to scroll forward, b to scroll back, and q to quit.
Thanks ohnoezmafone for the tips. Didn't even think of noobs wanting man pages, but I guess they need them more than anybody. I added them to the post as well as a few more and cleaned it up for people that need steps to follow. I also included an install script and changed the man script to output all possible pages when invoked with no argument.
Very helpful, thank you.
what are man pages?
temporizer said:
what are man pages?
Click to expand...
Click to collapse
man is short for manual
describes usage information for executables, config files, etc
so, if you wanted usage information for the "ping" command, type
man ping
http://en.wikipedia.org/wiki/Man_page
cool
I'm gonna try it. If it works as well as in linux I'm gonna cook it in my future releases.
Thanks. When I think the forums full of takers, I come across a giver.
I'm getting some really messed up formatting. I installed via the ADB method.
Code:
C:\>adb shell
# man ls
man ls
←[0;0H←[Kls
←[Kls [-1AacCdeFilnpLRrSsTtuvwxX" USE_FEATURE_HUMAN_READABLE ("h") "kK] [filenames
←[K...]
←[KList directory contents
←[KOptions:
←[K -1 list files in a single column
←[K -A do not list implied . and ..
←[K -a do not hide entries starting with .
←[K -C list entries by columns
←[K -c with -l: show ctime
←[K --color[={always,never,auto}] to control coloring
←[K -d list directory entries instead of contents
←[K -e list both full date and full time
←[K -F append indicator (one of */[email protected]|) to entries
←[K -i list the i-node for each file
←[K -l use a long listing format
←[K -n list numeric UIDs and GIDs instead of names
←[K -p append indicator (one of /[email protected]|) to entries
←[K -L list entries pointed to by symbolic links
←[K -R list subdirectories recursively
←[K -r sort the listing in reverse order
←[K -S sort the listing by file size
←[K -s list the size of each file, in blocks
←[24;0H←[K←[7m/system/usr/share/man/ls.man←[0m
From that point on, my prompt is messed up and I have to control-c to get back to a C: prompt.
What did I do wrong?
UPDATE: If I change "less" to "more" it seems to work better...
What did I do wrong?
UPDATE: If I change "less" to "more" it seems to work better...
Click to expand...
Click to collapse
You did nothing wrong, just tried it myself. Its a bug. Works fine using adb from linux(gentoo) or from command prompt on phone itself. But apparently "less" screws up cmd.exe when using adb from windows(xp). I'd say leave it as "more" if your gonna use it through adb shell on a windows box.
Honestly when I did this I never even thought about using it through adb shell. I would switch it to "more" myself but "less" is traditional and besides "more" is less and "less" is more.
I'm gonna try it. If it works as well as in linux I'm gonna cook it in my future releases.
Thanks. When I think the forums full of takers, I come across a giver.
Click to expand...
Click to collapse
I'm Not really a giver...I've taken soooo much knowledge and fun stuff from this forum I figured I would share something I did for myself with you people as a way of saying thanks...I owe it.
dumfuq said:
You did nothing wrong, just tried it myself. Its a bug. Works fine using adb from linux(gentoo) or from command prompt on phone itself. But apparently "less" screws up cmd.exe when using adb from windows(xp). I'd say leave it as "more" if your gonna use it through adb shell on a windows box.
Honestly when I did this I never even thought about using it through adb shell. I would switch it to "more" myself but "less" is traditional and besides "more" is less and "less" is more.
I'm Not really a giver...I've taken soooo much knowledge and fun stuff from this forum I figured I would share something I did for myself with you people as a way of saying thanks...I owe it.
Click to expand...
Click to collapse
i love ur membership name dumfuq... lmao cheers thx for the manuals. i could def use this to learn a thing or 2... and as for being a taker or giver, i'm def the taker =/ (no homo) i wish i was smart enough to learn more but i am trying and hopefully one day i can cook something up, but as for now all i can do to pay the community back is take care of the n00best of the n00bs with their questions to keep the forums from being soo err.. well u kno... lol
Hi
Thank you very much!:good::laugh:
I ressucitetate the thread...
THAT'S AWESOME.
Thanks.

[GUIDE] How to make a nandroid backup directly to your computer without using sdcard

INFORMATION
This guide is intended to make a full backup of your android phone (the entire memory block with all partitions) or a single partition (including sdcards, etc) directly to your computer, in either
Block level (with dd): for single partitions or whole memory block (all partitions in one piece). The backup always has the same size which is the size of the partition.
File level (with tar): only for individual partitions. This only includes files and folders, so occupies much less space, depending on how much filled is the partition.
It can be done with the phone powered on or from ClockWorkMod Recovery (from both ADB works, while in Fastboot doesn't so won't apply). Unless specified the commands meant to be used from Windows. For Linux and Unix is similar.
REQUIREMENTS
Rooted Android Phone
Busybox installed on your phone
If you are using Linux / OS X you have native tools, for Windows download Cygwin, and install with it netcat, pv and util-linux. Get them from Cygwin's setup.exe
ADB installed.
Make sure adb.exe is in your windows' path. See here and here, or use Path Manager.
Android phone with USB Debugging enabled, and the proper drivers installed on Windows so the phone is recognized. Typing 'adb devices' on a terminal should show your device.
PARTITION IDENTIFICATION
You now have to identify the partition or block device that you want to backup. For a single partition you can use either tar or dd, while for the entire memory block you can only use dd.
For example, on Galaxy Nexus you have the list of partitions here and for Galaxy S2 here.
Usually on android, the entire block containing all partitions is located at /dev/block/mmcblk0 and the data partitions is a subpartition of it. You can push parted with GPT support to your device and see all information on a partition or block.
Whole phone memory -> /dev/block/mmcblk0 (may vary, in some phones this is the sdcard)
Subpartitions -> depends on each device. Usually at /dev/block/platform/dw_mmc/by-name/ there are listed by name linking to the real device.
Back up of the whole memory block (via adb)
Connect the phone in ADB mode and unlock the screen.
Open one Cygwin Terminal and enter (replace mmcblk0 if needed):
Code:
adb forward tcp:5555 tcp:5555
adb shell
su
/system/xbin/busybox nc -l -p 5555 -e /system/xbin/busybox dd if=/dev/block/mmcblk0
You will see the cursor blinking at the left. Now the phone is waiting to send the block over the network.
Open another Cygwin terminal and type:
Code:
adb forward tcp:5555 tcp:5555
cd /path/to/store/the/backup
nc 127.0.0.1 5555 | pv -i 0.5 > mmcblk0.raw
You will see how the image size is growing until it finishes. Now you have the whole phone backed up in raw format. You can see the contents of the GPT partition with gptfdisk tool, available for windows, linux and such. See official website and sourceforge to get it. You can do it the same from ClockWorkMod Recovery but you have to mount first the /system partition since the busybox included with clockworkmod does not come with netcat and you have to use the one from the system partition.
With further linux tools you could edit or extract single partitions from the whole block.
You can use adb via wifi as well with applications like WiFi ADB.
Back up of the whole memory block (via wifi)
Original post: [Q] Nandroid directly to computer w/o sdcard
We need to install a FTP server on the computer or the other device, configure a user with a password if we want to, and set some port. It uses by default 21 but this example uses 40. We must set a home dir for the user with write permissions.
Usually is a good idea to put myfifo in /cache not in /data because we may overwrite sensitive data in case we want to use that raw image for data recovery.
Open one Cygwin terminal
Code:
adb shell
su
mkfifo /cache/myfifo
ftpput -v -u user -p pass -P 40 COMPUTER_IP block.raw /cache/myfifo
Open another Cygwin terminal
Code:
adb shell
su
dd if=/dev/block/mmcblk0p12 of=/cache/myfifo
Tips:
- Fifos only can be made on linux native filesystems, for example on a FAT partition is not possible.
- Reading from a partition does not modify it.
Now check on Filezilla Server the speed
Back up of the whole memory block (USB tethering, Wifi tethering)
To use tethering you have to disconnect the computer from all networks and connect it only to the phone with the type of connection you want.
Once you connect it, you can view the IP of the computer and the IP of the phone from connection properties. The ip is the computer ip and the gateway is the phone's ip.
Wifi Tethering: Computer <---Wifi---> Phone <---3G---> Internet
USB Tethering:
Computer <---USB---> Phone <---Wifi---> Internet
Conputer <---USB---> Phone <---3G---> Internet
This is exactly the same as via wifi, except that the transfer speed is much higher because the computer and the phone are directly connected, instead of using a router as a gateway. In this case, the gateway is the phone. USB tethering has the highest transfer rate.
Back up of a single partition (raw = every bit of the partition)
It is exactly the same as the the previous but replacing mmcblk0 by the corresponding partition. You can use in this particular case several software to read the partition from windows, depending on partition filesystem: DiskInternals Linux Reader, Ext2Read, Ext2 File System Driver for Windows, Ext4Explore, plugin for Total Commander and ImDisk Virtual Disk Driver. You can also use recovery software on individual partitions like Recuva in combination with VHD Tool or command line tools included with operating systems.
Back up of a single partition (tar = only files and folders)
In this case, you need the partition mounted. To see the list of mounted partitions type on Cygwin Terminal
Code:
adb shell mount
Now you need to know where is mounted the partition you want to backup, for example the firmware is mounted on /system, which is the ROM.
In this case you will have to open three terminals, because of android limitations:
Open one Cygwin terminal and create a fifo, in /cache, for example, and redirect the tar there
Code:
adb forward tcp:5555 tcp:5555
adb shell
su
/system/xbin/busybox mkfifo /cache/myfifo
/system/xbin/busybox tar -cvf /cache/myfifo /system
We have to do it this way because redirecting the tar to stdout (with - ) is broken on android and will corrupt the tar file.
Open a second Cygwin terminal and type:
Code:
adb forward tcp:5555 tcp:5555
adb shell
su
/system/xbin/busybox nc -l -p 5555 -e /system/xbin/busybox cat /cache/myfifo
Open a third Cygwin terminal and type:
Code:
adb forward tcp:5555 tcp:5555
cd /path/to/store/the/backup
nc 127.0.0.1 5555 | pv -i 0.5 > system.tar
You can browse the tar file with Winrar, Total Commander, PeaZip and almost any compression tool. Note that you shouldn't extract files or edit it since the tar format saves the permission and owner data for each file, that is lost when extracted to FAT / NTFS partitions and you will mess things when restoring.
LINKS
[GUIDE] Internal Memory Data Recovery - Yes We Can!
How to Create and Attach a Virtual Hard Disk in Windows 7
[Guide] Types of Android backups
mohsyn said:
On newer android versions (Im on 7.2) data folder has a folder media which is link to sdcard and one ends up backing up entire sd card. I had a 64gb backup which wasn't necessary
In order to avoid skipping the media folder i had to do some trial and error because busybox tar command is not completely the same as GNU tar.
Would appreciate if you can mention it in the mail guide to use the following command to backup /data folder without copying sdcard files
In first terminal
tar cv --exclude data/media/0 -f /cache/myfifo /data
in 3rd terminal
nc 127.0.0.1 5555 | pv -i 0.5 > data.tar
no change in second terminal
Cheers
Click to expand...
Click to collapse
Umm...how to restore back from computer?
Sent from MARVEL
I am a little new to this, I have installed Android sdk and i am able to see my device by using "adb devices" , i have also installed Cygwin, now i want to backup whole phone memory block so i tried executing the first line on cygin "adb forward tcp:5555 tcp:5555" i get an error saying -bash: adb :command not found.
I am sorry if i am missing any thing, please guide me, and also what do you mean by "download Cygwin, and install with it netcat, pv and util-linux"
Thanx a ton !!
aunriz said:
I am a little new to this, I have installed Android sdk and i am able to see my device by using "adb devices" , i have also installed Cygwin, now i want to backup whole phone memory block so i tried executing the first line on cygin "adb forward tcp:5555 tcp:5555" i get an error saying -bash: adb :command not found.
I am sorry if i am missing any thing, please guide me, and also what do you mean by "download Cygwin, and install with it netcat, pv and util-linux"
Thanx a ton !!
Click to expand...
Click to collapse
You've done almost everything! But you skipped the section "make sure adb is in your path"
Probably you have adb.exe in the path
Code:
C:\Program Files (x86)\android-sdk\platform-tools\adb.exe
So you have to just add it to the Cygwin's path (would be better if you had added it earlier to the windows' path and cygwin will import it automatically but it is ok)
Code:
export PATH="/cygdrive/c/Program Files (x86)/android-sdk/platform-tools":$PATH
Remember to backup the path previously if you want.
Code:
echo $PATH > mypathbackup.txt
scandiun said:
You've done almost everything! But you skipped the section "make sure adb is in your path"
Probably you have adb.exe in the path
Code:
C:\Program Files (x86)\android-sdk\platform-tools\adb.exe
So you have to just add it to the Cygwin's path (would be better if you had added it earlier to the windows' path and cygwin will import it automatically but it is ok)
Code:
export PATH="/cygdrive/c/Program Files (x86)/android-sdk/platform-tools":$PATH
Remember to backup the path previously if you want.
Code:
echo $PATH > mypathbackup.txt
Click to expand...
Click to collapse
Thanks for replying but i cant seem to run the 3rd line , see this
[email protected] ~
$ adb forward tcp:5555 tcp:5555
[email protected] ~
$ adb shell
$ /system/xbin/busybox nc -l -p 5555 -e /system/xbin/busybox dd if=/dev/block/mmcblk0
reloc_library[1311]: 10182 cannot locate 'android_reboot'...
CANNOT LINK EXECUTABLE
i hav sucessfully installed busybox v1.14.3, i am not sure what is causing the problem
EDIT:
i found that my directory ws system/bin instead of xbin
so i changed it and first part worked correctly, now i cant seem to get the second part
[email protected] ~
$ adb forward tcp:5555 tcp:5555
[email protected] ~
$ cd c:/
[email protected] /cygdrive/c
$ nc 127.0.0.1 5555 | pv -i 0.5 > mmcblk0.raw
-bash: nc: command not found
-bash: pv: command not found
aunriz said:
[email protected] /cygdrive/c
$ nc 127.0.0.1 5555 | pv -i 0.5 > mmcblk0.raw
-bash: nc: command not found
-bash: pv: command not found
Click to expand...
Click to collapse
You don't have installed pv and netcat on cygwin. Run the setup.exe and install them.
If you run
Code:
whereis pv
whereis nc
should give you some path (in cygwin) but applies similar inside android.
scandiun said:
You don't have installed pv and netcat on cygwin. Run the setup.exe and install them.
If you run
Code:
whereis pv
whereis nc
should give you some path (in cygwin) but applies similar inside android.
Click to expand...
Click to collapse
Now i hav installed cv and nc and commands run sucessfully, but i get the raw file as just 1kb
First terminal:
[email protected] ~
$ adb forward tcp:5555 tcp:5555
adb shell
[email protected] ~
$ adb shell
$ /system/bin/busybox nc -l -p 5555 -e /system/bin/busybox dd if=/dev/block/mmcblk0
/system/bin/busybox nc -l -p 5555 -e /system/bin/busybox dd if=/dev/block/mmcblk0
$
second terminal:
[email protected] ~
$ adb forward tcp:5555 tcp:5555
[email protected] ~
$ cd c:/
[email protected] /cygdrive/c
$ nc 127.0.0.1 5555 | pv -i 0.5 > mmcblk0.raw
55 B 0:00:00 [10.7kiB/s] [<=> ]
[email protected]
No idea what you may be doing wrong
Listen, I appreciate the guide, and it being basically the only one which popped up in google results, I can't gripe too much, but... you really, really need to make it more clear.
The point of a guide is to help a large group of people with varying degrees of knowledge (and if it's a guide targeted at a specific group of people, i.e tech savvy, then it needs to be indicated as such).
With that working definition in place, it follows that you should be as specific as possible; think of *everything*. By doing so, you not only avoid headaches for the people reading the guide, but for yourself as well since you don't have to reply to comments which might've otherwise been avoided.
I would post a question, but I'll probably have figured this out (with a good 1+ hours of searching no doubt) before anyone responds.
Here are some examples of what could be more specific:
"ADB installed." - what is ADB? Where's the link? It's not reasonable to assume people use these tools on a regular basis or remember them.
"You can push parted with GPT support to your device and see all information on a partition or block." - okay, so we know what it does but not how to install it or use it.
"ADB mode" - is this important? What is it? Not sure because it was glossed over.
These are just some examples. It's not the most horrendous trespass ever committed, but definitely annoying. Just spell it out from one step to the next, it works far better than topics with subheadings and unintuitive concepts being assumed as general knowledge on the behalf of noobs like me.
Edit: I'm just going to take everything off my SD card, use nandroid, and then copy the nandroid backup to computer as well. Please improve the guide, thanks.
Greatly appreciate this!
For me, a long-time UNIX and Linux administrator, this little guide was a breath of fresh air. Scandiun, *Thank You* for putting it together. It makes perfect sense to me -- just treat the phone as the linux machine it is. I'm becoming convinced that most of the more recent "developers" hanging around the android community have never used a linux machine before -- they don't seem to know what's going on, they go way out of their way to write overkill tools to do things clumsily that can already be done cleanly and quickly from the command line, and then they wrap those tools in so much mystery, black magic, and script-kiddie terminology that I can't figure out what they do either, and I certainly don't trust them doing things to my phone.
For example, I've got a new Galaxy S3, and just wasted a whole day digging around on xda, reviewing all of the "kewl rooting mods" until I got sick of it. Why the *heck* are people flashing entire partitions just to install a setuid /system/xbin/su on these devices? The rooting method I wound up using was dirt simple -- just find an rc exploit and use it to install an 'su' binary, by typing a few commands via adb. I used a variation of the exploit mentioned in http://seclists.org/fulldisclosure/2012/Aug/171, and elaborated in http://forum.xda-developers.com/showthread.php?t=1790104, http://forum.xda-developers.com/showthread.php?t=1792342, http://galaxys3root.com/galaxy-s3-root/how-to-root-u-s-canadian-dual-core-galaxy-s3-on-mac-osx/, and http://forum.xda-developers.com/showthread.php?t=1827518. If you are a UNIX person, you'll recognize what's going on with that exploit and be able to come up with something that suits your own needs. If you aren't a UNIX person, then you'll be completely lost. Sorta like this guide.
For anyone who doesn't yet know what adb is, or who's never used standard UNIX/Linux tools like dd, netcat, gparted, or busybox, I agree that this guide is not only not going to help you, but may actually aid you in shooting yourself in the foot with extreme efficiency. But please don't criticize or nag the OP in return for helpful advice freely given. You won't learn much about UNIX tools on an Android-related web site in any case. I recommend starting with a Linux systems administration book -- the Nemeth series is always good. But if you do take that route, you need to expect to take time to learn the basics.
Absolutely beautiful!
Thank you for this work. I was able to recover deleted files from my Galaxy Nexus' internal memory using this technique. I made a [GUIDE] using most of what you accomplished here: http://forum.xda-developers.com/showthread.php?p=34185439
Thank you, thank you, thank you! It can't be said enough. I had family photos that I would not have been able to reproduce. Much love to you and yours!
:good: :highfive: :victory:
so did anyone dare to restore the drive (all of storage, everything !)? without bricking the thing ?
mai77 said:
so did anyone dare to restore the drive? w.o bricking the thing ?
Click to expand...
Click to collapse
What drive? A partition?
scandiun said:
If you are using Linux / OS X you have native tools, for Windows download Cygwin, and install with it netcat, pv and util-linux. Get them from Cygwin's setup.exe
Click to expand...
Click to collapse
netcat is obsolete (mark to even find it) install net / nc instead
---------- Post added at 01:03 PM ---------- Previous post was at 01:03 PM ----------
scandiun said:
What drive? A partition?
Click to expand...
Click to collapse
all of storage I mean. the full monty ...
----------------------
parted seems to not work fully with Samsung galaxy Y = SGY proprietary rfs filesystem
on SGY mmcblk0 gives you the sd card, not internal storage with android.
backing up my sd card was a thing I could even do before I read this (lol)
mai77 said:
netcat is obsolete (mark to even find it) install net / nc instead
Click to expand...
Click to collapse
nc is an abbreviation for netcat. On Cygwin, you choose to install either, but for the original, written by the *Hobbit*, that allows direct execution of commands with -e and -t, you have to uncheck "Hide obsolete packages" on Cygwin's setup.exe.
The two of them are here:
Netcat 1.10 (netcat.traditional): http://www.netgull.com/cygwin/release-legacy/netcat/
Netcat 1.107 (netcat.openbsd): http://www.netgull.com/cygwin/release/nc/
mai77 said:
parted seems to not work fully with Samsung galaxy Y = SGY proprietary rfs filesystem
on SGY mmcblk0 gives you the sd card, not internal storage with android.
backing up my sd card was a thing I could even do before I read this (lol)
Click to expand...
Click to collapse
Can you post where is your whole memory block then or even the PIT file for that phone? You have an example here:
[Info] List of Samsung Galaxy S2 GT-I9100 devices and partitions
scandiun said:
Can you post where is your whole memory block then or even the PIT file for that phone? You have an example here:
[Info] List of Samsung Galaxy S2 GT-I9100 devices and partitions
Click to expand...
Click to collapse
I don't know where the "whole memory block" is or what it is. is it internal storage = NAND ?
here is the pit file:
mai77 said:
I don't know where the "whole memory block" is or what it is. is it internal storage = NAND ?
Click to expand...
Click to collapse
Yes it is the NAND. See your pit analysis here:
[INFO] Samsung Galaxy Y GT-S5360 PIT File Analysis
OK
scandiun said:
Yes it is the NAND. See your pit analysis here:
[INFO] Samsung Galaxy Y GT-S5360 PIT File Analysis
Click to expand...
Click to collapse
very interesting tool.
but how do I backup NAND in one piece on SGY ?
mmcblk0 = sd card
???blk0 = NAND
it must be somewhere ...
mai77 said:
but how do I backup NAND in one piece on SGY ?
mmcblk0 = sd card
???blk0 = NAND
it must be somewhere ...
Click to expand...
Click to collapse
Is almost sure that is under /dev/block. Please post the output of
Code:
ls -lR /dev/block

[Q] Partition tables

Could someone please post their partition tables by running "fdisk -l /dev/block/mmcblk0" in ADB?
MysticMgcn said:
Could someone please post their partition tables by running "fdisk -l /dev/block/mmcblk0" in ADB?
Click to expand...
Click to collapse
I get "/system/bin/sh: fdisk: not found" when trying to run the command. Tried running as su as well, it still said fdisk wasn't found.
SteveG12543 said:
I get "/system/bin/sh: fdisk: not found" when trying to run the command. Tried running as su as well, it still said fdisk wasn't found.
Click to expand...
Click to collapse
Hmm, would you mind trying from ADB in recovery?
MysticMgcn said:
Hmm, would you mind trying from ADB in recovery?
Click to expand...
Click to collapse
Sure, I can do that. It'll be a bit before I can get to a computer though.
Btw I'm on the stock recovery, if that matters at all.
Sent from my ADR6425LVW using XDA Premium.
I used adb to reboot the tablet into recovery and I got he fallen android with red triangle with no response to adb queries. I then powered the device off and then used power / vol down to get the mini EFI-like menu, then used Vol Up to pick RCK. Same thing.
Am I missing something?
MysticMgcn said:
Could someone please post their partition tables by running "fdisk -l /dev/block/mmcblk0" in ADB?
Click to expand...
Click to collapse
The Transformer does not use a traditional partition table.
fdisk -l confirms: "Disk /dev/block/mmcblk0 does not contain a valid partition table" (run from a shell session root prompt directly on the device in ConnectBot)
AFAIK, it uses a GPT which is stored at a yet-unknown-to-me location (maybe at the end of the MMC). After booting, the kernel log (dmesg) always says "Primary GPT is invalid, using alternate GPT.". I assume this is by design because I've seen it also on the TF101.
Another thing is that some partitions are hidden from the OS (everything related to bootloader, recovery and kernel). While I could find the recovery and kernel images inside mmcblk0 (offsets 0x380000 and 0xB80000), the bootloader itself seems to be completely inaccessible from the OS.
_that said:
The Transformer does not use a traditional partition table.
fdisk -l confirms: "Disk /dev/block/mmcblk0 does not contain a valid partition table" (run from a shell session root prompt directly on the device in ConnectBot)
AFAIK, it uses a GPT which is stored at a yet-unknown-to-me location (maybe at the end of the MMC). After booting, the kernel log (dmesg) always says "Primary GPT is invalid, using alternate GPT.". I assume this is by design because I've seen it also on the TF101.
Another thing is that some partitions are hidden from the OS (everything related to bootloader, recovery and kernel). While I could find the recovery and kernel images inside mmcblk0 (offsets 0x380000 and 0xB80000), the bootloader itself seems to be completely inaccessible from the OS.
Click to expand...
Click to collapse
Boo Face!! Well thank you for the info. The offsets may still prove useful to get me out of this recovery bootloop I'm in.
Use parted not fdisk for emmc
MysticMgcn said:
Could someone please post their partition tables by running "fdisk -l /dev/block/mmcblk0" in ADB?
Click to expand...
Click to collapse
I know this is an old post but I think the command you are looking for is "parted /dev/block/mmcblk0" then type "print" and hit enter.

Extract files from stock firmware images

Hi,
when I still hadn't the device, I wanted to know exactly what's included in stock ROMs to have a better idea of what to expect. I hence downloaded a stock firmare and the stock system.img (see below for the steps).
Ok, so what? Well, when KK was released I decided to do the same (I was still waiting for the device), but I couldn't. Unlike before, I didn't find a single system.img, but multiple files (3 to be exact, maybe it's too big to be flashed at once with fastboot, I don't know, I'm new to this) and couldn't understand how the original image was splitted to generate those files.
Did anyone see something similar already and sucesfully merged splitted filesystems?
I know I could simply ask for a system dump (or wait for KK), but now I'm curious to know on how to do this. I tried few things but I couldn't find any way to do it. Maybe I could see how fastboot treat these files, but I wonder if anyone already knows the answer.
Anyway, here the steps to mount the system.img of our stock JB firmwares. Maybe there's an easier way, I honestly don't know. As far as I know, converting the sparge image should be enough, but I had to do more:
Code:
#Convert sparse image with simg2img
simg2img system.img system.img.raw.tmp
#UTF8 may slow down grep, switch to C
export LANG=C
#Look for the ext4 magic and calculate its position
magic=`grep -aobP -m1 '\x53\xEF' system.img.raw.tmp | head -1 | cut -d":" -f1`
offset=$(($magic-1080))
#Remove extra header with dd
dd if=system.img.raw.tmp of=system.img.raw ibs=$offset skip=1
#Remove temp file
rm system.img.raw.tmp
Now you can mount system.img.raw as a normal ext4 filesystem.
Just concatenate the three chunks together like so:
Code:
cat system.img_sparsechunk1 system.img_sparsechunk2 system.img_sparsechunk3 > system.img
Then apply the steps from the OP and voilà!
Edit: Scratch that: the image is accessible, some files are visible but others are missing. To be continued...
Darkshado said:
Just concatenate the three chunks together like so:
Code:
cat system.img_sparsechunk1 system.img_sparsechunk2 system.img_sparsechunk3 > system.img
Then apply the steps from the OP and voilà!
Edit: Scratch that: the image is accessible, some files are visible but others are missing. To be continued...
Click to expand...
Click to collapse
As you have found that doesn't work, remember that each file will have metadata headers so that may be one reason you can't just cat them together.
To OP - can't you just mount each img as a filesystem and copy all the files from each mounted filesystem to another entirely separate directory. At least that way you have all the files in one place, eg copy
/sparsechunk1/system/file1 to /newdir/system/file1
And so on.
scott_doyland said:
As you have found that doesn't work, remember that each file will have metadata headers so that may be one reason you can't just cat them together.
To OP - can't you just mount each img as a filesystem and copy all the files from each mounted filesystem to another entirely separate directory. At least that way you have all the files in one place, eg copy
/sparsechunk1/system/file1 to /newdir/system/file1
And so on.
Click to expand...
Click to collapse
Only the first chunk can be mounted, the other two are not recognized as filesystem and there's no way to mount them.
It's not as if /system was divided in three parts and then an image for each one was created, so that you can treat them as separate files (what you said would work in this case).
One image is created and then it's splitted in three in some unknown way. The first image is the one that holds the informations to access the files, the other two just pieces of files that can't be accessed without the informations in the first chunk.
mfastboot knows how to correctly copy the data from the separate images with the right offsets inside the phone so that in the end all the files can be accessed. Concatenating the files using dd using the correct offsets could maybe work, but after a few attempts I gave up.
There is method to extract files under Windows
Al936 said:
There is method to extract files under Windows
Click to expand...
Click to collapse
Any change you happen to be willing to share the contents of or principles behind `sparse2img.exe`?
HolySid said:
Any change you happen to be willing to share the contents of or principles behind `sparse2img.exe`?
Click to expand...
Click to collapse
What kind of principles you expect from me? I just posted the link to one of the method to extract all files and folders from stock firmware's system partition. The tools were not developed by me - I just informed XDA community about it. As you can see from the tread several persons already confirmed that it works.
Al936 said:
What kind of principles you expect from me? I just posted the link to one of the method to extract all files and folders from stock firmware's system partition. The tools were not developed by me - I just informed XDA community about it. As you can see from the tread several persons already confirmed that it works.
Click to expand...
Click to collapse
Oh, I'm sorry, I thought it was your work. I just want to know how to merge the system files. I know the exe is working, but I'm running Linux, so my question it is both out of curiosity and simply because I cannot run the code.
Try running it with wine or in virtual machine.
sent via tapatalk
Thanks, I managed it by using another laptop. But still, I'd rather know what happened
Sent from my XT1032 using xda app-developers app
Darkshado said:
Just concatenate the three chunks together like so:
Code:
cat system.img_sparsechunk1 system.img_sparsechunk2 system.img_sparsechunk3 > system.img
Then apply the steps from the OP and voilà!
Edit: Scratch that: the image is accessible, some files are visible but others are missing. To be continued...
Click to expand...
Click to collapse
I just replaced the first line in the OP's instructions with this to join the system.img_sparsechunk files:
Code:
simg2img system.img_sparsechunk.* system.img.raw.tmp
And then the rest worked fine. Here were the exact steps I took (I shortened it a tiny bit, but it's the same concept):
Code:
simg2img system.img_sparsechunk.* system.img.raw.tmp
offset=`LANG=C grep -aobP -m1 '\x53\xEF' system.img.raw.tmp | head -1 | awk '{print $1 - 1080}'`
dd if=system.img.raw.tmp of=system.img.raw ibs=$offset skip=1
sudo mkdir /mnt/system
sudo mount system.img.raw /mnt/system
SenorChang said:
I just replaced the first line in the OP's instructions with this to join the system.img_sparsechunk files:
Code:
simg2img system.img_sparsechunk.* system.img.raw.tmp
And then the rest worked fine. Here were the exact steps I took (I shortened it a tiny bit, but it's the same concept):
Code:
simg2img system.img_sparsechunk.* system.img.raw.tmp
offset=`LANG=C grep -aobP -m1 '\x53\xEF' system.img.raw.tmp | head -1 | awk '{print $1 - 1080}'`
dd if=system.img.raw.tmp of=system.img.raw ibs=$offset skip=1
sudo mkdir /mnt/system
sudo mount system.img.raw /mnt/system
Click to expand...
Click to collapse
It worked. Thank you!

[Q] Mounting userdata partition on PC

Hello all,
Last night I ran the following command (with the phone in recovery and everything unmounted) to back up my Nexus 5's userdata partition to my computer:
Code:
adb pull /dev/block/platform/msm_sdcc.1/by-name/userdata
My phone is encrypted, so I use "cryptsetup --type=plain open" to obtain a plaintext version on /dev/mapper/my-nexus-backup. But I cannot mount the mapped device using "mount"! It complains that iit can't find the filesystem.
So, how would I mount such an image? Or, even better, what's the best way to dd it back to the userdata partition on the device?
And yes, next time I will just use a Nandroid, even if it means having to erase things to make room.
See if @rootSU or @bitdomo can help. They're gurus at this type of stuff
Sent from my Nexus 5 using XDA Free mobile app
Sorry, where are you mounting exactly? Are you trying to mount an image on a Linux box after the pull?
If not can you please share the full step of commands and what you expect to happen please?
Sent from my Nexus 5 using Tapatalk
rootSU said:
Sorry, where are you mounting exactly? Are you trying to mount an image on a Linux box after the pull?
If not can you please share the full step of commands and what you expect to happen please?
Sent from my Nexus 5 using Tapatalk
Click to expand...
Click to collapse
Hey rootSU. I pulled the image from my phone, decrypted it, and tried to mount it:
Code:
$ adb pull /dev/block/platform/msm_sdcc.1/by-name/userdata
$ su
# losetup /dev/loop1 userdata
# cryptsetup open --type plain /dev/loop1 nexus
Enter passphrase:
# mount /dev/mapper/nexus /mnt/tmp
mount: wrong fs type, bad option, bad superblock on /dev/mapper/nexus,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so.
I'm not sure why that doesn't work. It's just ext4, right? I'd still find it instructive to figure out how to mount it; hopefully you can shed some light?
As far as getting the image back on the device's partition, I was a bit stuck, because there's obviously no room on the device to copy it to. I finally figured out a method involving netcat. Essentially I forwarded a local TCP port to my device (in recovery) using adb, then used netcat to feed dd the image.
Code:
$ adb forward tcp:4444 tcp:4444
$ adb shell
# nc -l -p 4444 -e dd of=/dev/block/platform/msm_sdcc.1/by-name/userdata
This will hang as it waits for an inbound connection. From a second shell:
Code:
$ dd if=userdata | nc localhost 4444
My 28GiB image took around 6 hours (!) to complete. Nandroid is probably the way to go.
Nandroid won't backup sdcard but you can use foldersync to back that up.
Yes it is just ext4
I've never done anything like this before with an encrypted device but my assumption was if you adb pull a file, it would decrypt it on the fly.. Does it not?? If it does, I'd just dd it to an img.
Sent from my Nexus 5 using Tapatalk
rootSU said:
Nandroid won't backup sdcard but you can use foldersync to back that up.
Yes it is just ext4
I've never done anything like this before with an encrypted device but my assumption was if you adb pull a file, it would decrypt it on the fly.. Does it not?? If it does, I'd just dd it to an img.
Sent from my Nexus 5 using Tapatalk
Click to expand...
Click to collapse
Nope, in this case, userdata is the encrypted *device*; in any case TWRP knows nothing about the encryption. The pull was identical to using dd to copy the file. Of course, if you wanted to decrypt your device without wiping data, you could probably have TWRP decrypt the data partition, then dd or pull the resulting /dev/block/dm-0 file (which is equivalent to my /dev/mapper/nexus file I created). Haven't tried it though; ain't nobody got time for that.
I wonder why it wouldn't mount. Oh well. I'm just happy that my device is the way it was yesterday.
I'd love to have a play with this but I just don't have the time to start encrypting and decrypting stuff
Out of interest what about adb whilst in android?
Sent from my Nexus 5 using Tapatalk
rootSU said:
I'd love to have a play with this but I just don't have the time to start encrypting and decrypting stuff
Out of interest what about adb whilst in android?
Sent from my Nexus 5 using Tapatalk
Click to expand...
Click to collapse
You would have the exact same results, as the /dev/* files are the physical disks represented as a file. The crypto drivers read/write this block device file to present a decrypted /dev/block/dm-0 device. Then the kernel mounts dm-0 as an ext4 filesystem on /data. All the files I mentioned are pullable with adb, assuming you have sufficient privileges. You don't need fancy tools to read/write them, which is why the netcat hack worked. Thus is the power of Unix!
You can screw around with it if you want in regular desktop Linux with a "device" you make from a bunch of 0s. Do:
Code:
# dd if=/dev/zero of=disk.image count=100000
# losetup /dev/loop0 disk.image
Now you can do "mkfs.ext4 /dev/loop0" and "mount ..." or whatever, and the data will be written to the "device" disk.image.
some time ago I backed up /dev/block/sda from my android 12 phone.
I forgot it was encrypted..
and that it had 34 partitions.
userdata partition WAS sda34.
how can I momentarily mount the backup in android?
losetup is present...

Categories

Resources