How to split the image cloned by dd command? - Android Q&A, Help & Troubleshooting

Hi,
I just use adb to connect to the mobile device, then using dd command to clone and image of the internal storage, as below:
dd if=/dev/block/mmcblk0p18 of=/storage/sdcard1/myclone.img
However, the clone fails after it reaches 4GB limit. Since sdcard is using FAT system and it only support maximum file size at 4GB.
Therefore, I try to split the image into small pieces, as follows:
dd if=/dev/block/mmcblk0p18 bs=1m | gzip -c | split -b 2045m - /storage/sdcard1/myclone.img.gz
However, this time I get an error said "split" is not a reconized command.
If split is not usable under Android, then how to split the large image into small pieces?
Thanks

Related

B&N repartition SD card Boot

This is straight from the mSD card that they have been using at every B&N. So you can just do it yourself at your convenience.
Gives you 8GB of external storage and the rest is for Barnes and Noble content.
Thanks. But how should we use it? Copy to SD and reboot? Use Win32DiskImager write the image to a SD?
Sent from a Galaxy far, far away
Does it install version 1.42?
otisw said:
Does it install version 1.42?
Click to expand...
Click to collapse
I had 1.4.0 before, and still had it after.
Sent from a Galaxy far, far away
Did root remain intact?
Anxiyz said:
Did root remain intact?
Click to expand...
Click to collapse
No, it completely erases everything.
Sent from a Galaxy far, far away
Damn, I could have used that last week before I took my NT in and had them do it for me. Oh well. Thanks for posting it though.
.CRS. said:
Here is how I got it to work.
IT ERASES EVERYTHING SO BACKUP BEFORE YOU DO THIS
1. Put flashing_boot.img on the root of your sd card
2. Turn off Nook
3. Hold the power button and the N button until the black N flashes on and off
4. Push the power button to turn the nook back on
5. It will show a factory reset menu, just push the N button to continue
View attachment 955245
Sent from a Galaxy far, far away
Click to expand...
Click to collapse
Just a note. You must have stock recovery for this to work not CMW or other.
Failed Several Times
I tried this several times but my media storage was still 1GB. Do I need to write the attached image or just copy it straight forward. When just copying, I can't pursue with the factory reset.
Same thing here, tried several times and still getting 1GB
Ditto. I was able to perform a factory reset, but I still have just 1GB of user storage after the update.
I suspect the problem may have something to do with the NOOK Tablet not recognizing the microSD card. I've noticed when using ClockworkMod that sometimes I have to remove it and re-insert it before it's recognized -- but there's no way to tell whether the stock recovery is seeing the card or not.
I tried removing/re-inserting it a few times during one of the three attempts to use this img, but that didn't seem to help.
That's the issue I had, not recognizing the card itself. I even copied the file unto a different card altogether and same thing. Still working on it, not ready to give up on it just yet.
No luck here and I'm sure it's not my cards. The couple cards I've tried all work with CWM. I've tried 2 different 1GB cards, a 256MB card, a 4GB card and an 8GB card.... I don't feel like clearing out my 32GB card. I've tried both FAT and FAT32. Does this need a different format, such as ext2? I've also tried using Win32DiskImager to actually "write" the image to the card... This I only tried on the 256MB.
jmeyerhead, any chance of getting a MD5 checksum? I have f94cd4df7351f81a2623f15e1853e205 .
CRS... Did you do anything that the rest of us haven't listed? Did you download from a different location?
EDIT: I'm also running the stock recovery. I run CWM off SD when I need it.
To use this you will need a 50MB FAT32 LBA Bootable partition with MLO, u-boot.bin from b&n update 1.4.2 and flashing_boot.img from the first post.
I extracted the kernel and ramdisk and they have a couple of shell scripts to do all the work.
However the scripts refer to a second ext3 partition on the sdcard which will allow you to reinstall the tablet from scratch as they do in the factory
I was able to pull the executables genpart make_ext4fs mkdosfs simg2img busybox etc and push them to my nook running with clockwork mod. Then inside a adb shell I was able to restore my tablet completely the only files I needed were the rombackup.zip from the original so that I retained my serial etc
Here is a approximate record of the steps I did inside the adb shell
Code:
#!/bin/sh
export emmc_total_sectors=31129600
export disk_total_sectors=31117905
export disk_media_sectors=25165823
./genptable ptable.new
# Enable performance mode
echo 4 > "/sys/devices/platform/mmci-omap-hs.1/mmc_host/mmc0/mmc0:0001/power_class"
./busybox dd if=/dev/zero of=/dev/block/mmcblk0 bs=4096 count=256 conv=notrunc,fsync
./busybox if=ptable of=/dev/block/mmcblk0
./busybox dd if=MLO of=/dev/block/mmcblk0p1
./busybox dd if=u-boot.bin of=/dev/block/mmcblk0p2
./busybox dd if=recovery.img of=/dev/block/mmcblk0p3
./busybox dd if=boot.img of=/dev/block/mmcblk0p4
./mkdosfs -F32 -n rom /dev/block/mmcblk0p5
./mkdosfs -F32 -n bootdata /dev/block/mmcblk0p6
./mkdosfs -F32 -n MyNook /dev/block/mmcblk0p10
./make_ext4fs -L factory /dev/block/mmcblk0p7
./make_ext4fs -L system /dev/block/mmcblk0p8
./make_ext4fs -L cache /dev/block/mmcblk0p9
./make_ext4fs -L userdata /dev/block/mmcblk0p11
./busybox mkdir -p /mnt/factory
./busybox mkdir -p /mnt/rom
./busybox mkdir -p /mnt/bootdata
./busybox mount -t ext4 /dev/block/mmcblk0p7 /mnt/factory
./busybox mount -t vfat /dev/block/mmcblk0p5 /mnt/rom
./busybox mount -t vfat /dev/block/mmcblk0p6 /mnt/bootdata
cd /mnt
/tmp/byhand/busybox unzip /tmp/byhand/rombackup.zip
cd /tmp/byhand
./busybox dd if=/dev/zero of=/mnt/bootdata/BCB bs=1088 count=1
./busybox dd if=/dev/zero of=/mnt/bootdata/BootCnt bs=4 count=1
./busybox umount /mnt/rom
./busybox umount /mnt/bootdata
./busybox cp factory.zip /mnt/factory/
./busybox cp rombackup.zip /mnt/factory/
cd /mnt/factory
/tmp/byhand/busybox unzip factory.zip romrestore.zip
cd /tmp/byhand
./busybox umount /mnt/factory
I did fiddle with the partition sizes a bit since I wanted 12.6GB so the exports at the beginning are different from what is in the flashing_boot.img
BIG FAT WARNING - I did this and it works form me don't try it unless you feel confident to recover from a clockworkmod booting off a sdcard
Well, mine is bricked. I can boot CWM SD though so I'm sure all is not lost. I'll have to experiment with it later. Just so everyone else knows I made formatted the disk as stated, copied the stated files. When I booted I immediately got a "software update" screen (I don't think I even held the n button down). Then once done it said to remove the card and restart.... never restarted (screen didn't light up, no 'n' screen, nada. I popped in my CWM SD and it did boot. Tried restoring a backup but that won't boot either. Should have stuck to the manual method or just gone in... I was hoping for something in the middle as far as complexity.
UPDATE: Ok, well I've gone in with Parted and let it correct the found errors (the expected ones reported in the manual formatting thread). Looking at the output from parted the repartitioning worked but something got screwed up. I've tried another restore after letting Parter do its thing but no joy. Is there anything else I should try while I'm in CWM and have ADB up? Any ideas?
Oh, and mine is a 16GB NT.... not 8GB and not Nook Color. I'm trying to download Adam's total wipe Ubuntu image but the host has exceeded its daily limit and the torrent is near dead.... So I'll just hurry up and wait while continuing to try different fixes via CWM.
EDIT: Read on. I did actually get my NT partitioned but ran into some issues with the file system I didn't expect. Thanks to meghd00t everything is now working perfectly... Read on.
if you have a copy of acclaim_update.zip for 1.4.0 or the b&n updates for 1.4.1.or 1.4.2 rename the file to acclaim_update.zip put it on the root of a FAT32 formated sd card and boot the nook by inserting the usb cable
if the steps from my previous post have worked all you need is a partition table MLO u-boot.bin boot.img recovery.img and rombackup.zip
when the tablet boots just like it looks for flashing_boot.img it also looks for the acclaim_update.zip if it is present and the MLO u-boot boot and recovery are OK it will completely reflash the OS to stock - However to retain serial number and B&N website access preserve the rombackup.zip from the factory partition
Did your thread get cut off?
Well, obviously I don't know how to set this up properly. I assume that it had actually booted off the internal system and not the SD I *thought* I set up. Is there a tutorial on building a SD properly for this or should I just go ahead and go with AdamOutler's Ubuntu card? Do I need to take a special precautions in either case to preserve the serial number?
Thanks for all the help!
Actually I had the exact same experience as you, so when the partition table was fixed I did not bother to create the contents of the 2nd ext3 partition, Instead I just copied the necessary files in adb and used dd to install MLO, u-boot, boot & recovery format all the Fat32 & ext4 partitions and copied factory.zip rombackup.zip to the factory partition and allowed the factory reset to happen.
from a quick look at the script the 2nd ext3 partition should atleast have these files
Code:
mkdir /images_to_flash
mount /dev/mmcblk1p2 /images_to_flash
if [ -f /images_to_flash/preflash.img ]; then
test -r /images_to_flash/noshutdown && cp /images_to_flash/noshutdown /
test -r /images_to_flash/version.ppm.gz && fbsplash -s /images_to_flash/version.ppm.gz
dd if=/images_to_flash/preflash.img of=/dev/mmcblk0 bs=4M conv=notrunc,fsync
simg2img /images_to_flash/factory.img /dev/mmcblk0p7
umount /images_to_flash
elif [ ! -f /images_to_flash/factory.img ]; then
if [ -f /images_to_flash/bootcnt ]; then
dd if=/images_to_flash/MLO of=/dev/mmcblk0p1
dd if=/images_to_flash/u-boot.bin of=/dev/mmcblk0p2
dd if=/images_to_flash/recovery.img of=/dev/mmcblk0p3
test -r /images_to_flash/boot.img && dd if=/images_to_flash/boot.img of=/dev/mmcblk0p4
if [ -f /images_to_flash/factory.zip ]; then
cp /images_to_flash/factory.zip /mnt/factory/factory.zip
dd if=/images_to_flash/MLO of=/dev/mmcblk0p1 bs=4096 conv=notrunc,fsync
dd if=/images_to_flash/u-boot.bin of=/dev/mmcblk0p2 bs=4096 conv=notrunc,fsync
dd if=/images_to_flash/recovery.img of=/dev/mmcblk0p3 bs=4096 conv=notrunc,fsync
dd if=/images_to_flash/boot.img of=/dev/mmcblk0p4 bs=4096 conv=notrunc,fsync
test -r /images_to_flash/factory.img && simg2img /images_to_flash/factory.img /dev/mmcblk0p7
if [ ! -f /images_to_flash/factory.img ]; then
test -r /images_to_flash/system.img && simg2img /images_to_flash/system.img /dev/mmcblk0p8
if [ -f "/images_to_flash/factory.img" ]; then
if [ -f /images_to_flash/factory.zip ]; then
cp /images_to_flash/factory.zip /mnt/factory/factory.zip
if [ -f "/images_to_flash/factory.img" ]; then
umount /images_to_flash
I guess these could be made by
1. preflash.img - ignore we dont want a factory install
2. bootcnt - dd if=/dev/zero of=bootcnt bs=4 count=1
3. MLO - unzip from factory.zip and rename
4. u-boot.bin - unzip from factory.zip
5. boot.img - unzip from factory.zip
6. recovery.img - unzip from factory.zip
7. factory.zip - rename the acclaim_update.zip for 1.4.0 or rename one of the b&n updates for 1.4.1 or 1.4.2
8. factory.img - this i think is a blank ext4 fs on a sparse disk, however if it does not exist the script will format the partition
9. system.img - not required
Why dont you go ahead and create a 2nd ext3 partition on the sdcard and create these files I am sure you will be able to unbrick and retain the rombackup and all the serials etc
just FYI I am attaching the shell script inside the flashing_boot.img that is doing all the work

[Q] Extracting boot class path without directory info

I am working on a new tool that will perform various function and one function i am trying to implement is the ability to odex / deodex system files.
The following command will extract the phones bootclasspath and save to a temp file ...
Code:
adb shell echo $BOOTCLASSPATH > tmp.txt
However, it saves the bootclasspath with all the directories to the files intact. For example,....
core.jar shows as /system/framework/core.jar
The whole file string looks like this...
Code:
/system/framework/core.jar:/system/framework/core-junit.jar:/system/framework/bouncycastle.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/framework2.jar:/system/framework/telephony-common.jar:/system/framework/mms-common.jar:/system/framework/android.policy.jar:/system/framework/services.jar:/system/framework/apache-xml.jar:/system/framework/sec_edm.jar:/system/framework/seccamera.jar:/system/framework/scrollpause.jar:/system/framework/stayrotation.jar:/system/framework/smartfaceservice.jar:/system/framework/abt-persistence.jar:/system/framework/secocsp.jar:/system/framework/sc.jar
Notice all the directory locations proceeding the actual file? So basically I am trying to find a way to pull the BCP without the directories showing since I am using a batch file to process the command.
I have even tried to remove the info from the text via batch file with the following but it didnt work...
Code:
findstr /V "/system/framework" tmp.txt > tmp2.txt
and a loop to pull just the few first characters....
Code:
[user=279333]@ECHO[/user] off
Set "InputFile=tmp.txt"
Set "OutputFile=tmp2.txt"
setLocal EnableDelayedExpansion > "%OutputFile%"
for /f "usebackq tokens=* delims= " %%a in ("%InputFile%") do (
set s=%%a
>> "%OutputFile%" echo.!s:~18!
)
But what i really need to make everything much simpler is a command to pull the BCP without the directories with them.
Thanks....
never mind....
I got some batch file help......this code scans the txt and pulls out the unwanted info
Code:
[user=279333]@ECHO[/user] OFF &SETLOCAL
FOR /f "delims=" %%a IN (tmp.txt) DO SET "BOOTCLASSPATH=%%a"
SET "BOOTCLASSPATH=%BOOTCLASSPATH:/system/framework/=%"
ECHO %BOOTCLASSPATH% > tmp2.txt
SET /p myvar= < tmp2.txt
Another way to do it is straight on the Android side using the basename utility:
Code:
for f in $BOOTCLASSPATH; do
name=$(basename "$f")
echo $name >> tmp.txt
done
Code above will work on pretty much any Linux OS
CNexus said:
Another way to do it is straight on the Android side using the basename utility:
Code:
for f in $BOOTCLASSPATH; do
name=$(basename "$f")
echo $name >> tmp.txt
done
Code above will work on pretty much any Linux OS
Click to expand...
Click to collapse
Right! Good info!
On another note, still creating some different options for the tool and have ran into an apparent size limitation for both user data and system images when extracted.
When performing the following command...
Code:
adb shell su -c "dd if=/dev/block/mmcblk0p%system% of=/%cardpath%/temp/system.img bs=4096
I am getting an error that says the file is too large. So there must be some 2gb barrier that will not allow an image beyond that file sizeto be extracted. I can see that twrp and similar recoveries split their images into multiple files like system.ext4.win000 - system.ext4.win001. So my question is from a command line, how would one extract these images into multiple files?
Didact74 said:
Right! Good info!
On another note, still creating some different options for the tool and have ran into an apparent size limitation for both user data and system images when extracted.
When performing the following command...
Code:
adb shell su -c "dd if=/dev/block/mmcblk0p%system% of=/%cardpath%/temp/system.img bs=4096
I am getting an error that says the file is too large. So there must be some 2gb barrier that will not allow an image beyond that file sizeto be extracted. I can see that twrp and similar recoveries split their images into multiple files like system.ext4.win000 - system.ext4.win001. So my question is from a command line, how would one extract these images into multiple files?
Click to expand...
Click to collapse
That's an interesting question...I think you can take advantage of dd's "count" and "skip" option to do it
Code:
#Copy first 1.5gb
dd if=/dev/block/mmcblk0p%system% of=/%cardpath%/temp/system.img bs=4096 count=768 #1.5 * 1024 / 2 MB block size
#Copy the remaining 0.5 gb
dd if=/dev/block/mmcblk0p%system% of=/%cardpath%/temp/system.img bs=4096 skip=768 count=256
Not very pretty, but I can't think of another way off the top of my head
What file system is the /%cardpath%/ that you're saving to?
The only downfall I see is that you need to know how large the entire system partition is first to see whether you need to break it up and the remainder to use for seek
--------
Also, I just thought of a sed one liner to do the bootclasspath thing you asked two posts above! Looks much cleaner IMO
Code:
echo $BOOTCLASSPATH | sed -e 's_\/system\/framework\/__g' > parsed.txt
CNexus said:
That's an interesting question...I think you can take advantage of dd's "count" and "skip" option to do it
Code:
#Copy first 1.5gb
dd if=/dev/block/mmcblk0p%system% of=/%cardpath%/temp/system.img bs=4096 count=768 #1.5 * 1024 / 2 MB block size
#Copy the remaining 0.5 gb
dd if=/dev/block/mmcblk0p%system% of=/%cardpath%/temp/system.img bs=4096 skip=768 count=256
Not very pretty, but I can't think of another way off the top of my head
What file system is the /%cardpath%/ that you're saving to?
Click to expand...
Click to collapse
Thats just my variable for the path to the SD card on my phone.
The above commands just result in a single 1mb file.
Can you explain what "count=768" represents?
oh....the file system is exfat
Didact74 said:
Thats just my variable for the path to the SD card on my phone.
The above commands just result in a single 1mb file.
Can you explain what "count=768 #1.5 * 1024 / 2 MB block size" represents?
Click to expand...
Click to collapse
Yes, I know that's the variable but unless it's formatted to some sort of FAT fs, it should copy the entire partition instead of stopping at a certain point.
Whoops, my math was off sorry. The concept is right, but I didn't spend too much time on the actual code
What I mean by that is that you're using bs=4096, which means you're going by 4096 byte chunks = 4 KB
Then you just do some math and calculate how many 4KB chunks are in 1.5GB and set that as the count parameter. So it would be (1.5GB *1024MB/GB ) / 4MB chunks = 384 MB chunks
384 MB chunks * 1024 KB/MB = 393216 KB chunks
So...
Final command would be
Code:
dd if=/dev/block/mmcblk0pXX of=/sdcard/out.img bs=4096 count=393216
And as you can see, it works...(I actually ran out of partition to copy so that's why it's 1.46)
CNexus said:
Yes, I know that's the variable but unless it's formatted to some sort of FAT fs, it should copy the entire partition instead of stopping at a certain point.
Whoops, my math was off sorry. The concept is right, but I didn't spend too much time on the actual code
What I mean by that is that you're using bs=4096, which means you're going by 4096 byte chunks = 4 KB
Then you just do some math and calculate how many 4KB chunks are in 1.5GB and set that as the count parameter. So it would be (1.5GB *1024MB/GB ) / 4MB chunks = 384 MB chunks
384 MB chunks * 1024 KB/MB = 393216 KB chunks
So...
Final command would be
Code:
dd if=/dev/block/mmcblk0pXX of=/sdcard/out.img bs=4096 count=393216
And as you can see, it works...(I actually ran out of partition to copy so that's why it's 1.46)
Click to expand...
Click to collapse
Okay, that makes sense.
File system is exFAT so i dont know why there is a size limit, but there is.
I am testing now to see what happens once the file reaches 1.5gb and how file #2 picks up. So this is what i have...
Code:
adb shell su -c "dd if=/dev/block/mmcblk0p%system% of=/%cardpath%/temp/system.img bs=4096 count=393216"
adb shell su -c "dd if=/dev/block/mmcblk0p%system% of=/%cardpath%/temp/system2.img bs=4096 skip=393216 count=196608"
I am not sure at this point what the last "count=" should be but I am trying 196608. Lastly, I would need to know how to join them into one file one on a local PC.
Will the last image grow to the count limit or will it only use the space needed? If i set it at 196606 will it only use what it needs or will the count force it to use it all?
The second count parameter should actually be 393,216÷3=131,072 (1.5gb / 3 = 0.5gb)
You can find the answer to that right here as I'm feeling lazy.
http://www.linuxquestions.org/linux...ltimedia/splitting_and_merging_files_using_dd
Didact74 said:
Will the last image grow to the count limit or will it only use the space needed? If i set it at 196606 will it only use what it needs or will the count force it to use it all?
Click to expand...
Click to collapse
I just ran a quick test on this and if you overshoot the count size, the last image will stop when it hits the end of the partition. So if there is 0.5gb left, it won't be any larger even if you specify for it to copy 0.8 gb.
CNexus said:
The second count parameter should actually be 393,216÷3=131,072 (1.5gb / 3 = 0.5gb)
You can find the answer to that right here as I'm feeling lazy.
http://www.linuxquestions.org/linux...ltimedia/splitting_and_merging_files_using_dd
I just ran a quick test on this and if you overshoot the count size, the last image will stop when it hits the end of the partition. So if there is 0.5gb left, it won't be any larger even if you specify for it to copy 0.8 gb.
Click to expand...
Click to collapse
Perfect, thank you. I think I have it worked out. Still in the process of learning linux so bare with me. I would like to use the standard dd command to not only copy the partition but save it to the local machine in one step rather than create and then pull.
So right now its this...
adb shell su -c "dd if=/dev/block/mmcblk0p%system% of=/%cardpath%/temp/system.img bs=4096 count=393216"
The dd is all happening in the virtual linux environment on the phone. Is there a way to dd out of the environment in one step? Like this?
adb shell su -c "dd if=/dev/block/mmcblk0p%system% of=**path to drive on local PC** bs=4096 count=393216"
This would copy the partition and save it to the local PC rather than copying it to the phone then pulling it.
Thanks,
Ah yeah, that annoys me too but I've never found a way around it because your device doesn't have a path to your PC's storage, it just knows that it's connected
CNexus said:
Ah yeah, that annoys me too but I've never found a way around it because your device doesn't have a path to your PC's storage, it just knows that it's connected
Click to expand...
Click to collapse
Okay so its a vicious circle ...lol. I can pull the system images in two parts, but rejoining them while still on the card revisits the whole 2gb file size barrier issue. While building, as soon as it hits 2gb, the command errors out.
If I pull the two separate parts from the card and rejoin them on the PC using cygwin there are no issues, everything builds fine.
However, I don't want cygwin to be required to run this tool. So my long winded question here is, what would be the BAT command to join these two files?
The command.........
system1.img+system2.img system.image
........results in a tiny 100kb file so something with that command is not working correctly unless there is a syntax i am missing.
Didact74 said:
Okay so its a vicious circle ...lol. I can pull the system images in two parts, but rejoining them while still on the card revisits the whole 2gb file size barrier issue. While building, as soon as it hits 2gb, the command errors out.
If I pull the two separate parts from the card and rejoin them on the PC using cygwin there are no issues, everything builds fine.
However, I don't want cygwin to be required to run this tool. So my long winded question here is, what would be the BAT command to join these two files?
The command.........
system1.img+system2.img system.image
........results in a tiny 100kb file so something with that command is not working correctly unless there is a syntax i am missing.
Click to expand...
Click to collapse
EDIT********
needed the /b switch
copy /b system1.img+system2.img system.img works great now.
Thanks
Didact74 said:
EDIT********
needed the /b switch
copy /b system1.img+system2.img system.img works great now.
Thanks
Click to expand...
Click to collapse
Ah, good deal.

[GUIDE][TUTORIAL][SHARE] How to make a nandroid backup directly to your computer with

Note: I'm just sharing the work of the XDA member.This guide was tested on Galaxy Y GT-S5360.Here's a little introduction:
scandiun said:
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 Phone Internet
USB Tethering:
Computer Phone Internet
Conputer Phone 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
Click to expand...
Click to collapse
Original Thread : http://forum.xda-developers.com/showthread.php?t=1818321
And here is the guide to make nandroid backup through terminal app in android with switching off the phone in sdcard!!!
http://forum.xda-developers.com/showthread.php?t=1620255

[Q] Make a full backup for flashing with busybox

Hello
There's a way for making a backup with RAW extension that can be flashed with fastboot in asus fonepad (i don't know about others)
See this: http://forum.xda-developers.com/showthread.php?t=1818321
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.
Click to expand...
Click to collapse
But it's for rooted devices only. how can i make a backup with busybox non-root?

img a research on Alcatel 6034 or 6035R

Hello,
I am looking for a mmcblk0p3 file located in the phones to redo the update.
to check the score of the phone:
Code:
adb shell cat proc/partitions
here is the code to extract the file in the SD card:
Code:
adb shell su -c dd if=/dev/block/mmcblk0p3 of=/sdcard/ids.img bs=4096
I tried but the problem my phone not recognize sd card as there is always block the startup logo.
here is the second code to extract the file on pc:
Code:
adb -d shell su -c busybox dd if=/dev/block/mmcblk0p3 > C:\Users\%username%\Desktop\ids.img
when I install a ROM by accident I mmcblk0p3 erase the file is replaced with the boot file.
I try again to do the update but I have a problem because it marks me "failure reading device information. Check the condition of the phone"
I'm looking to remake mmcblk0p3 updating the phone.
there is there anyone who could share that file (1024 kb) => traceability?
Thank you for your reply.

Categories

Resources