How to explore Android device files under FreeBSD ?

Polytropon freebsd at
Sat Jul 13 22:03:28 UTC 2019

Addition from recycled notes:

It is possible that more than one device will be recognized.
Some versions of Android seem to differentiate between "built-in
memory" and "external memory" (usually a micro-SD card, but
sometimes also a built-in storage chip). In this case, you
can mount both devices.

On your phone, you'll usually have to do some preparation.
I have no idea how the english version looks like, but if I
translate from a german equivalent, the setting is:

	settings -> wireless and network -> USB settings -> mass storage

Now two devices will be visible, the "internal memory":

	# mount -t msdosfs -o ro /dev/da0 /mnt/int

And the micro-SD card:

	# mount -t msdosfs -o ro /dev/da1 /mnt/sd

You can then use your favorite GUI file browser or the
Midnight Commander to explore what you can get access to.
Remember my previous statement: On non-rooted phones, access
to a certain "inner storage" is not possible, which usually
contains contacts, SMS, phone lists, and so on. Using some
app (I think it was called "Total Commander", but I'm not sure,
I only know this name as a Norton Commander GUI clone used in
the pre-"Windows '95" era), it's sometimes possible to copy
information from the "inner storage" to one of the non-
restricted areas (equivalents of "int" and "sd" as shown in
the example).

In your settings, you can also enable access via adb:

settings -> applications -> development -> USB debugging

Now a new /dev/ugen* device will appear, and you can access
it with the adb program.

	# adb start-server
	# adb devices

Here, your phone should be listed. You can now invoke an
interactive shell to explore the file systems:

	# adb shell

Commands like "cd" and "ls" can be used. And if you know the
locations of stuff, you can copy files, for example:

	# adb pull -p -a /sdcard/GreatApp/meow.txt .

Or you can simply copy everything you can get, and review
the content later on:

	# adb pull sdcard/

Note: In this example "sdcard" does _not_ mean the micro-SD
card mentioned at the beginning! It's the internal memory
without the "privileged area". There's also /sdcard/internal_sd,
which I'm not sure anymore what it stands for.


	/sdcard = / of da0 -> /mnt/int

	/sdcard/internal_sd = / of da1 -> /mnt/sd

All other directory entries in / are _not_ being exported as
direct access media; they can only be accessed with adb.

Finally, here are two examples of "adb shell" which you can use
to search for files and and download them:

	# adb shell find "/sdcard/<directory>" -iname "*jpg" | tr -d '\015' \
		| while read LINE; do adb pull ${LINE}; done

	# adb shell ls /sdcard/gps*.trace | tr '\r' '' | xargs -n 1 adb pull

All this information has been created from notes taken 3 years ago.
I hardly deal with this stuff anymore, and I have no experience
with modern technology, so see this as suggestions for further
experiments. ;-)

Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...

More information about the freebsd-questions mailing list