[TUTORIAL] Nandroid backup/restore directly from your PC - Mi 3 General

This guide is intended for those who own 16G MI3W which, sadly, often doesn't have enough space to make nandroid backup. This tutorial will show you how you can make nandroid backup directly to your PC and restore it later. Entire procedure will not store any single byte to your phone's internal memory.
Great part of this tutorial (and the whole idea) is taken from scandiun's thread, so some credits go to him.
WAS IT NECESSARY?
As we know, this operation (backup and restore) can, sort of, be done using adb backup command. But this command leaves out sms messages, call logs and some other information. So, backup made with adb backup may not be full, and does not reflect phone's current state.
REQUIREMENTS
This tutorial requires you to have:
ClockworkMod custom recovery installed on your phone
BusyBox installed into /system/xbin directory (your device probably already has it there). But you can check it or install it using this application (requires root).
Linux machine or MS Windows. I recommend linux, but if you're using Windows, please install Cygwin with netcat (nc), pv and util-linux (you can select those binaries in Cygwin setup).
Adb installed into some PATH directory. For windows, adb executable could be put into Windows directory (eg. C:\Windows). For linux, you can use command shown here to install adb, which will automatically put adb into your PATH directory.
Let's get down to business!
Whole philosophy lies behind opening some port on your device, over which will /data, /system or /cache partition be transfered from MI3 to PC's hard drive. Data is also being compressed/decompressed on the fly, so backup size is reduced. You can also see transfer speeds and total amount of data transfered.
Process is tested and it works!
BACKUP
To initiate a backup, we first have to run ADB. Connect USB cable to your phone. Then boot your device into recovery and select system 1. After that, go into Storage and mounts and mount /data, /cache and /system.
Finally, open Cygwin/linux shell and type the following:
Code:
adb kill-server
sudo adb start-server
adb forward tcp:1234 tcp:1234
adb shell
Then open another Cygwin/linux shell and create and enter directory which will hold MI3 backup. I called my directory mibackup.
Code:
mkdir ~/mibackup
cd ~/mibackup
You can see that we are working here with two consoles. First console will always represent phone's memory, and second will always represent our PC.
We will backup total of three partitions: /data, /cache and /system. That is essentially everything you need.
/system holds android system, and /data partition holds internal storage, applications, dalvik-cache and every other data including SMS messages, etc. But be prepared, because backup of this data partition can take up to 12,5GB of PC's hard drive space. It is usually lower because of compression, but just so you know. /system partition can take up to around 600MB, and is also usually lower than that.
/data partition (without internal storage)
Whole backup procedure of /data partition relies on few simple commands. Type this command in your first console, where adb shell is run:
Code:
cd /system/xbin
./busybox tar -pcf - /data --exclude='data/media/0' | ./busybox nc -l -p 1234
And then type command below into another shell:
Code:
nc localhost 1234 | pv -i 0.5 | gzip -c > data.gz
This will start backup process. As you may have noticed, this will backup our /data partition, but without internal storage (internal SD card).
Internal storage backup
After backup is complete, we can also backup our phone's storage (a.k.a. internal SD card), using following commands.
Type these commands in first console:
Code:
cd /system/xbin
./busybox tar -pcf - /data/media/0 | ./busybox nc -l -p 1234
and this command into second console:
Code:
nc localhost 1234 | pv -i 0.5 | gzip -c > sdcard.gz
/cache partition
Cache partition does not hold any important data. But I've noticed that when I wiped it, my current theme reset! This partition can be backed up in a matter of seconds, so why wouldn't we give it a try?
Type these commands in first console:
Code:
cd /system/xbin
./busybox tar -pcf - /cache | ./busybox nc -l -p 1234
and this command into second console:
Code:
nc localhost 1234 | pv -i 0.5 | gzip -c > cache.gz
/system partition
Finally, we can backup our /system partition. But, because BusyBox is located in /system, and we do not want to use this partition while it's in backup/restore phase, we have to copy xbin directory (busybox) to internal SD card.
Type these commands in your first console:
Code:
cp -R /system/xbin /data/media/0
cd /data/media/0/xbin
./busybox tar -pcf - /system | ./busybox nc -l -p 1234
and this command into second console:
Code:
nc localhost 1234 | pv -i 0.5 | gzip -c > system.gz
After the process is done, type following commands in first console to clean up xbin directory from internal storage, and to close adb.
Code:
cd /
rm -rf /data/media/0/xbin
exit
adb kill-server
And you have just created backup of your phone, into chosen directory. Congratulations!
Backup is in this case made of four files: data.gz, sdcard.gz, cache.gz and system.gz.
RESTORE
Before each restore procedure, we should wipe partition we are going to restore. So be careful! It is also important to check if /data, /cache and /system are mounted after each wipe/format.
To prepare things for restoration, open console and type in:
Code:
adb kill-server
sudo adb usb
adb forward tcp:1234 tcp:1234
adb shell
Then open another terminal, and go into directory where backups are stored. When I showed you how to create backup, I used mibackup directory. So, let's go into that directory once again, so we can pull our backups from there.
Code:
cd ~/mibackup
/data partition (doesn't contain internal storage)
If you are going to restore /data and /sdcard, then go to mounts and storage, and choose the last option - format /data and /data/media.
If you are going to restore only phone's data (and not /sdcard), select wipe data/factory reset from CWM menu. Don't skip this step! After that, make sure that /system and /data partitions are mounted.
To restore data partition then, type this commands into first console:
Code:
cd /
/system/xbin/busybox nc -l -p 1234 | tar -px
and this command into second:
Code:
gunzip -ck data.gz | pv -i 0.5 | nc localhost 1234
Internal storage
Make sure that /system and /data are mounted.
If you just restored /data partition, you don't have to wipe/format anything. Otherwise, if you just want to restore your internal SD card, you can type following command into first console, to wipe it first:
Code:
cd /
rm -rf /data/media/0/*
Type these commands into first console to restore your internal SD card (if you've backed it up):
Code:
cd /
/system/xbin/busybox nc -l -p 1234 | tar -px
and this command into second one:
Code:
gunzip -ck sdcard.gz | pv -i 0.5 | nc localhost 1234
/cache partition
Make sure that /system and /cache are mounted, and then format /cache from CWM.
/cache partition will be restored just as fast as it was backed up.
Type these commands into first console:
Code:
cd /
/system/xbin/busybox nc -l -p 1234 | tar -px
and this command into second console:
Code:
gunzip -ck cache.gz | pv -i 0.5 | nc localhost 1234
/system partition
After process is finished, we can restore system partition in a similar fashion we did when we backed it up. Just make sure that /system and /data are mounted, and then format /system from CWM.
Type this commands into first console:
Code:
cp -R /system/xbin /data/media/0
cd /
/data/media/0/xbin/busybox nc -l -p 1234 | tar -px
And this command into second one:
Code:
gunzip -ck system.gz | pv -i 0.5 | nc localhost 1234
After that, we just have to do some housekeeping jobs:
Code:
cd /
rm -rf /data/media/0/xbin
exit
adb kill-server
And last, but not least, if you haven't restored /cache partition, you should format it from CWM recovery.
That's it!

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] System.img Editing Dev Help

Hi all,
im working on making a ROM for the Asus Transformer and im struggling a bit. im totall new to Linux, using mint and just getting used to it.
Basically im just trying to take a stock ROM and add root but adding superuser.apk and SU binary but im running into problems.
Asus Roms are a bit unusual, packed into blob files, ive unpacked that no problem, the system image is called blob.APP but its just the same as system.img just the name as i understand it.
ok so what ive done:
Code:
mkdir system
sudo mount -t ext4 -o loop blob.APP system/
so this mounts the ext4 fs as a loop device and allows me to copy the contents out
Code:
sudo cp -ar system new_system
then ive copied superuser.apk to /app and SU binary to /dev with drop and drag.
then make the filesystem image
Code:
sudo ./make_ext4fs -l 512m -a system blob.APP new_system/system
then just pack it up and flash it, flashing works fine, no errors but when i go to reboot it warns that theres no OS so somethings not worked. ive tried everything i can find googeling!
i just started learning linux on weds so go easy on me
any advice or help would be really great. thanks!
mkdir system here you will mount the old system
mkdir system_new here you will mount the new system
we now create the actual image
dd if=/dev/zero of=system_new.img bs=4k count=60000
bs=4k is the block size
count=60000 the number of blocks of 4kb size
so is something like 60000*4= 240000 which is actually 240 Mb
so it depends to you how big you want the image.
now we format the system.img in ext4
mkfs.ext4 system_new.img
Proceed anyway? (y,n) y
now we override the filesystem check
tune2fs -c0 -i0 system_new.img
Now we mount the the 2 directories that we created in the first step
mount -o loop system_new.img system_new/
mount -o loop system_new.img system/
Now we copy the contet of the old image to the new one with all the perimissions
cp -v -r -p system/* system_new/
We sinc the files
sync
We unmount the partitions
umount system_new/
umount system/
And voila, the system.img in ext4 is created.
Tips: you will need superuser acces.
if you will copy new files besides the ones from the old system you will have to set by hand all the permissions.
If you are using ubuntu just type
sudo su
and you will be root and no more sudo at each command.
Thank u so much for your guide this is exactly what I'm looking for so massive thanks!
So to add root I.can drop and drag superuser.apk and the binary into the new image?
Also do I need to worry about the android mountpoint?
Sent from my HTC Sensation Z710e using xda premium
yes you can do that, as long as you set the permissions right. (you can google for them)
and from what i remeber you will have to set also the ownership of the su, and superusers files
you need to do tests first, and then try
the mountpoint should be ok as it is now.
globula_neagra said:
mkdir system here you will mount the old system
mkdir system_new here you will mount the new system
we now create the actual image
dd if=/dev/zero of=system_new.img bs=4k count=60000
bs=4k is the block size
count=60000 the number of blocks of 4kb size
so is something like 60000*4= 240000 which is actually 240 Mb
so it depends to you how big you want the image.
now we format the system.img in ext4
mkfs.ext4 system_new.img
Proceed anyway? (y,n) y
now we override the filesystem check
tune2fs -c0 -i0 system_new.img
Now we mount the the 2 directories that we created in the first step
mount -o loop system_new.img system_new/
mount -o loop system_new.img system/
Now we copy the contet of the old image to the new one with all the perimissions
cp -v -r -p system/* system_new/
We sinc the files
sync
We unmount the partitions
umount system_new/
umount system/
And voila, the system.img in ext4 is created.
Tips: you will need superuser acces.
if you will copy new files besides the ones from the old system you will have to set by hand all the permissions.
If you are using ubuntu just type
sudo su
and you will be root and no more sudo at each command.
Click to expand...
Click to collapse
U said, we have to set permissions by ourselves. So what are the permissions that needs to be set when I add a new folder with an APK in it?
Sudo chmod 777 filepath/filename.apk
Sudo chmod a-rwx filepatch/filename.apk.
This is what I remember from top of my head. Google it a bit if it does not work from the first try as I have not used this like in 5 years.
If you allready have root you can you a file manager and just copy the file/folder where you want and set the permissions via thw file manager or using terminal commanda or via adb.
From what remember you can t make a folder in the apk folder as you won t be able to run the apk.

[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?

[GUIDE] Mounting the fat32 partition on MacOS

So it's known that the fat32 partition of the android SD doesn't mount automatically on MacOS, presumably because of the funky partition table. I just managed to mount it manually from terminal, it has some quirks but it works.
First, find the partition:
Code:
diskutil list
shows you the disks on your system, the android one has disk<n> as FDisk_partition_scheme, then two partitions as type 0xEE. The first of those, the 2.1gb partition, is the fat32 one, so make a note of its identifier (disk<n>s<m>). If you've made your own partition layout you should know which is the right one.
Then, make a mount point (empty directory) for it.
I did:
Code:
sudo mkdir /Volumes/msdos
("msdos" is the name of the partition type, as we'll see in a sec)
to put it where disks are usually mounted, but you can make a directory anywhere you want, if it's somewhere in your user directory you don't need sudo - ie:
Code:
mkdir <path>/msdos
or
Code:
mkdir msdos
to put it in the current directory. You can name it whatever you want, it doesn't have to be "msdos".
(You only need to run one of these mount commands, not all 3)
Now to mount it:
Code:
sudo mount -t msdos /dev/disk<n>s<m> <path>
(replace <n> and <m> with the numbers you found in step 1 - don't type the < >)
(replace <path> with the path you used for mkdir - in my case, /Volumes/msdos)
This one does need sudo to have permission to access the disk device. If you don't get any error messages, then your disk should be mounted. Annoyingly, it doesn't show up in the normal way as a disk in Finder, if anyone knows how to change this please let me know. For now, next step...
Point Finder to the disk:
In Finder click the Go menu, and choose Go to folder...
Type or paste the full path to your mount point (in my case, /Volumes/msdos).
<'90s hacker voice> Youre in.
Unmounting:
Make sure your finder window isn't pointing to anything on the disk, and you don't have a terminal using any of its directories, and no other apps have files open on the disk. Then do:
Code:
sudo umount <path>
so for my example that's:
Code:
sudo umount /Volumes/msdos
If you get no errors then it's unmounted, and you're safe to remove the SD card.
If you want, you can delete the directory you were using as a mount point (or you can just leave it for next time). If it's in /Volumes, do eg:
Code:
sudo rmdir /Volumes/msdos
otherwise just do:
Code:
rmdir <path>

Categories

Resources