Android Debug Bridge(ADB) is usually used for debugging android devices. I personally use it to move files arround because mounting your sdcard can sometimes be a bitch. moving files around in command line isn’t fun too imagine typing the following:
adb push bla /sdcard/ultRa\ Long\ Directory/AnOther\ Long\Directory/bla
not fun…. so to solve this problem i wrote ADBFS. With adbfs, i can simply drag and drop files as usual.
Requirements
- *nix Os (or any os that support FUSE – i think windows has a port.. not sure)
- FUSE ( macfuse for mac users – windows, i don’t know.)
- android sdk from Android developers site
- git
Installation
git clone git@github.com:isieo/adbFS.git . cd adbFS make mv adbfs <location of android sdk>/tools/adbfs
Usage
mkdir ~/mounted-adb adbfs mounted-adb
done! enjoy drag and drop without needing to “mount” your sdcard to your machine.
Note: adbfs can be very very slow at times, this is because your file manager is trying to access all the files to get data from it. ADB was never designed to do this so its not fast. Also this program is a proof-of-concept if anyone have a better implementation, please suggest.
License
/* * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following disclaimer * in the documentation and/or other materials provided with the * distribution. * * Neither the name of the nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
Warning
Very experimental =P its usable though i use this regularly to modify my playlist file.


Calvin,
this seems to be very neat, just what I need.
However, it fails on Froyo FRG83, because the needed utils are not there, or not with the needed syntax:
laptop$ ./adb shell stat -t
stat: permission denied
laptop$ ./adb shell
$ su
# stat
stat: not found
^D
laptop$ ./adb shell ls -1a /
-1a: No such file or directory
config
cache
...
What kind of userspace do you have on your phone? Are these utils are shipped in some other version of Android? If these are not standard, wouldn’t it make sense to assume that the phone has busybox, and use busybox commands?
OK, worksfome like this:
diff --git a/adbfs.cpp b/adbfs.cpp
index 36d0278..acb6ac7 100644
--- a/adbfs.cpp
+++ b/adbfs.cpp
@@ -74,7 +74,7 @@ queue adb_shell(string command)
string_replacer(command,"%","\\%");
string_replacer(command,"=","\\=");
string_replacer(command,"~","\\~");
- actual_command = "adb shell ";
+ actual_command = "adb shell busybox ";
actual_command.append(command);
//actual_command.append("'");
You could make a mention of the utilities needed to get it running. And for ordinary people, the git command should be indeed
git clone git://github.com/isieo/adbFS.git
I have given it a try with a normal user with adbfs command. But the mount point can’t be accessed with that account, even though I try to unmount or remove it with root account.
The file system just shows like this
d????????? ? ? ? ? ? mounted-adb
Nobody can access it any more. I have to kill the adbfs daemon. But it still
can’t be accessed.
And good advice, thanks!
BR/JP
hm not sure what’s going on but if you need to unmount try
fusermount -u mountpoint
you shouldn’t need root
AFAIK you need root to install busybox.
fuse doesn’t need root
$ adbfs -d ~/mnt/adbfs
…
LOOKUP /.Trash-501
getattr /.Trash-501
stat -t “/.Trash-501″
unique: 12, success, outsize: 120
unique: 13, error: -2 (No such file or directory), outsize: 16
unique: 14, opcode: READDIR (28), nodeid: 1, insize: 80
unique: 14, success, outsize: 16
unique: 15, opcode: LOOKUP (1), nodeid: 1, insize: 71
LOOKUP /-1a: No such file or directory
getattr /-1a: No such file or directory
stat -t “/-1a: No such file or directory”
Segmentation fault
Android 2.2
Oh!
that was again the “adb shell busybox ” problem.
But the next problem is:
$ ls adbfs/
…
ls: cannot access adbfs/sbin: No such file or directory
ls: cannot access adbfs/sdcard: No such file or directory
ls: cannot access adbfs/sys: No such file or directory
ls: cannot access adbfs/system: No such file or directory
?[0;0mdefault.prop?[0m ?[1;34m.?[0m ?[1;34mproc?[0m
?[0;0mEUROPA.rle?[0m ?[1;34macct?[0m ?[1;34mroot?[0m
?[1;32minit?[0m ?[1;34mcache?[0m ?[1;34msbin?[0m
…
try csheemea’s patch, my code assumed that you have busybox installed and the paths are setup already. roms like cyanogenmod will work.
Hello, just tried adbFS but it gives lot segfaults when I try to copy files
Also tried with the patch
For latest GCC:
diff –git a/Makefile b/Makefile
index 6a2894d..be1db66 100644
— a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
CXXFLAGS=-Wall -D_FILE_OFFSET_BITS=64
-LDFLAGS=-lfuse
+LDLIBS=-lfuse
Just a quick note to say thanks for sharing your work!
Worked for me on Ubuntu 11.10 and rooted GalaxyNexus (Android 4.0.2).
Pingback: Mount Android 4 Ice Cream Sandwitch on Linux | pofHQ
Your repository is ssh protected – it requires password or a key to clone! I can’t get the source… I really need it now. Can you help out?
Hey dave,
Its not protected.
git clone git@github.com:isieo/adbFS.git
should work
It doesn’t. I get:
Cloning into ‘adbFS’…
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
What happens when you visit https://github.com/isieo/adbFS ?
Can you browse the code?
As far as i know my repository is public and i get pull requests from some contributors so i know its accessible.
Can you clone other public github repositories or is it only my repo that you can’t clone?
Pingback: Galaxy S3 access files in Linux | Random Rambling's…
utils.h:37:18: 致命错误: fuse.h:没有那个文件或目录
编译中断。
make: *** [adbfs.o] 错误 1
why i can’t complie this
Do you have libfuse installed?