Android File System

From Free Knowledge Base- The DUCK Project: information for everyone
Revision as of 21:18, 12 March 2014 by Admin (Talk | contribs)

Jump to: navigation, search

Microsoft Windows users are familiar with the terms FAT32, or NTFS, which refers to types of file systems. Android devices are developed on Linux, which is based on UNIX. Linux users are familiar with good old ext2 file system. Well, your Android device may use an updated Linux file system, such as ext4, or a proprietary file system by a manufacturer, depending on who made the device and and what has been done to it by the user.

Samsung Galaxy S phones use the Samsung RFS proprietary file system while the Samsung Nexus S with Android 2.3 uses the Linux Ext4 file system. The new open standard Ext4 file system seems to be the popular standard. Android phones use the Linux kernel, and as many linux users know, linux can support a large number of operating systems.

The SDCard may be formatted ext3 or YAFFS, or ext4.

In December 2010 it was announced "Ext4 filesystem hits Android," Google's new Nexus S smartphone is the first Android device to use the Ext4 filesystem. Ext4 developer Ted T'so claims it is less prone to data loss. Previously, most Androids used YAFFS, a lightweight filesystem that is optimized for flash storage and is commonly used in mobile and embedded devices.

Ext4 is considered a breakthrough for Android devices, with increased data integrity and quicker data read/write access.

File System Overview

The file system structure of Android devices shares some similarities with Linux, and has some peculiar traits unique to Android.

Many applications search the entire sdcard for data files, for example, a common music player will search the entire SD Card for all audio files, including .mp3 files. This can be undesirable for (a) purists that wish to have certain files for certain purposes in specific organized and standardized places and (b) people that have audio files in certain folders they do not want showing up in the new media player just installed.

It is true that Android blows away file system and storage convention, by trying to make it seem as if there is no need for structure of the file system. The design is supposed to be a "stick it in and it just finds the stuff and works" designed for the lowest common denominator. Unfortunately, a lot of technology is heading down this zombie minded road.

Linux users are also familiar with partitions versus directories. Some directories visible via the file manager (or ls command on linux) may be mounted partitions. A good article reference to read is: Android Partitions Explained: boot, system, recovery, data, cache & misc by an author named By Haroon Q. Raja.

Hiding Media Files

If you have a folder with files, such as .mp3 files, and you don't want them to appear to applications that scan the entire card contents, just put a .nomedia file in the folder and it wont see them. Save a null file as “.nomedia” and make sure that the Save as type is set as “All Files” instead of “Text documents.” Copy that file to the folder on your SD card containing audio files you don’t want to show up. You may have to reboot the Android after doing this.

Also, any folder whose name begins with a period, such as .secretmedia, will be invisible to scanning software also. A folder beginning with a period in the Linux / Android world is like a folder with the hidden attribute set in the Windows world.

The Linux console command to quickly create the null .nomedia file is:

 touch .nomedia

SDCard

The mounted SDCard is a storage device mounted to the file system in the typical Linux fashion. On the file system root the /sdcard is a symbolic link to /mnt/sdcard. /mnt/sdcard is where the SD card is actually mounted, but the same files can also be accessed in /sdcard.

  • /mnt/sdcard --- Your removable SD card data is stored here.

The Samsung Galaxy Tab 2 actually has two SDCard mounts, one for a built-in internal SDCard which is different than the device memory on a typical Android phone, and the second is the removable SDCard.

  • /mnt/extSdCard --- On the Samsung Galaxy 2 tablet this is the removable SD card.

Every Android-compatible device supports a shared "external storage" that you can use to save files. This can be a removable storage media (such as an SD card) or an internal (non-removable) storage. Files saved to the external storage are world-readable and can be modified by the user when they enable USB mass storage to transfer files on a computer.

DCIM

  • typically /sdcard/DCIM or /DCIM

Android uses the DCF (Design rule for Camera File system) specification. All digital cameras contain a DCIM (Digital Camera IMages) folder in their root directory. Inside this will be multiple folders named nnnABCDE, where nnn is a unique directory number between 100-999 and ABCDE is a five-character alphanumeric string often (but not required to be) related to the camera manufacturer. Image files stored within these folders will have a file name in the format ABCDnnnn, where ABCD is a four-character string (often DSC_ or IMG_) and nnnn is a unique sequential index number.

External Storage Public Directory

Android developer's reference explains that there are certain public storage directories that are not specifically tied to a specific program. So if a program is uninstalled, it should never remove data from one of these standard public storage directories. These directories lay at the root of the external storage, such as Music/, Pictures/, Ringtones/, and others.


  • Music/ - Media scanner classifies all media found here as user music.
  • Podcasts/ - Media scanner classifies all media found here as a podcast.
  • Ringtones/ - Media scanner classifies all media found here as a ringtone.
  • Alarms/ - Media scanner classifies all media found here as an alarm sound.
  • Notifications/ - Media scanner classifies all media found here as a notification sound.
  • Pictures/ - All photos (excluding those taken with the camera).
  • Movies/ - All movies (excluding those taken with the camcorder).
  • Download/ - Miscellaneous downloads.

So an example would be /mnt/sdcard/Pictures which is made up of the first part, /mnt/sdcard (or just /sdcard) that being the root of the sdcard and then one of the directories above.

File System Tree

Since Android is a Linux-based operating system for smartphones and tablets it shares the basic Linux "like" file system structure. Purists will argue that Linux is a kernel, not a file system structure, but people get the point. Android runs on top of a standard Linux kernel, and uses many of the same kernelspace utilities. The directory structure of Android looks similar to the directory structure of common Linux distributions. Android utilizes certain conventions providing uniformity in partitions versus directories on a partition. There are mainly 6 partitions in Android phones, tablets and other Android devices: boot, system, recovery, data, cache, misc.

Click on a folder for details on purpose.

device
|
+---acct
+---cache
+---config
+---d
+---data
|   +---app
+---dev
+---efs
+---etc
+---factory
+---lib
+---mnt
|   +---asec
|   +---extSdCard
|   +---obb
|   +---sdcard
|   |   +DCIM
|   +---secure
|   +---UsbDriveA
|   +---UsbDriveB
|   +---UsbDriveC
|   +---UsbDriveD
|   +---UsbDriveE
|   +---UsbDriveF
+---preload
+---proc
+---root
+---sbin
+---sdcard
+---storage
+---sys
+---system
|   +---app
|   +---bin
|   +---cameradata
|   +---csc
|   +---etc
|   +---fonts
|   +---framework
|   +---hdic
|   +---lib
|   +---media
|   +---T9DB
|   +---tts
|   +---usr
|   +---vendor
|   +---vsc
|   +---wallpaper
|   +---xbin
+---vendor

 

Keywords: Android Tablet PC Samsung Galaxy Tab Two 2 FS File System Root Linux