[GUIDE] How to mount USB external harddisk(support NTFS and multi disks) - Xoom Android Development

Comment @ 1st June 2011: In Android 3.1 stock kernel or Tiamat kernel, it has usb-hosting function enabled.So just install hellcat82’s apk and ignore this guide, you could get your NTFS disk mounted.
All Thanks to Roebeet who has enabled usb hosting on xoom.
see the detail at here.
But it didn't support NTFS partition at this time, so i write this guide for ntfs supporting.
( hellcat82 has written a tool to simplify mounting NTFS drives, no need to push any file to android anymore. By just installing one apk, you will get everything. Let's give cheers to hellcat82! )
1.preparing
1.1 hardware
one microUSB male to USB-A female OTG cable.
one powered USB hub with USB-A male connector.
usb external harddisk.
1.2 software
Kernel: root your xoom and enable USB hosting mode by Roebeet‘s hack. or update kernel to Tiamat Xoom 1.1.6 which integrated Roebeet‘s hack.
NTFS supporting: NTFS-3g compiled by farazite , the newest version is on page 2 of that post.
Script Tool:gscript lite, downloadable from market.
2. push ntfs-3g supporting files to xoom
comment: ntfsvolume.apk is not compatible with xoom, so we can just use ntfs-3g and umount_force. at this moment, there is a bug in umount_force which can only dismount one partition, if we mount more than one ntfs partition, then we can not dismount all partitions totally.
Code:
adb remount
adb push ntfs-3g /system/xbin
adb push umount_force /system/xbin
adb shell chmod 755 /system/xbin/ntfs-3g /system/xbin/umount_force
3. Connecting Xoom,USB hub and USB disk
4. Mounting USB disks
use gscript lite to mount disk(s), or you can test this script via adbwireless, because we have no room to connect xoom and PC now.
Code:
mount -o remount,rw /
mkdir /mnt/ntfsdisk
ln -s /mnt/ntfsdisk /ntfsdisk
ntfs-3g /dev/block/sda1 /mnt/ntfsdisk
sda1 is the first partition of the first disk,
sdb1 is the first partition of the second disk.
and so on.
if you want to mount the second disk, the reference script is
Code:
mkdir /mnt/ntfsdisk2
ln -s /mnt/ntfsdisk2 /ntfsdisk2
ntfs-3g /dev/block/sdb1 /mnt/ntfsdisk2
PS:if the partition of your disk is FAT16/32, then you needn't doing anything , it will be auto mounted by Roebeet's hack.
5. Dismounting USB disks
Code:
umount_force /mnt/ntfsdisk
example:
I mounted one USB flash disk(512MB), one 2.5 inch hard disk(120GB), one 3.5 inch hard disk(2TB)
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
the ntfs partition can be read and written without problem.

nice job ill be using this soon

this should work ya?
http://laptopupgrade.stores.yahoo.net/usbmi5matoty.html

n0-0ne said:
this should work ya?
http://laptopupgrade.stores.yahoo.net/usbmi5matoty.html
Click to expand...
Click to collapse
That's a mini not micro USB so you can't use it.
Sent from my Xoom using XDA Premium App

balls, I missed that. These cords are hard to find. Found one on amazon UK but $40 was a bit steep I think.

When u say hard disk are you talking spinning drive or flash drive with no moving parts? Can zoom USB port put out enough juice to power a drive.
Sent from my ADR6400L using Tapatalk

myv6mustang said:
When u say hard disk are you talking spinning drive or flash drive with no moving parts? Can zoom USB port put out enough juice to power a drive.
Sent from my ADR6400L using Tapatalk
Click to expand...
Click to collapse
Xoom puts out enuff power. Puts out about 600ma. I was charging my evo from it last nite. I will be trying this tonite.
Sent From My Evo

Does this work on the wifi only version also....
Just checking before I test this out...

myv6mustang said:
When u say hard disk are you talking spinning drive or flash drive with no moving parts? Can zoom USB port put out enough juice to power a drive.
Sent from my ADR6400L using Tapatalk
Click to expand...
Click to collapse
No, the usb port can not provide sufficient current to spin hard disk. so I used a powered USB hub to connect hard disk.
(I have tested it just a moment ago, xoom couldn't identify the 2.5 inch hard disk without powered USB hub.)
cavemanb said:
Does this work on the wifi only version also....
Just checking before I test this out...
Click to expand...
Click to collapse
I tested it on CDMA version, but think it should work on wifi versioon also, because it isn't network-related.
n0-0ne said:
balls, I missed that. These cords are hard to find. Found one on amazon UK but $40 was a bit steep I think.
Click to expand...
Click to collapse
I spent less than 2 dollars to buy it at china.
I think it should be less than $5 in UK.

Is there a hard drive size limit that it can't support for this USB fix?
I have an 2TB external hard drive that I would like to use but I am not sure it will work. It is currently formatted in NTFS mode.

There shoudnt be any limit, the limit is based on the file system. Unless there is some system limit.
Sent from my Xoom using XDA Premium App

hawk2k8 said:
No, the usb port can not provide sufficient current to spin hard disk. so I used a powered USB hub to connect hard disk.
(I have tested it just a moment ago, xoom couldn't identify the 2.5 inch hard disk without powered USB hub.)
Click to expand...
Click to collapse
Ok makes sense...will order the cable and give this a shot.

n0-0ne said:
balls, I missed that. These cords are hard to find. Found one on amazon UK but $40 was a bit steep I think.
Click to expand...
Click to collapse
I don't know if it's too late to help, but I just searched for "OTG cable" on eBay and found one for a dollar from China. $2.50 in S&H. Lulz.

I am a bit stuck at #4.
-------------------------
4. Mounting USB disks
use gscript lite to mount disk(s), or you can test this script via adbwireless, because we have no room to connect xoom and PC now.
Code:
mount -o remount,rw /
mkdir /mnt/ntfsdisk
ln -s /mnt/ntfsdisk /ntfsdisk
ntfs-3g /dev/block/sda1 /mnt/ntfsdisk
-------------------------
Sorry for the ignorance....
I tried running the mount commands from adb through adbwireless.
I get 'mount' not a recognized command.
I then use terminal directly on the xoom and make it through mount, mkdir and ln.
When I attempt to execute ntfs-3g I get 'Permission Denied'.
I am logged in with root permission through su.
Also wrote the script (minus the mkdir since I already created it) in gscript and it also ends in 'permission denied'.
Additional testing...
I can see the drive fine when I run fdisk -l /dev/block/sda1
I have the /ntfsdisk folder mounted as r/w
Thoughts? Thanks for writing this up...

eaglecomm said:
I am a bit stuck at #4.
-------------------------
4. Mounting USB disks
use gscript lite to mount disk(s), or you can test this script via adbwireless, because we have no room to connect xoom and PC now.
Code:
mount -o remount,rw /
mkdir /mnt/ntfsdisk
ln -s /mnt/ntfsdisk /ntfsdisk
ntfs-3g /dev/block/sda1 /mnt/ntfsdisk
-------------------------
Sorry for the ignorance....
I tried running the mount commands from adb through adbwireless.
I get 'mount' not a recognized command.
I then use terminal directly on the xoom and make it through mount, mkdir and ln.
When I attempt to execute ntfs-3g I get 'Permission Denied'.
I am logged in with root permission through su.
Also wrote the script (minus the mkdir since I already created it) in gscript and it also ends in 'permission denied'.
Thoughts? Thanks for writing this up...
Click to expand...
Click to collapse
sorry for the 'Permission Denied' of ntfs-3g.
It missed a chmod command in the first post.
we should run
Code:
adb shell chmod 755 /system/xbin/ntfs-3g /system/xbin/umount_force
to get the permission.

That did it! Thanks...
Funny.. I got..
Couldn't set local environment, using default '(null)'.
The disk contains an unclean file system (0, 0).
The file system wasn't safely closed on Windows. Fixing.
I think I probably just pulled the usb device out of the laptop without closing it properly.. eager to see if it found my files.
So.. all is well. Thanks again!
1 more question. Is there a need to unmount before the USB drive is removed? Or can it now be plugged and removed at leisure without causing any issues?
Bummer... now it's gone. I went somewhere else, then went back in to Root Explorer and the ntfsdisk folder is empty. Nothing was disconnected. Maybe it times out after a minute or two?
And the only way I could get it to show up again was to run it as if it was the second partition. Does it hold a value that needs to be released? I ran the umount statement.
Here is what I had to execute: ntfs-3g /dev/block/sda2 /mnt/ntfsdisk

eaglecomm said:
That did it! Thanks...
Funny.. I got..
Couldn't set local environment, using default '(null)'.
The disk contains an unclean file system (0, 0).
The file system wasn't safely closed on Windows. Fixing.
I think I probably just pulled the usb device out of the laptop without closing it properly.. eager to see if it found my files.
So.. all is well. Thanks again!
1 more question. Is there a need to unmount before the USB drive is removed? Or can it now be plugged and removed at leisure without causing any issues?
Bummer... now it's gone. I went somewhere else, then went back in to Root Explorer and the ntfsdisk folder is empty. Nothing was disconnected. Maybe it times out after a minute or two?
Click to expand...
Click to collapse
If you haven't written data to the disk, I think it would be safe to unplug the cable directly.
for the issue of lost mounting, I have never met it, need some time to observe it.

right, no worries..
And once I did a umount_force and then reconnected, it was seen as sda1 again. Maybe just a fluke.
Thanks.

can this be applied to WIFI only Xoom version or not? to my knowledge there is some software differences with 3G.

I am running Wifi.. worked for me. Don't know if it messed anything else up. But so far I think the xoom is still truckin' along.

Related

[Q] Adfree on Droid Incredible

Philosophical issues aside, how does one get this working? A crucial barcode program i use has amazingly annoying religious ads.
Here is what I have tried:
Rooted with Unrevoked / Nandroid Backup / Titanium Backup / wifiTether /Led flashlight. Stock otherwise.
Install adfree, ran it, phone rebooted.
Boot into clockwork recovery and launch adb shell.
Execute the following:
Code:
2. Install and run
3. allow it to download and install new hosts file, it will copy it to your sdcard and try to replace /system/etc/hosts but fail (it should reboot the phone shortly)
4. Power off the phone and hold Volume Down and power.
5. Use volume down to select recovery
6. In clockwork recovery volume down to "partitions menu" and hit the track pad to select
7. Select "mount /system" and "mount /sdcard" "mount /data"
8. Plug in your usb cord and open a command line on your pc
9. enter adb shell and type the following commands
cp /sdcard/hosts /data/data/hosts
rm /system/etc/hosts
ln -s /data/data/hosts /system/etc/hosts
On reboot, no change, and adfree fails trying to update. Help?
heliotropeUCSD said:
Code:
cp /sdcard/hosts /data/data/hosts
rm /system/etc/hosts
ln -s /data/data/hosts /system/etc/hosts
Click to expand...
Click to collapse
I found a post earlier that changes the paths. It has worked for me on every Rom I have tried.
Code:
cp /sdcard/hosts /data/hosts
rm /system/etc/hosts
ln -s /data/hosts /system/etc/hosts
Sent from my ADR6300
Hmmm, still didn't work. Can you go into a little bit more detail? I'm stock everything, just rooted.
The philosophical struggle goes deeper than what you think! Another method (frowned upon by most uninformed members of this forum but endorsed by some of the experts) is to do a tempoary nand unlock using the unrevoked tool.
Run the tool like normal, then unplug after the "running pre-boot sequence" and during "waiting for reboot". I've done it plenty of times perfectly, it allows you to run adfree normally without any special tricks (just default settings). I have no idea what happens if you unplugged at the wrong time (you have a like 20-second window ffs) but I hear it's bad.
Do it at your own risk
I'd just like to point out that I think the above suggestion is actually INTENDED to brick phones. I wouldn't recommend anyone try it. Does anyone have any real suggestions? I have a serious problem with religious ads on my f***ing telephone.
heliotropeUCSD said:
I'd just like to point out that I think the above suggestion is actually INTENDED to brick phones. I wouldn't recommend anyone try it. Does anyone have any real suggestions? I have a serious problem with religious ads on my f***ing telephone.
Click to expand...
Click to collapse
Listen bro, this method works just fine.
Run unrevoked 3.1 when you are in the OS, then it will reboot your phone to hboot and then it unlocks your nand, it will reboot and you will see the white incredible screen, at this time you can unplug your USB cable, I just suggest doing it before it gets back to the OS so you don't pull it when it is flashing your recovery, but if you do it at the white incredible screen or during the bootanimation. Then when you get back to the OS, run adfree and update your hosts, success, profit?
I can confirm that it will work 100% without bricking your phone. Anyone who said it has is full of ****. Don't listen to those **** smoking noobs out there that are hanging on to unrevoked teams ballsacks. This will not brick your phone if you do as I said above. If this bricked your phone then it would not be safe to use the unrevoked program period. So don't listen to the noobs out there, this method works 100% without issue. I posted this method awhile back and everyone got upset like I did something wrong, but people did verify it did work if you want to find the post I made look for it.
Hmm, well. I have no idea, it sounds like you may be right, but it isn't the type of solution that i am looking for.
I'd like to find a way to use the symbolic link method to store the hosts file somewhere where adfree can write to it. Does anyone else have an idea?
heliotropeUCSD said:
Hmm, well. I have no idea, it sounds like you may be right, but it isn't the type of solution that i am looking for.
I'd like to find a way to use the symbolic link method to store the hosts file somewhere where adfree can write to it. Does anyone else have an idea?
Click to expand...
Click to collapse
sym link doesnt work for me, um, I would just do what I stated above if all else you tried has failed.
I used the above method in the #1st Post on an 2.2 ROM with no issue! I can update Adfree at any point after completing those directions...
here is where I found those directions... http://www.jonamerica.com/technology/howto-root-the-htc-droid-incredible/
Hmm. I am really, genuinely scared of the method posted by TNS201. I believe him that it may work, but I simply don't understand the mechanism. Is he suggesting that this successfully unlocks the NAND memory? Or does it allow it to be unlocked for one boot cycle, in which case I can't update adfree?
heliotropeUCSD said:
Hmm. I am really, genuinely scared of the method posted by TNS201. I believe him that it may work, but I simply don't understand the mechanism. Is he suggesting that this successfully unlocks the NAND memory? Or does it allow it to be unlocked for one boot cycle, in which case I can't update adfree?
Click to expand...
Click to collapse
Why do say that it "may" work. I can confirm it works 100%, I wouldn't tell you something that doesn't. It unlocks the NAND for one boot. So you can write to system and such during this time. The duration of this lasts until you power off or reboot your phone. This stays active until next reboot. You can update adfree and reboot if you want.
TNS201 said:
Listen bro, this method works just fine.
Run unrevoked 3.1 when you are in the OS, then it will reboot your phone to hboot and then it unlocks your nand, it will reboot and you will see the white incredible screen, at this time you can unplug your USB cable, I just suggest doing it before it gets back to the OS so you don't pull it when it is flashing your recovery, but if you do it at the white incredible screen or during the bootanimation. Then when you get back to the OS, run adfree and update your hosts, success, profit?
I can confirm that it will work 100% without bricking your phone. Anyone who said it has is full of ****. Don't listen to those **** smoking noobs out there that are hanging on to unrevoked teams ballsacks. This will not brick your phone if you do as I said above. If this bricked your phone then it would not be safe to use the unrevoked program period. So don't listen to the noobs out there, this method works 100% without issue. I posted this method awhile back and everyone got upset like I did something wrong, but people did verify it did work if you want to find the post I made look for it.
Click to expand...
Click to collapse
...eloquently said, sir...
Anyway OP, if you don't wanna do it, that's fine. And I think it's wonderful that you don't care whether anyone questions your sexual orientation
(FUTURAMA REFERENCE, DON'T FLAME ME.)
Seriously, why are the uninformed so cocksure?
Yeah, but somebody must have gotten the symlink method to work. I'm not willing to risk bricking my phone in any way to do this- like I said, there are philosophical issues here. I'd rather just see the ads.
So, again- has anyone with an Incredible, rooted, stock rom, used the symlink method to install adfree?
heliotropeUCSD said:
Hmm. I am really, genuinely scared of the method posted by TNS201. I believe him that it may work, but I simply don't understand the mechanism. Is he suggesting that this successfully unlocks the NAND memory? Or does it allow it to be unlocked for one boot cycle, in which case I can't update adfree?
Click to expand...
Click to collapse
As stated in my earlier post, I have it working on my Incredible and it has worked for me on 4 different ROMS.
This may not work for you, but it does work for me. I found these tips awhile ago and don't remember where I found them.
NOTE: Notice the paths in the commands below - They differ from the original post.
Boot into clockwork recovery and launch adb shell.
Execute the following:
Code:
2. Install and run
3. allow it to download and install new hosts file, it will copy it to your sdcard and try to replace /system/etc/hosts but fail (it should reboot the phone shortly)
4. Power off the phone and hold Volume Down and power.
5. Use volume down to select recovery
6. In clockwork recovery volume down to "partitions menu" and hit the track pad to select
7. Select "mount /system" and "mount /sdcard" "mount /data"
8. Plug in your usb cord and open a command line on your pc
9. enter adb shell and type the following commands
cp /sdcard/hosts /data/hosts
rm /system/etc/hosts
ln -s /data/hosts /system/etc/hosts
Note the last command, that it a lowercase L not an I
a couple of others have made that mistake (for best results copy each command to your clipboard and paste it into your command prompt).
Reboot the phone and it should work now.
Use BTC IP and do not check symlink from /data/data/hosts
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
gadget!
heliotropeUCSD said:
Yeah, but somebody must have gotten the symlink method to work. I'm not willing to risk bricking my phone in any way to do this- like I said, there are philosophical issues here. I'd rather just see the ads.
So, again- has anyone with an Incredible, rooted, stock rom, used the symlink method to install adfree?
Click to expand...
Click to collapse
Are you getting any errors in the shell when you type the commands?
should look like this when you enter a command
Code:
# ln -s /data/data/hosts /system/etc/hosts <--hit enter
ln -s /data/data/hosts /system/etc/hosts
#
First, can you go into recovery, and let me know if this command returns hosts
Code:
ls /data/data | grep hosts
This lists the directory and "filters" out everything but the text after grep.
output should look like:
Code:
# ls /data/data | grep hosts
ls /data/data | grep hosts
hosts
#
I need to know, because I think that adfree might not have made a hosts file on your sdcard when you ran before starting, thus there was no hosts file to "cp" form /sdcard to /data/data/.
If that is the case, and since you have rm'ed your hosts file from /system/etc/, you will have to recreate the file with the touch command.
My $.02
***********************************
It is NOT necessary to run or even install adfree before getting your hosts files setup in the system.
Here is the method I use:
1. copy the existing hosts file to /data/data
Code:
cp /system/etc/hosts /data/data/hosts
2. rename hosts to hosts.bak
Code:
mv /system/etc/hosts /system/etc/hosts.bak
3. symlink the hosts files
Code:
ln -s /data/data/hosts /system/etc/hosts
At that point, your system is setup to run adfree. On the first run of adfree, it will see the hosts file in /data/data and uses it.
I have use this method at least 10 times while trying out different roms:
Hell to the yes. gadget!'s method worked for me- I did not know NOT to use local IP and to NOT check the symlink button. Maybe someone can educate me on what those options mean?
Glad it worked out for you =). j/w, is the app that kept giving you religious ads "Android System Info"? For some reason the people behind that app have decided to lock the ad into messages about "Jesus" or "prayers"... I always thought that was kind of odd.
Adfree works without issue after running unrevoked forever. No symlink needed.
Sent from my ADR6300 using XDA App
bhazard451 said:
Adfree works without issue after running unrevoked forever. No symlink needed.
Sent from my ADR6300 using XDA App
Click to expand...
Click to collapse
Thanks for the info, came here to ask this question. Do I need to check symlink in the adfree setup?
gadget! said:
As stated in my earlier post, I have it working on my Incredible and it has worked for me on 4 different ROMS.
This may not work for you, but it does work for me. I found these tips awhile ago and don't remember where I found them.
NOTE: Notice the paths in the commands below - They differ from the original post.
Boot into clockwork recovery and launch adb shell.
Execute the following:
Code:
2. Install and run
3. allow it to download and install new hosts file, it will copy it to your sdcard and try to replace /system/etc/hosts but fail (it should reboot the phone shortly)
4. Power off the phone and hold Volume Down and power.
5. Use volume down to select recovery
6. In clockwork recovery volume down to "partitions menu" and hit the track pad to select
7. Select "mount /system" and "mount /sdcard" "mount /data"
8. Plug in your usb cord and open a command line on your pc
9. enter adb shell and type the following commands
cp /sdcard/hosts /data/hosts
rm /system/etc/hosts
ln -s /data/hosts /system/etc/hosts
Note the last command, that it a lowercase L not an I
a couple of others have made that mistake (for best results copy each command to your clipboard and paste it into your command prompt).
Reboot the phone and it should work now.
Use BTC IP and do not check symlink from /data/data/hosts
gadget!
Click to expand...
Click to collapse
This worked perfectly for me. Thanks.

[GUIDE] Internal Memory Data Recovery - Yes We Can!

This method does not seem to work on newer phones that apply TRIM or some other type of partition clearing implementation. If anyone has recovered their data on a device newer than Android 4.3 please pm me and let me know.
The Preamble
Did you delete all your SDCard data?
Are you pissed because no one told you before you unlocked your bootloader what would happen?
Did you lose valuable pictures of cats doing wondrously funny things? :laugh:
Well now there's a convenient new way for you to get that data back Buckaroo!
The Problem
Internal Memory doesn't mount as a drive like external memory does. External memory would allow you to use data recovery tools that scan for deleted files and return them to a usable state. These tools work because most operating systems don't go through and set all of those 1's and 0's to just 0's when you delete a file. Usually the operating system will just delete the reference pointer in the index that says that a file exists with such-and-such name and it's located at this position on the hard disk / memory location. There are destructive delete tools out there that will overwrite the spot of a deleted file multiple times to discourage recovery in just this manner. The issue is that data recovery tools need an actual mounted drive in order to dig deep and unearth those funny pictures of cats you so tragically deleted by accident. These newest batches of phones don't have external SDcards which are super easy to mount as drives. Internal memory mounts as MTP/PTP which is not treated as a mounted drive and cannot be scanned by these data recovery tools. But, cry no more cream-puff! :crying:
The Process
My phone is the Samsung Galaxy Nexus (toro) though I imagine this should work for ANY phone with Internal Memory. We will be using a Windows 7 machine to:
back up the entire internal memory partition to your computer as a single, massive .RAW file,
convert the .RAW file output to a VHD,
mount the VHD as a disk in Disk Manager,
scan the attached VHD volume for files that have been deleted and recover them,
?
profit! :good:
The Requirements
A rooted Android phone, (try to root with a non-destructive method as this appears to protect those who must root from wiping the device data a second time),
BusyBox installed on your device,
Cygwin installed to [c:\cygwin] with pv and util-linux from the repo. Make sure to open Cygwin once to make sure that the /bin folder is created. Also, I made a folder at [c:\cygwin\nexus] to put the exported .RAW file,
Netcat (download the ZIP file and extract nc.exe to [c:\cygwin\bin]),
ADB (make sure adb.exe is in your path),
USB Debugging enabled on your device,
VHD tool from the mighty M$. Put the VhdTool.exe file in [c:\cygwin\nexus],
Piriform Recuva or your favorite data recovery tool, (it appears Recuva only finds the more common file types like images, videos, etc. Those were the file types in which I was interested. If you are after more exotic file types perhaps you might share the software you used.)
A calm sense of peace and serenity that you will get your files back... :fingers-crossed:
The Work
*****Based on the number of people having trouble with this step it is now my recommendation that you choose to recover your entire memory block instead of just the data partition. In my phone's case that is mmcblk0. Please discover if yours is different.***** Identify which block/partition you want to recover. For our purpose here we are seeking to recover the userdata partition: /dev/block/mmcblk0p12
Turn on your phone
Connect the phone in ADB mode
Unlock the screen.
Open a Cygwin terminal and enter (This assumes your BusyBox installation is at [/system/bin/busybox]. It may be at [/system/xbin/busybox]):
Code:
adb forward tcp:5555 tcp:5555
adb shell
/system/bin/busybox nc -l -p 5555 -e /system/bin/busybox dd if=/dev/block/mmcblk0p12
Open another Cygwin terminal and enter:
Code:
adb forward tcp:5555 tcp:5555
cd /nexus
nc 127.0.0.1 5555 | pv -i 0.5 > mmcblk0p12.raw
Run around the house a few times. For 32GB internal memory this is going to take 3+ hours. That's a lot of running. When it's done...
We need to convert the .RAW file to a virtual hard drive. VhdTool.exe basically just puts a VHD footer on the end of the .RAW file. Open a Windows command prompt, go to [c:\cygwin\nexus], and type:
Code:
VhdTool.exe /convert mmcblk0p12.raw
Now we need to mount the VHD in Windows. Select the Start button-->right-click Computer-->select Manage.
Select Storage-->Disk Management.
In the menu select Action-->Attach VHD.
For Location enter [c:\cygwin\nexus\mmcblk0p12.raw] and select the OK button.
Right-click on the name (e.g. "Disk 1") to the left of the Unallocated space and select Initialize Disk.
Select the GPT (GUID Partition Table) radio button and select the OK button.
Right-click on the Unallocated space and select New Simple Volume...
In the Wizard select Next>, leave the default for the volume size, select Next>, select a drive letter (e.g. K), select Next>, MAKE SURE to select the 'Do not format this volume' radio button, select Next>, select Finish.
A box will pop up asking you to format the drive. You DO NOT want to format the drive at this time.
Right-click on the RAW space and select Format... MAKE SURE to change the File system to FAT32. Set the Allocation unit size dropdown to 'Default.' MAKE SURE that the Perform a quick format checkbox is CHECKED. You do not want to overwrite the entire new drive with all zeroes (0's) and destroy your data. Quick Format means that it will only attempt to destroy the index for the drive by establishing a new index. Without this box checked the Windows operating system will write zeroes (0's) across the entire volume, potentially destroying your data. Select the OK button.
A box will pop up saying that Formatting this volume will erase all data on it. That would be doubly true if you actually didn't check the 'Perform a quick format' checkbox. Double check that you actually did check the box and select the OK button. (Don't worry. This essentially leaves the volume in the exact same state that your phone's internal memory is living in right now: there is data on the drive...you just can't see it. It's coming back, I promise!)
Open the Piriform Recuva application. In the wizard select the 'Next >' button. Select the 'Other' radio button and select Next >. Select the 'In a specific location' radio button and enter: k:\ (assuming K is the drive letter you chose...) Select the Next > button. Select the Enable Deep Scan checkbox. This is the magical setting that finds files that have been deleted...but not really deleted. Select the Start button.
The application may take about an hour to do the 'Deep Scan.' It's time for more laps around the house! Once the application has returned its results you can choose which files to recover using the checkboxes. Select the 'Recover...' button and choose the location to which you wish to output your files.
?
Profit! :victory:
The Appendix
The following links helped me to create this modern marvel - mad props to scandiun! :
[GUIDE] How to make a nandroid backup directly to your computer without using sdcard
[Info] List of Samsung Galaxy Nexus GT-I9250 devices and partitions
How to Create and Attach a Virtual Hard Disk in Windows 7
Good luck!
I forgot to mention, but run commands inside android as superuser or may fail (just after adb shell):
Code:
adb forward tcp:5555 tcp:5555
adb shell
[B]su[/B]
/system/bin/busybox nc -l -p 5555 -e /system/bin/busybox dd if=/dev/block/mmcblk0p12
And greetings for the guide, I didn't know of VHD Tool, congratulations!.
Great Work
scandiun said:
I forgot to mention, but run commands inside android as superuser or may fail (just after adb shell):
Code:
adb forward tcp:5555 tcp:5555
adb shell
[B]su[/B]
/system/bin/busybox nc -l -p 5555 -e /system/bin/busybox dd if=/dev/block/mmcblk0p12
And greetings for the guide, I didn't know of VHD Tool, congratulations!.
Click to expand...
Click to collapse
Good and informative tutorial indeed. Thanks though.
Good point...
scandiun said:
I forgot to mention, but run commands inside android as superuser or may fail (just after adb shell):
Code:
adb forward tcp:5555 tcp:5555
adb shell
[B]su[/B]
/system/bin/busybox nc -l -p 5555 -e /system/bin/busybox dd if=/dev/block/mmcblk0p12
And greetings for the guide, I didn't know of VHD Tool, congratulations!.
Click to expand...
Click to collapse
Thank you again scandiun
You may be right about the superuser command: su
For my part I did not have to use it but I'm sure it wouldn't hurt to run as su. Some systems may actually need it though.
Here's hoping...
oliverpowell said:
Good and informative tutorial indeed. Thanks though.
Click to expand...
Click to collapse
Thank you oliverpowell
I just hope the people who need this actually find it before they give up and start overwriting their lost data. Even having to get root access may cause a certain amount of data loss for some. Thankfully I was already rooted and already had busybox....
YOU..
YES YOU....!!!!!
WHERE HAVE YOU BEEN ALL MY LIFE?
s*it mate, i wish this thread comes earlier...
i lost my precious files on sdcard about 3 months ago when unlocking bootloader.
um..
anyway do you have any idea how to make files from computer back to internal memory,
but without changing the date modified timestamp?
i'm using adb push for that, but that's painfuly slow..
while mtp transfer messed up the date modified.
thanks, bookmarked.
just in case i do something stupid next time..
Not many options...
marhensa said:
um..
anyway do you have any idea how to make files from computer back to internal memory,
but without changing the date modified timestamp?
i'm using adb push for that, but that's painfuly slow..
while mtp transfer messed up the date modified.
Click to expand...
Click to collapse
I'm afraid painfully slow is probably the only option, just like my step that takes three hours. Start it and go build a birdhouse or window box for flowers....it's going to take a while.
I'm sorry you lost files. It's very sad to hear some of the stories of people losing pictures of their children's birth, or the last pictures of their husband going to Afghanistan... and not returning.
I'm hoping that this approach or one like it can be made popular. It needs to get out there.
I've also linked this thread and scandiun's thread in the second post of this sticky thread.
Nice!
efrant said:
I've also linked this thread and scandiun's thread in the second post of this sticky thread.
Click to expand...
Click to collapse
It looks good! Thank you.
Thanks for this tutorial. :good: It worked as indicated. I just wish I knew earlier as I had been trying for the past few days to use recovery tools and trying to make the internal drive USB Mass Storage capable when all this time there was this tutorial. Unfortunately, it only returned a dozen photos. Thanks again for this tutorial... this should be spread across xda forums for any others running into these issues.
xda_toronto said:
Thanks again for this tutorial... this should be spread across xda forums for any others running into these issues.
Click to expand...
Click to collapse
Agreed - lol
Firstly, I only recently created this guide. I'm sorry you lost files
Secondly, I attempted to link to older threads that mention the same issue so that they would be more likely to show up in a future Google search but I was scolded for waking up old threads, which makes sense. I just thought this was a rather seriously important issue that deserves a lot of eyes. Loss of personal photos is a little more significant than troubleshooting a bad ROM flash, IMO. But the Mod correctly canceled those other posts. It is a little douchey to try to increase a post count by linking all over to a single (my first, really) post. However, I couldn't give less of a pbbbttt about post counts. If you don't mind me asking, how did you find this thread?
Lastly, if you add it to your sig then this will show up on all of your posts...just sayin'...
I'm glad it at least helped you get 12 pics back...
Proplem
Sir .. I'm facing problem .. it won't receive any data from 5555 port .. I tried to make it copy the RAW file but it stopped without getting any data .. is that normal ?? see the picture attached
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
I have a question. Let's say we don't want somebody to ever use this guide to recover our stuff after we sell them a phone. What's the most secure and thorough way to destroy all data on the Gnex, making it impossible to recover, short of destroying the phone?
Med1a said:
Sir .. I'm facing problem .. it won't receive any data from 5555 port .. I tried to make it copy the RAW file but it stopped without getting any data .. is that normal ?? see the picture attached
Click to expand...
Click to collapse
i have the same problem
A couple things from you screenshots...
Med1a said:
Sir .. I'm facing problem .. it won't receive any data from 5555 port .. I tried to make it copy the RAW file but it stopped without getting any data .. is that normal ??
Click to expand...
Click to collapse
Did you try without using su command? Also where is busybox installed? /system/bin or /system/xbin?
CADude said:
I have a question. Let's say we don't want somebody to ever use this guide to recover our stuff after we sell them a phone. What's the most secure and thorough way to destroy all data on the Gnex, making it impossible to recover, short of destroying the phone?
Click to expand...
Click to collapse
If you use the erase command in fastboot, it should work (i.e., "fastboot erase userdata"), otherwise, flashing the stock userdata image will do the trick (i.e., "fastboot flash userdata userdata.img") <-- this writes a blank image in the userdata partition.
...well, that's a good question!
CADude said:
I have a question. Let's say we don't want somebody to ever use this guide to recover our stuff after we sell them a phone. What's the most secure and thorough way to destroy all data on the Gnex, making it impossible to recover, short of destroying the phone?
Click to expand...
Click to collapse
I would imagine you could do this guide, use a Guttman algorithm wipe utility on the attached VHD and then figure out a way to push the entire VHD back to the phone. Unfortunately, that may not actually overlay the physical phone memory in the same way. Perhaps you could wipe the VHD again and push it again, and then again...?
I want to say that someone asked the question on scandiun's post too. Go see if they figured out how to push back to the phone.
Good luck
Wartickler said:
Did you try without using su command? Also where is busybox installed? /system/bin or /system/xbin?
Click to expand...
Click to collapse
busy box installed properly in the right directory
su command used
Med1a said:
Sir .. I'm facing problem .. it won't receive any data from 5555 port .. I tried to make it copy the RAW file but it stopped without getting any data .. is that normal ?? see the picture attached
Click to expand...
Click to collapse
hetunandu said:
busy box installed properly in the right directory
su command used
Click to expand...
Click to collapse
When running su check on phone that permissions are granted. Furthermore using absolute paths is for when you are running it from clockworkmod recovery. If the phone is powered on you can use
Code:
adb forward tcp:5555 tcp:5555
adb shell
su
nc -l -p 5555 -e dd if=/dev/block/mmcblk0p12
Open another Cygwin terminal and enter:
Code:
adb forward tcp:5555 tcp:5555
cd /nexus
nc 127.0.0.1 5555 | pv -i 0.5 > mmcblk0p12.raw
If you are still having problems you can try the command within the phone only and see if dd works:
Code:
adb shell
su
dd if=/dev/block/mmcblk0p10 of=/dev/null
Also, make sure you run all the commands in the two terminals each time and in the proper order, if you are not sure cancel with Control+C and close them and restart again.
For those who want to try backing up the partition via wifi, you can send it via ftp. Read this post:
http://forum.xda-developers.com/showthread.php?p=27793062#post27793062
Don't use su...?
hetunandu said:
busy box installed properly in the right directory
su command used
Click to expand...
Click to collapse
Please try no su exactly as in the first post.
Did you follow the steps exactly? I can only say they worked for me ):
What phone do you have?

[modules] cifs.ko, md4.ko, nls_utf8.ko, stock [4.2 / 4.2.2] 3.4.5-g4e6298b / gaf9c307

I have managed to get CIFS working on stock Nexus 10.
It's quite a bit more problematic on the Nexus 10 than normal.
There are 2 main issues to deal with. Newer versions of the Linux kernel require a UNC variable to be passed to them and the current version of busybox doesn't do this. There is a patch out. I have extracted the patched busybox binary from craigacomez's AOSP Nexus 10 rom.
(Check it out here: http://forum.xda-developers.com/showthread.php?t=1998585 ). Otherwise it should work on the stock mount command if you specify the unc= mount option with the share.
The other issue is the multiuser stuff. If you execute the mount command from inside Terminal Emulator (or a script program) it looks like it mounts ok and you can 'ls' in the directory but it doesn't work for Android apps, they just see an empty directory but if you do it via a 'adb shell' it works fine in Android apps. My theory is ADB is outside of the multiuser stuff. adb actually ships on the device.
1) Unlock bootloader (fastboot oem unlock)
2) Flash recovery adb flash recovery whatever.img
3) Root device (flash CWM-SuperSU-0.98.zip)
4) Install BusyBox (from the market)
5) Copy md4.ko and cifs.ko to device. The files can go anywhere you like. In this example I will just use the root of the sdcard. Some people like them in /system/modules or /system/lib/modules
6) busybox mount -o rw,remount /
7) adb shell
8) Override /system/bin/busybox with the patched version (maybe move it first so it's backed up).
9) insmod /sdcard/md4.ko
10) insmod /sdcard/cifs.ko
11) busybox mount -t cifs -o username=MYUSER,password=MYPASS,unc=\\\\192.168.1.1\\storage //192.168.1.1/storage /data/media/0/cifs/Storage
You will need to manually preform the last 3 commands each time you reboot the device from a adb shell.
NOTE: You can probably get rid of the -o flags completely. In theory the patched version of busybox makes the UNC bit redundant. Possibly you can use the stock busybox with the UNC flag and avoid using the patched one totally. I have just included it to be sure.
Make sure you type 'busybox mount' not 'mount', by default they are different binaries. Otherwise you can remove the /system/bin/mount command and make a new one linking /system/bin/mount to /system/bin/busybox.
Possibly there is some way to get the mount working in the multiuser environment without requiring busybox. If you figure it out please tell ☺
Some threads on the issue:
http://forum.xda-developers.com/showthread.php?p=34397868#post34397868
http://forum.xda-developers.com/showthread.php?t=733490&page=6
http://www.mail-archive.com/[email protected]/msg17650.html
The modules are for 3.4.5-g4e6298b.
EDIT: I added nls_utf8.ko by request
EDIT2: Since adb comes on the device, it is possible to use it to connect to local host:
1) Install cifs modules to /system/lib/modules
2) Install Script Manager from the play store
3) Copy script to device
4) Start SManager
5) Find your script and open it.
6) Tick the su box
7) Hit save
8) Goto home sccreen
9) Add a 'SMShortcuts' widget to your home screen
10) "Add one script shortcut"
11) Choose your script
12) Optionally use this pretty icon ☺
13) Give it a nice name like "Mount Shares"
Here is a shell script...
Code:
#!/system/bin/sh
# Your settings here
USERNAME="USERNAME"
PASSWORD="PASSWORD"
IPADDRESS="192.168.1.1"
SHARE="storage"
MOUNT_POINT="/data/media/0/cifs/Storage"
# If you need to change the mount command edit this
MOUNT_CMD="\
mount -t cifs \
\
-o \
user=$USERNAME,\
password=$PASSWORD,\
unc=\\\\\\\\\\\\\\\\$IPADDRESS\\\\\\\\$SHARE \
\
//$IPADDRESS/$SHARE \
$MOUNT_POINT"
COMMANDS="\
insmod /system/lib/modules/md4.ko; \
insmod /system/lib/modules/nls_utf8.ko; \
insmod /system/lib/modules/cifs.ko; \
$MOUNT_CMD
"
# Starting ADB...
PORT=`getprop service.adb.tcp.port`
setprop service.adb.tcp.port 5555
adb kill-server
adb start-server
stop adbd
start adbd
adb connect localhost
# Make sure we only use the first device (sometimes there is more than one)
SERIAL=`adb devices | head -n2 | tail -n1 | cut -f1`
if [ "$SERIAL" = "" ] ; then
echo "ERROR: Could not find ADB device.";
fi
echo Mounting share via adb...
adb -s $SERIAL shell su root -c "$COMMANDS"
# If you started adb, then stop it here for security:
adb disconnect localhost
stop adbd
setprop service.adb.tcp.port $PORT
start adbd
RESULT=`mount | grep $MOUNT_POINT`
if [ "$RESULT" = "" ] ; then
echo "Mounting failed..."
else
echo "Mounting sucess!"
fi
echo Done... You may close this script window.
EDIT3: Added usbserial.ko, option.ko and usb_wwan.ko
EDIT4: Some users have reported that the need to modify the script to get it working with their version of SU.
EDIT5: I have uploaded modules for 4.2.2, kernel 3.4.5-gaf9c307 but I haven't actually tested them myself (still on 4.2.1). Apparently the adb loophole has also been patched but it is possible to reenable it by putting a RSA key onto the device. Check out this set of instructions here.
EDIT6: I have updated to 4.2.2 on my Nexus 10 and can confirm the new modules work.
You must setup the adbkey or you will get a "device: offline" message. By default adb when adb first runs it tries to create the keys in the $HOME dir which is /data/.android, but the data directory isn't accessible by the 'shell' user.
I got it working simply by setting the HOME variable to /sdcard and restarting the adb server in the script then Android popped up a query (I have update the script above).
IMPORTANT: The Android Media scanner recursively scans folders for media to add the the database so it shows up in programs like Google Music. On large shares this can be a long process and use heaps of battery life. To prevent this add a blank file with the name ".nomedia" to the root of your mount points (or each individual share if you aren't used 1 folder for all your mounts). This will stop music showing up in programs though.
If you find that the device stops responding (the launcher might work but apps fail to load) or you get reboots (often after the previous bug) this is probably due to a bad wifi connection.
Is it posible to make a CWM flash file?
Great
This is great progress, do you know if there is some way I can use the same to mount my usb OTG with ADB shell so that I can read/write to my pen drives from my android apps/file managers?
I have tried using the busybox mount but that didn't work, do I need the modified mount or will none of this help anyway?
alias_neo said:
This is great progress, do you know if there is some way I can use the same to mount my usb OTG with ADB shell so that I can read/write to my pen drives from my android apps/file managers?
I have tried using the busybox mount but that didn't work, do I need the modified mount or will none of this help anyway?
Click to expand...
Click to collapse
Code:
busybox mount -t FSTYPE /dev/block/sda1 MOUNT_LOCATION
Example:
Code:
busybox mount -t vfat /dev/block/sda1 /storage/sdcard0/usbotg
craigacgomez said:
Code:
busybox mount -t FSTYPE /dev/block/sda1 MOUNT_LOCATION
Example:
Code:
busybox mount -t vfat /dev/block/sda1 /storage/sdcard0/usbotg
Click to expand...
Click to collapse
How is this different to what I'm doing already? Mounting this way doesn't work, only the process that mounted it can see the files.
Although I don't have nexus 10, I am having the similar mounting issue on my nexus 7 until I saw this post.
Advise about "adb shell" really helps me resolve the multiuser issue.
Thanks for sharing.
Any chance you could post the nls-utf8.ko for utf8 support?
Thanks!
H3g3m0n said:
1) Unlock bootloader (adb oem unlock)
Click to expand...
Click to collapse
Isn't it fastboot that unlocks the bootloader, and not adb? (unless adb can do it too; I've only heard of fastboot though)
momulah said:
Is it posible to make a CWM flash file?
Click to expand...
Click to collapse
Not a high priority right now as currently you need to do the manual adb shell stuff by hand to get things mounted, a little extra setup work isn't a huge difference.
alias_neo said:
How is this different to what I'm doing already? Mounting this way doesn't work, only the process that mounted it can see the files.
Click to expand...
Click to collapse
Are you mounting in a 'adb shell' or locally in something like terminal emulator? My OTG cable won't be here for a while so I can't really test myself.
weasal said:
Any chance you could post the nls-utf8.ko for utf8 support?
Thanks!
Click to expand...
Click to collapse
Posted, haven't tested it but it seemed to insmod fine.
espionage724 said:
Isn't it fastboot that unlocks the bootloader, and not adb? (unless adb can do it too; I've only heard of fastboot though)
Click to expand...
Click to collapse
Yeh typoed, i'll fix that now.
Currently I'm thinking of ways to hack around the 'adb shell' requirement, as a basic hackish fix would be to make a program that turns on adb wireless, connects to the local device and issues a command. Of course possibly there is a 'proper' way to do mounting. Another lazy way for those with their shares on a Linux system would be a script issue commands to the server via a ssh, getting it to log back into the phone and mount stuff over adb wireless.
alias_neo said:
How is this different to what I'm doing already? Mounting this way doesn't work, only the process that mounted it can see the files.
Click to expand...
Click to collapse
I've been working on getting OTG support natively in my AOSP based custom ROM and I have had some success... check out my ROM for details
H3g3m0n said:
Currently I'm thinking of ways to hack around the 'adb shell' requirement, as a basic hackish fix would be to make a program that turns on adb wireless, connects to the local device and issues a command. Of course possibly there is a 'proper' way to do mounting. Another lazy way for those with their shares on a Linux system would be a script issue commands to the server via a ssh, getting it to log back into the phone and mount stuff over adb wireless.
Click to expand...
Click to collapse
Just wanted to thank H3g3m0n as I was able to successfully mount over adb. Also came up with a workaround to bypass connecting to a PC, grabbed the arm fastboot binary from this thread and installed it on my nexus 7. Used it to connect wireless adb on the 10 and ran the mount commands on the 7.
H3g3m0n said:
Posted, haven't tested it but it seemed to insmod fine.
Click to expand...
Click to collapse
Thanks, I'll give it a try!
You might find my posts #156 and #162 at http://forum.xda-developers.com/showthread.php?t=1781411&page=17 helpful.
Sorry for the noob ? ...
What are the KO's do?
What is the practical use of then.
Sorry I did a little research on then but I could not find an answer in layman terms
Thank you for allowing me to learn.
Sent from my toroplus using xda premium
spdwiz18 said:
Sorry for the noob ? ...
What are the KO's do?
What is the practical use of then.
Sorry I did a little research on then but I could not find an answer in layman terms
Thank you for allowing me to learn.
Sent from my toroplus using xda premium
Click to expand...
Click to collapse
http://en.wikipedia.org/wiki/Loadable_kernel_module
craigacgomez said:
http://en.wikipedia.org/wiki/Loadable_kernel_module
Click to expand...
Click to collapse
That helps allot.... Now i have an understanding of ko's in general. But what specificly do the modules this thread refers to do and the practical use of then. Thanks foot the help.
Sent from my toroplus using xda premium
spdwiz18 said:
That helps allot.... Now i have an understanding of ko's in general. But what specificly do the modules this thread refers to do and the practical use of then. Thanks foot the help.
Sent from my toroplus using xda premium
Click to expand...
Click to collapse
These modules are needed to enable support for CIFS (Windows share) mounts...
spdwiz18 said:
That helps allot.... Now i have an understanding of ko's in general. But what specificly do the modules this thread refers to do and the practical use of then. Thanks foot the help.
Sent from my toroplus using xda premium
Click to expand...
Click to collapse
Basically you can setup a shared folder from a remote computer. It allows you to have files on another system accessible as if it was part of the internal storage in the device.
Just found out that Android ships with the adb binary on the device itself (after crosscompiling it myself :/, oh well the experience was useful).
It should be possible to setup a script to start the adb server, connect to the localhost and execute the mount without too much difficulty.
Ok, added a script and instructions to the front page for simple on tablet mounting.

