blob: b8e4e4f7833b494ce856a79faf2937b6f7028598 [file] [log] [blame]
page.title=Device Specific Configuration
Copyright 2013 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
See the License for the specific language governing permissions and
limitations under the License.
<p>External storage is managed by a combination of the <code>vold</code> init
service and <code>MountService</code> system servic. Mounting of physical
external storage volumes is handled by <code>vold</code>, which performs
staging operations to prepare the media before exposing it to apps.</p>
<p>For Android 4.2.2 and earlier, the device-specific <code>vold.fstab</code>
configuration file defines mappings from sysfs devices to filesystem mount
points, and each line follows this format:</p>
<pre><code>dev_mount &lt;label&gt; &lt;mount_point&gt; &lt;partition&gt; &lt;sysfs_path&gt; [flags]
<li><code>label</code>: Label for the volume.</li>
<li><code>mount_point</code>: Filesystem path where the volume should be mounted.</li>
<li><code>partition</code>: Partition number (1 based), or 'auto' for first usable partition.</li>
<li><code>sysfs_path</code>: One or more sysfs paths to devices that can provide this mount
point. Separated by spaces, and each must start with <code>/</code>.</li>
<li><code>flags</code>: Optional comma separated list of flags, must not contain <code>/</code>.
Possible values include <code>nonremovable</code> and <code>encryptable</code>.</li>
<p>For Android releases 4.3 and later, the various fstab files used by init, vold and
recovery were unified in the <code>/fstab.&lt;device&gt;</code> file. For external
storage volumes that are managed by <code>vold</code>, the entries should have the
following format:</p>
<pre><code>&lt;src&gt; &lt;mnt_point&gt; &lt;type&gt; &lt;mnt_flags&gt; &lt;fs_mgr_flags&gt;
<li><code>src</code>: A path under sysfs (usually mounted at /sys) to the device that
can provide the mount point. The path must start with <code>/</code>.</li>
<li><code>mount_point</code>: Filesystem path where the volume should be mounted.</li>
<li><code>type</code>: The type of the filesystem on the volume. For external cards,
this is usually <code>vfat</code>.</li>
<li><code>mnt_flags</code>: <code>Vold</code> ignores this field and it should be set
to <code>defaults</code></li>
<li><code>fs_mgr_flags</code>: <code>Vold</code> ignores any lines in the unified fstab
that do not include the <code>voldmanaged=</code> flag in this field. This flag must
be followed by a label describing the card, and a partition number or the word
<code>auto</code>. Here is an example: <code>voldmanaged=sdcard:auto</code>.
Other possible flags are <code>nonremovable</code>,
<code>encryptable=sdcard</code>, and <code>noemulatedsd</code>.</li>
<p>External storage interactions at and above the framework level are handled
through <code>MountService</code>. The device-specific <code>storage_list.xml</code> configuration
file, typically provided through a <code>frameworks/base</code> overlay, defines the
attributes and constraints of storage devices. The <code>&lt;StorageList&gt;</code> element
contains one or more <code>&lt;storage&gt;</code> elements, exactly one of which should be marked
primary. <code>&lt;storage&gt;</code> attributes include:</p>
<li><code>mountPoint</code>: filesystem path of this mount.</li>
<li><code>storageDescription</code>: string resource that describes this mount.</li>
<li><code>primary</code>: true if this mount is the primary external storage.</li>
<li><code>removable</code>: true if this mount has removable media, such as a physical SD
<li><code>emulated</code>: true if this mount is emulated and is backed by internal storage,
possibly using a FUSE daemon.</li>
<li><code>mtp-reserve</code>: number of MB of storage that MTP should reserve for free
storage. Only used when mount is marked as emulated.</li>
<li><code>allowMassStorage</code>: true if this mount can be shared via USB mass storage.</li>
<li><code>maxFileSize</code>: maximum file size in MB.</li>
<p>Devices may provide external storage by emulating a case-insensitive,
permissionless filesystem backed by internal storage. One possible
implementation is provided by the FUSE daemon in <code>system/core/sdcard</code>, which can
be added as a device-specific <code>init.rc</code> service:</p>
<pre><code># virtual sdcard daemon running as media_rw (1023)
service sdcard /system/bin/sdcard &lt;source_path&gt; &lt;dest_path&gt; 1023 1023
class late_start
<p>Where <code>source_path</code> is the backing internal storage and <code>dest_path</code> is the
target mount point.</p>
<p>When configuring a device-specific <code>init.rc</code> script, the <code>EXTERNAL_STORAGE</code>
environment variable must be defined as the path to the primary external
storage. The <code>/sdcard</code> path must also resolve to the same location, possibly
through a symlink. If a device adjusts the location of external storage between
platform updates, symlinks should be created so that old paths continue working.</p>