Difference between revisions of "Talk:Android File System"

From Free Knowledge Base- The DUCK Project: information for everyone
Jump to: navigation, search
(stock, non-rooted Android OS: new section)
(Music Library Cache)
 
(3 intermediate revisions by 2 users not shown)
Line 64: Line 64:
  
 
source: http://blog.shvetsov.com/2013/02/access-android-app-data-without-root.html
 
source: http://blog.shvetsov.com/2013/02/access-android-app-data-without-root.html
 +
 +
== Special directories ==
 +
 +
There are a number of directories part of the root Android file system.  Some of these directories are not entirely accessible to the the user without root permissions. 
 +
 +
=== /data/app ===
 +
 +
Say you download and install an app from Google Play store.  The "apk" is placed in the /data/app folder.  All application apk files are located in /data/app (non-system-apps) and the file names are not visible without root permission.  The file permissions on the app folder are 771 (chmod 771) meaning that only the executable flag is set for non-privileged users.  Without the read permission set, it is not possible to list the filenames in the folder, unless you have root.  The installed application apk files can be extracted if the name of the file is known. 
 +
 +
* User installed apps apk's are stored at /data/app
 +
* System apk's are stored at /system/app
 +
 +
Some workarounds to view the filenames in the /data/app folder without having root exists using "adb".  They vary depending on the Android version of your device.  It is simply so much easier if you have root access to your device.  See the discussion of this page to read about the workarounds.
 +
 +
== Android Partitions Explained ==
 +
 +
source: http://www.addictivetips.com/mobile/android-partitions-explained-boot-system-recovery-data-cache-misc/
 +
 +
Note that only /sdcard is found in all Android devices and the rest are present only in select devices. Let’s now take a look at the purpose and contents of each of these partitions.
 +
 +
/boot
 +
 +
This is the partition that enables the phone to boot, as the name suggests. It includes the kernel and the ramdisk. Without this partition, the device will simply not be able to boot. Wiping this partition from recovery should only be done if absolutely required and once done, the device must NOT be rebooted before installing a new one, which can be done by installing a ROM that includes a /boot partition.
 +
 +
/system
 +
 +
This partition basically contains the entire operating system, other than the kernel and the ramdisk. This includes the Android user interface as well as all the system applications that come pre-installed on the device. Wiping this partition will remove Android from the device without rendering it unbootable, and you will still be able to put the phone into recovery or bootloader mode to install a new ROM.
 +
 +
/recovery
 +
 +
The recovery partition can be considered as an alternative boot partition that lets you boot the device into a recovery console for performing advanced recovery and maintenance operations on it. To learn more about this partition and its contents, see the ‘About Android Recovery’ section of our guide to ClockworkMod recovery.
 +
 +
/data
 +
 +
Also called userdata, the data partition contains the user’s data – this is where your contacts, messages, settings and apps that you have installed go. Wiping this partition essentially performs a factory reset on your device, restoring it to the way it was when you first booted it, or the way it was after the last official or custom ROM installation. When you perform a wipe data/factory reset from recovery, it is this partition that you are wiping.
 +
 +
/cache
 +
 +
This is the partition where Android stores frequently accessed data and app components. Wiping the cache doesn’t effect your personal data but simply gets rid of the existing data there, which gets automatically rebuilt as you continue using the device.
 +
 +
/misc
 +
 +
This partition contains miscellaneous system settings in form of on/off switches. These settings may include CID (Carrier or Region ID), USB configuration and certain hardware settings etc. This is an important partition and if it is corrupt or missing, several of the device’s features will will not function normally.
 +
 +
/sdcard
 +
 +
This is not a partition on the internal memory of the device but rather the SD card. In terms of usage, this is your storage space to use as you see fit, to store your media, documents, ROMs etc. on it. Wiping it is perfectly safe as long as you backup all the data you require from it, to your computer first. Though several user-installed apps save their data and settings on the SD card and wiping this partition will make you lose all that data.
 +
 +
On devices with both an internal and an external SD card – devices like the Samsung Galaxy S and several tablets – the /sdcard partition is always used to refer to the internal SD card. For the external SD card – if present – an alternative partition is used, which differs from device to device. In case of Samsung Galaxy S series devices, it is /sdcard/sd while in many other devices, it is /sdcard2. Unlike /sdcard, no system or app data whatsoever is stored automatically on this external SD card and everything present on it has been added there by the user. You can safely wipe it after backing up any data from it that you need to save.
 +
 +