MTP problem

I have problems with connecting my mobile phone with other devices after introducing MTP connection - when I am pluging t989 into tv, there is a info about problems with recognizing the device, the same prompt is on other devices such like Satelite receiver, etc. Earlier when I had usb storage connection I didnt have such problems. Can sb help me with that ?
sony11 said:
I have problems with connecting my mobile phone with other devices after introducing MTP connection - when I am pluging t989 into tv, there is a info about problems with recognizing the device, the same prompt is on other devices such like Satelite receiver, etc. Earlier when I had usb storage connection I didnt have such problems. Can sb help me with that ?
Click to expand...
Click to collapse
This is possible to fix with some ROM/Kernel pairs, but not all.
you need to run a series of commands to prepare things for "mass storage" mode, and then run a different set of commands before removing it to prevent data corruption and data mismatch. I have found that if you add files while in this "pretend mass storage" mode, you sometimes need to reboot for them to sync up properly.
all of the commands need to be run as root.
first you need to put your phone into mass storage mode by running:
setprop sys.usb.config mass_storage
if you need adb access, run the command as:
setprop sys.usb.config mass_storage,adb
then you need to tell the system where to "look" for the mass storage devices. I will include the optional steps too (mounting the sd cards in RO mode to prevent both systems writing to the card at once which will likely cause corruption):
mount -o remount,ro /storage/sdcard0
mount -o remount,ro /storage/sdcard1
echo /dev/block/vold/179:97 > /sys/class/androd_usb/android0/f_mass_storage/lun/file
echo /dev/block/vold/179:28 > /sys/class/android_usb/android0/f_mass_storage/lun_ex/file
when you are done with your mass storage stuff, you will need to run the following to remove these shares:
echo "" > /sys/class/androd_usb/android0/f_mass_storage/lun/file
echo "" > /sys/class/android_usb/android0/f_mass_storage/lun_ex/file
mount -o remount,rw /storage/sdcard0
mount -o remount,rw /storage/sdcard1
I have not (yet) tested this on a KK ROM, but it works nicely on hellybean with Diablo or Uber kernels. Technically, I suppose you wouldn't need to run the remounts, but I recommend it as you don't want a corrupted filesystem. And technically I guess you don't need to blank out the "file" afterwards, but I do as I don't want android thinking I'm still connected when I'm not.
I personally don't like MTP as it doesn't play as nice with other older devices as mass_storage, but mass_storage doesn't allow both the android phone and windows/mac/linux/etc to preform RW operations at the same time without a high risk of data corruption.

