page.title=Typical Configuration Examples
@jd:body

<!--
    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

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
-->

<p>Below are examples of external storage configurations as of Android 4.4
for various typical devices. Only the relevant portions of the configuration
files are included.

<h2>Physical primary only (like Nexus One)</h2>

<p>This is a typical configuration for a device with single external storage
device which is a physical SD card.</p>

<p>The raw physical device must first be mounted under
<code>/mnt/media_rw</code> where only the system and FUSE daemon can access
it. <code>vold</code> will then manage the <code>fuse_sdcard0</code> service
when media is inserted/removed.

<h3>fstab.hardware</h3>

<pre><code>[physical device node]  auto  vfat  defaults  voldmanaged=sdcard0:auto,noemulatedsd
</code></pre>

<h3>init.hardware.rc</h3>

<pre><code>on init
    mkdir /mnt/media_rw/sdcard0 0700 media_rw media_rw
    mkdir /storage/sdcard0 0700 root root

    export EXTERNAL_STORAGE /storage/sdcard0

service fuse_sdcard0 /system/bin/sdcard -u 1023 -g 1023 -d /mnt/media_rw/sdcard0 /storage/sdcard0
    class late_start
    disabled
</code></pre>

<h3>storage_list.xml</h3>

<pre><code>&lt;storage
    android:mountPoint="/storage/sdcard0"
    android:storageDescription="@string/storage_sd_card"
    android:removable="true"
    android:primary="true"
    android:maxFileSize="4096" /&gt;
</code></pre>


<h2>Emulated primary only (like Nexus 4)</h2>

<p>This is a typical configuration for a device with single external storage
device which is backed by internal storage on the device.</p>

<h3>init.hardware.rc</h3>

<pre><code>on init
    mkdir /mnt/shell/emulated 0700 shell shell
    mkdir /storage/emulated 0555 root root

    export EXTERNAL_STORAGE /storage/emulated/legacy
    export EMULATED_STORAGE_SOURCE /mnt/shell/emulated
    export EMULATED_STORAGE_TARGET /storage/emulated

on fs
    setprop ro.crypto.fuse_sdcard true

service sdcard /system/bin/sdcard -u 1023 -g 1023 -l /data/media /mnt/shell/emulated
    class late_start
</code></pre>

<h3>storage_list.xml</h3>

<pre><code>&lt;storage
    android:storageDescription="@string/storage_internal"
    android:emulated="true"
    android:mtpReserve="100" /&gt;
</code></pre>


<h2>Emulated primary, physical secondary (like Xoom)</h2>

<p>This is a typical configuration for a device with multiple external
storage devices, where the primary device is backed by internal storage
on the device, and where the secondary device is a physical SD card.</p>

<p>The raw physical device must first be mounted under
<code>/mnt/media_rw</code> where only the system and FUSE daemon can
access it. <code>vold</code> will then manage the <code>fuse_sdcard1</code>
service when media is inserted/removed.</p>

<h3>fstab.hardware</h3>

<pre><code>[physical device node]  auto  vfat  defaults  voldmanaged=sdcard1:auto
</code></pre>

<h3>init.hardware.rc</h3>

<pre><code>on init
    mkdir /mnt/shell/emulated 0700 shell shell
    mkdir /storage/emulated 0555 root root

    mkdir /mnt/media_rw/sdcard1 0700 media_rw media_rw
    mkdir /storage/sdcard1 0700 root root

    export EXTERNAL_STORAGE /storage/emulated/legacy
    export EMULATED_STORAGE_SOURCE /mnt/shell/emulated
    export EMULATED_STORAGE_TARGET /storage/emulated
    export SECONDARY_STORAGE /storage/sdcard1

on fs
    setprop ro.crypto.fuse_sdcard true

service sdcard /system/bin/sdcard -u 1023 -g 1023 -l /data/media /mnt/shell/emulated
    class late_start

service fuse_sdcard1 /system/bin/sdcard -u 1023 -g 1023 -w 1023 -d /mnt/media_rw/sdcard1 /storage/sdcard1
    class late_start
    disabled
</code></pre>

<h3>storage_list.xml</h3>

<pre><code>&lt;storage
    android:storageDescription="@string/storage_internal"
    android:emulated="true"
    android:mtpReserve="100" /&gt;
&lt;storage
    android:mountPoint="/storage/sdcard1"
    android:storageDescription="@string/storage_sd_card"
    android:removable="true"
    android:maxFileSize="4096" /&gt;
</code></pre>