/sd-ext
 +
 +
This is not a standard Android partition, but has become popular in the custom ROM scene. It is basically an additional partition on your SD card that acts as the /data partition when used with certain ROMs that have special features called APP2SD+ or data2ext enabled. It is especially useful on devices with little internal memory allotted to the /data partition. Thus, users who want to install more programs than the internal memory allows can make this partition and use it with a custom ROM that supports this feature, to get additional storage for installing their apps. Wiping this partition is essentially the same as wiping the /data partition – you lose your contacts, SMS, market apps and settings.
 +
 +
== Music Library Cache ==
 +
 +
If you are looking to update your Android Music Library or Force a Refresh of it, here is how.
 +
 +
It’s quite a simple (dead-simple I might say) solution. Just clear the media storage cache, which is found in Settings >> Applications >> Manage Applications >> Media Storage >> Clear Data. Since you have wiped the cache, you’ll need to power down your phone, then boot it back up.
 +
 +
Or
 +
 +
use SDmount widget, after putting new stuff on or changing names click the widget and sd card is unmounted then re mounted
 +
 +
PHYSICAL FILE LOCATION
 +
 +
Android/data/com.cooliris.media/cache

Latest revision as of 23:00, 24 March 2014

using a "media" intermediary directory

Some people are using a "media" intermediary directory between the standard public directory and the storage root. See below

  • /sdcard/media/alarms OR /sdcard/Alarms
  • /sdcard/media/notifications OR /sdcard/notifications
  • /sdcard/media/ringtones OR /sdcard/ringtones
  • /sdcard/media/ui OR /sdcard/ui

Warning: This may be incorrect.

adb

adb is part of Android SDK

Someone claims a workaround to view the filenames in the /data/app folder without having root exists using "adb".

 adb shell pm list packages

to get a list of packages installed

However, you need to root the Android device to install Android SDK.

what?

list contents of /data/app without root

To do this from the command line, use adb shell pm list packages to get the list of installed packages, pick the desired package, append -1.apk to it, and pull it from /data/app. Example: If the package name is org.mozilla.firefox, use adb pull /data/app/org.mozilla.firefox-1.apk.

need to root first

You need to root your phone first. Then install Android SDK. run adb or ddms->file explorer, look for your interested-in APK in /system/app

backup then view

You can use a file browser with an backup function, for example the ES File Explorer Long tap a item and select create backup

stock, non-rooted Android OS

If the application, whose data you wish to access, is debuggable, its read-protected folder can be accessed with the help of the run-as command. In essence, we pretend to be the application in question and copy file(s) stored inside the application's data folder into user readable folder.

adb shell
run-as app.package.name \
cp /data/data/package.name/databases/application.sqlite /sdcard/
exit
adb pull /sdcard/application.sqlite ~/

This only works if the application is debuggable. If the application was not debuggable, so the method above did not work either.

Starting with Android v4.0 (Ice Cream Sandwich) Google has provided a way to backup data and applications from Android devices without root via adb.

adb backup -f ~/data.ab -noapk app.package.name

This will prompt you to "unlock your device and confirm the backup operation". To keep things simple do not provide a password, otherwise you will have to jump through the hoops to decrypt it later. Just click on "Back up my data" button. The screen will display the name of the package you're backing up, then close by itself upon successful completion.

The resulting ".ab" file contains application data in android backup format. It's a tar archive that has been run through deflate and optionally encrypted (in a somewhat peculiar way) by AES-256-CRC cypher. To quickly extract a simple non-encrypted backup...

dd if=data.ab bs=1 skip=24 | openssl zlib -d | tar -xvf -

If that doesn't work, try this alternative using Python

dd if=data.ab bs=1 skip=24 | python -c "import zlib,sys;sys.stdout.write(zlib.decompress(sys.stdin.read()))" | tar -xvf -

The result is the apps/app.package.name/ folder containing application data.

source: http://blog.shvetsov.com/2013/02/access-android-app-data-without-root.html

Special directories

There are a number of directories part of the root Android file system. Some of these directories are not entirely accessible to the the user without root permissions.

/data/app