Data Recovery via Download Mode

Afternoon all,
My G4 has hit the bootloop for the last few days. Periodically, it has powered up to the main screen, but not for long enough for me to recover data.
I just spoke to a data recovery place that told me that if I can put my phone into download mode, they can recover the data. Lo and behold, my phone is currently next to me in download mode!
I'm quite keen to avoid dropping that amount of money if possible, so does anyone know of a way to recover the internal memory of the phone via download mode?
Apologies if I'm duplicating a previous thread - I had a quick look, but couldn't see any with the same issue.
Probably when the phone is in download mode they can copy the partitions bit by bit then try to do data recovery from those partition images.
So if the phone doesn't boot, it doesn't mean the data partition is corrupted so in theory you could try to copy the data partition and mount it and see what files you can recover.
I do not know the exact commands to dump the data partition but I think that's the way it can be done.
Anyone else willing to give a hand here?
Thanks for the help so far. I believe the data is intact - when the phone starts up, the data is all there. It's just accessing it that is the issue.
Sent from my Nexus 5 using Tapatalk
something similar to
Code:
dd if=/dev/block/mmcblk0p55 bs=8192 skip=65536 count=548352 of=/mnt/media_rw/external_SD/data.img
OR
Code:
dd if=/dev/block/mmcblk0p55 bs=8192 skip=65536 count=548352 of=/dev/block/mmcblk1/data.img
don't quote me on that but in theory this should work...
make SURE you have a 32gb SDCard in the phone first
Where would that command be entered mate? Sorry, only ever used my phone stock before.
Sent from my Nexus 5 using Tapatalk
I thought the OP title said download mode?
Use the LG Root method as if you were going to root..
I'm mobile ATM but if I remember correctly...
Send_Command \\.\Com# [# meaning your com port number]
Then insert that command.
Tomorrow at work I can get a common list of partition names and the command to back it up with.
je2854 said:
I thought the OP title said download mode?
Use the LG Root method as if you were going to root..
I'm mobile ATM but if I remember correctly...
Send_Command \\.\Com# [# meaning your com port number]
Then insert that command.
Tomorrow at work I can get a common list of partition names and the command to back it up with.
Click to expand...
Click to collapse
You need to mount the partition first.
Also, you could mount data if it is not encrypted (is it?)
Do this:
Code:
mkdir /temp
mkdir /temp/sd /temp/data
mount /dev/block/mmcblk1p1 /temp/sd
mount /dev/block/bootdevice/by-name/userdata /temp/data
mkdir /temp/sd/recoverydata
cp -R /temp/data/media/ /temp/sd/recoverydata/
A little tip that should work :
Take the battery off your phone
Put both phone and battery in the fridge
Wait till the phone is cold and boot the device.
The bootloop trouble is due to an abnormal warm so this way you can have a one shot normal boot to backup your data before send for warranty.
terisse said:
A little tip that should work :
Take the battery off your phone
Put both phone and battery in the fridge
Wait till the phone is cold and boot the device.
The bootloop trouble is due to an abnormal warm so this way you can have a one shot normal boot to backup your data before send for warranty.
Click to expand...
Click to collapse
If you try this, please put the phone in a ziploc bag 1st and seal it so humidity won't get inside the phone while in the fridge.
nagalun said:
You need to mount the partition first.
Also, you could mount data if it is not encrypted (is it?)
Do this:
Code:
mkdir /temp/sd /temp/data
mount /dev/block/mmcblk1p1 /temp/sd
mount /dev/block/bootdevice/by-name/userdata /temp/data
mkdir /temp/sd/recoverydata
cp -R /temp/data/media/ /temp/sd/recoverydata/
Click to expand...
Click to collapse
just a question though... How can you use this command if it will not boot?
---------- Post added at 08:59 AM ---------- Previous post was at 08:50 AM ----------
to get into download mode do the following...
Pull Battery
Hold Volume Up
Plug in USB Cable (make sure it's plugged in the computer)
Release button after 5 seconds
follow the link to grab the files needed for "Send_Command"
Grab LG Root here
once you are in the mode and you followed directions you can copy the command I wrote
above to copy your data partition. The reason you must have a 32gb+ SDCard is you will
be making an exact copy of the /data partition where you can remove the SDCard and recover
whatever is needed.
je2854 said:
just a question though... How can you use this command if it will not boot?
Click to expand...
Click to collapse
Hmm... With the Send_Command.............? dd is a command too :silly:
nagalun said:
Hmm... With the Send_Command.............? dd is a command too :silly:
Click to expand...
Click to collapse
there is no need to mount the partition first..
the dd command will copy the partition as a RAW image.
you must then take it to a computer and mount it as an EXT4 or use it with ext2explore
je2854 said:
there is no need to mount the partition first..
the dd command will copy the partition as a RAW image.
you must then take it to a computer and mount it as an EXT4 or use it with ext2explore
Click to expand...
Click to collapse
in that case the command you have given him will copy 4492 mb only.
Here is why:
Code:
dd if=/dev/block/mmcblk0p55 bs=8192 skip=65536 count=548352 of=/dev/block/mmcblk1/data.img
input_file=(some partition) block_size=8192 skip_this_much_data=65536 how_many_data=548352 output_file=(somewhere)
actual data copied is 8192 * 548352 = 4492099584 bytes, and you are skipping some data from the beggining with 'skip'
you do still need to mount the sdcard, the "mmcblk1" is not treated as a directory, and it is very unlikely the sd card is mounted automatically in download mode.
nagalun said:
in that case the command you have given him will copy 4492 mb only.
Click to expand...
Click to collapse
remember me saying (if you read) above that I said "something similar to"
Hi all. Firstly, thanks for all your responses!
I've not got much of a clue what I'm doing unfortunately, I've never really messed with Android before - I'm typically fairly computer literate, but I've steered clear of messing with and rooting phones for the most part.
So to clarify, I've downloaded LG Root, Running either of the exes just leads to a cmd box that's open for about a second before closing, so I'm presuming I've missed a step. Is there a guide already in existence on how to use it?
But once in, ensure there's a sizeable Micro SD card in (it's a 64gb so I should be okay!) and use the send_command exe to send:
Code:
mkdir /temp/sd /temp/data
mount /dev/block/mmcblk1p1 /temp/sd
mount /dev/block/bootdevice/by-name/userdata /temp/data
mkdir /temp/sd/recoverydata
cp -R /temp/data/media/ /temp/sd/recoverydata/
And then the entire image should be on the Micro SD card.
How would I then mount the data image to be readable? I've only used .iso for mounting before.
Apologies for my ignorance - I'm probably making helping me quite difficult!
Sorry all, correction to my previous:- Do I basically follow http://forum.xda-developers.com/android/development/guide-root-method-lg-devices-t3049772
And replace step 10 with the above command?
Shift+Right Click the folder you extracted "open command prompt here" for starters...
Run ports.bat first...
It'll tell you your DIAG and communication port...
The second com port is the one you are looking for.
Send_Command \\.\Com"#" (don't insert quotes, # being the number you found)
je2854 said:
Shift+Right Click the folder you extracted "open command prompt here" for starters...
Run ports.bat first...
It'll tell you your DIAG and communication port...
The second com port is the one you are looking for.
Send_Command \\.\Com"#" (don't insert quotes, # being the number you found)
Click to expand...
Click to collapse
I'm having the same issue and actually tried this earlier today. Ports.bat didn't show a DIAG communication port even when I had the phone stably sitting in Download Mode.
Going to try the freezer trick. I already bought a Nexus 6P, just want to unlock the locked content on my SD card. lol.
EDIT: Holy crap! It worked. I chilled it in a baggie, then stood in front of the freezer as I unlocked all of my locked gallery files (1,411 files totaling 900MB). As soon as I was done, 30 seconds after stepping away from the freezer, it started to bootloop again.
Got the only information I needed off my phone...nice! I might give it another go tomorrow and see if I can't run ROM Toolbox and backup all my apps so it'll be easier to push to my N6P.
Awesome suggestion!
IlyaKol said:
I'm having the same issue and actually tried this earlier today. Ports.bat didn't show a DIAG communication port even when I had the phone stably sitting in Download Mode.
Going to try the freezer trick. I already bought a Nexus 6P, just want to unlock the locked content on my SD card. lol.
EDIT: Holy crap! It worked. I chilled it in a baggie, then stood in front of the freezer as I unlocked all of my locked gallery files (1,411 files totaling 900MB). As soon as I was done, 30 seconds after stepping away from the freezer, it started to bootloop again.
Got the only information I needed off my phone...nice! I might give it another go tomorrow and see if I can't run ROM Toolbox and backup all my apps so it'll be easier to push to my N6P.
Awesome suggestion!
Click to expand...
Click to collapse
Mine will only get to optimising Apps, even if still in the freezer.
Sent from my Nexus 5 using Tapatalk
Hi all, sorry for the double posting, but just to make certain before I do something that will accidentally brick my phone. I'm intending to do the following:
Put phone in download mode and connect device.
Open LG_Root folder
Run a command window in LG_Root
Code:
Send_Command.exe \\.\Com4
Then, line by line, command:
Code:
mkdir /temp/sd /temp/data
mount /dev/block/mmcblk1p1 /temp/sd
mount /dev/block/bootdevice/by-name/userdata /temp/data
mkdir /temp/sd/recoverydata
cp -R /temp/data/media/ /temp/sd/recoverydata/
Once I've done all this, what happens next? Will I see responses on the screen etc?
Again, I apologise for the probably stupid questions. I don't want to brick my phone and lose all of the data, but I'm going away with work so would like to square it before I go if I can.
Many thanks to you all so far.

Categories

Resources