Say you download and install an app from Google Play store. The "apk" is placed in the /data/app folder. All application apk files are located in /data/app (non-system-apps) and the file names are not visible without root permission. The file permissions on the app folder are 771 (chmod 771) meaning that only the executable flag is set for non-privileged users. Without the read permission set, it is not possible to list the filenames in the folder, unless you have root. The installed application apk files can be extracted if the name of the file is known.

  • User installed apps apk's are stored at /data/app
  • System apk's are stored at /system/app

Some workarounds to view the filenames in the /data/app folder without having root exists using "adb". They vary depending on the Android version of your device. It is simply so much easier if you have root access to your device. See the discussion of this page to read about the workarounds.

Android Partitions Explained

source: http://www.addictivetips.com/mobile/android-partitions-explained-boot-system-recovery-data-cache-misc/

Note that only /sdcard is found in all Android devices and the rest are present only in select devices. Let’s now take a look at the purpose and contents of each of these partitions.

/boot

This is the partition that enables the phone to boot, as the name suggests. It includes the kernel and the ramdisk. Without this partition, the device will simply not be able to boot. Wiping this partition from recovery should only be done if absolutely required and once done, the device must NOT be rebooted before installing a new one, which can be done by installing a ROM that includes a /boot partition.

/system

This partition basically contains the entire operating system, other than the kernel and the ramdisk. This includes the Android user interface as well as all the system applications that come pre-installed on the device. Wiping this partition will remove Android from the device without rendering it unbootable, and you will still be able to put the phone into recovery or bootloader mode to install a new ROM.

/recovery

The recovery partition can be considered as an alternative boot partition that lets you boot the device into a recovery console for performing advanced recovery and maintenance operations on it. To learn more about this partition and its contents, see the ‘About Android Recovery’ section of our guide to ClockworkMod recovery.

/data

Also called userdata, the data partition contains the user’s data – this is where your contacts, messages, settings and apps that you have installed go. Wiping this partition essentially performs a factory reset on your device, restoring it to the way it was when you first booted it, or the way it was after the last official or custom ROM installation. When you perform a wipe data/factory reset from recovery, it is this partition that you are wiping.

/cache

This is the partition where Android stores frequently accessed data and app components. Wiping the cache doesn’t effect your personal data but simply gets rid of the existing data there, which gets automatically rebuilt as you continue using the device.

/misc

This partition contains miscellaneous system settings in form of on/off switches. These settings may include CID (Carrier or Region ID), USB configuration and certain hardware settings etc. This is an important partition and if it is corrupt or missing, several of the device’s features will will not function normally.

/sdcard

This is not a partition on the internal memory of the device but rather the SD card. In terms of usage, this is your storage space to use as you see fit, to store your media, documents, ROMs etc. on it. Wiping it is perfectly safe as long as you backup all the data you require from it, to your computer first. Though several user-installed apps save their data and settings on the SD card and wiping this partition will make you lose all that data.

On devices with both an internal and an external SD card – devices like the Samsung Galaxy S and several tablets – the /sdcard partition is always used to refer to the internal SD card. For the external SD card – if present – an alternative partition is used, which differs from device to device. In case of Samsung Galaxy S series devices, it is /sdcard/sd while in many other devices, it is /sdcard2. Unlike /sdcard, no system or app data whatsoever is stored automatically on this external SD card and everything present on it has been added there by the user. You can safely wipe it after backing up any data from it that you need to save.

/sd-ext

This is not a standard Android partition, but has become popular in the custom ROM scene. It is basically an additional partition on your SD card that acts as the /data partition when used with certain ROMs that have special features called APP2SD+ or data2ext enabled. It is especially useful on devices with little internal memory allotted to the /data partition. Thus, users who want to install more programs than the internal memory allows can make this partition and use it with a custom ROM that supports this feature, to get additional storage for installing their apps. Wiping this partition is essentially the same as wiping the /data partition – you lose your contacts, SMS, market apps and settings.

Music Library Cache

If you are looking to update your Android Music Library or Force a Refresh of it, here is how.

It’s quite a simple (dead-simple I might say) solution. Just clear the media storage cache, which is found in Settings >> Applications >> Manage Applications >> Media Storage >> Clear Data. Since you have wiped the cache, you’ll need to power down your phone, then boot it back up.

Or

use SDmount widget, after putting new stuff on or changing names click the widget and sd card is unmounted then re mounted

PHYSICAL FILE LOCATION

Android/data/com.cooliris.media/cache