Home | History | Annotate | Download | only in storage
      1 page.title=Typical Configuration Examples
      2 @jd:body
      3 
      4 <!--
      5     Copyright 2013 The Android Open Source Project
      6 
      7     Licensed under the Apache License, Version 2.0 (the "License");
      8     you may not use this file except in compliance with the License.
      9     You may obtain a copy of the License at
     10 
     11         http://www.apache.org/licenses/LICENSE-2.0
     12 
     13     Unless required by applicable law or agreed to in writing, software
     14     distributed under the License is distributed on an "AS IS" BASIS,
     15     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     16     See the License for the specific language governing permissions and
     17     limitations under the License.
     18 -->
     19 
     20 <p>Below are examples of external storage configurations as of Android 4.4
     21 for various typical devices. Only the relevant portions of the configuration
     22 files are included.
     23 
     24 <h2>Physical primary only (like Nexus One)</h2>
     25 
     26 <p>This is a typical configuration for a device with single external storage
     27 device which is a physical SD card.</p>
     28 
     29 <p>The raw physical device must first be mounted under
     30 <code>/mnt/media_rw</code> where only the system and FUSE daemon can access
     31 it. <code>vold</code> will then manage the <code>fuse_sdcard0</code> service
     32 when media is inserted/removed.
     33 
     34 <h3>fstab.hardware</h3>
     35 
     36 <pre><code>[physical device node]  auto  vfat  defaults  voldmanaged=sdcard0:auto,noemulatedsd
     37 </code></pre>
     38 
     39 <h3>init.hardware.rc</h3>
     40 
     41 <pre><code>on init
     42     mkdir /mnt/media_rw/sdcard0 0700 media_rw media_rw
     43     mkdir /storage/sdcard0 0700 root root
     44 
     45     export EXTERNAL_STORAGE /storage/sdcard0
     46 
     47 service fuse_sdcard0 /system/bin/sdcard -u 1023 -g 1023 -d /mnt/media_rw/sdcard0 /storage/sdcard0
     48     class late_start
     49     disabled
     50 </code></pre>
     51 
     52 <h3>storage_list.xml</h3>
     53 
     54 <pre><code>&lt;storage
     55     android:mountPoint="/storage/sdcard0"
     56     android:storageDescription="@string/storage_sd_card"
     57     android:removable="true"
     58     android:primary="true"
     59     android:maxFileSize="4096" /&gt;
     60 </code></pre>
     61 
     62 
     63 <h2>Emulated primary only (like Nexus 4)</h2>
     64 
     65 <p>This is a typical configuration for a device with single external storage
     66 device which is backed by internal storage on the device.</p>
     67 
     68 <h3>init.hardware.rc</h3>
     69 
     70 <pre><code>on init
     71     mkdir /mnt/shell/emulated 0700 shell shell
     72     mkdir /storage/emulated 0555 root root
     73 
     74     export EXTERNAL_STORAGE /storage/emulated/legacy
     75     export EMULATED_STORAGE_SOURCE /mnt/shell/emulated
     76     export EMULATED_STORAGE_TARGET /storage/emulated
     77 
     78 on fs
     79     setprop ro.crypto.fuse_sdcard true
     80 
     81 service sdcard /system/bin/sdcard -u 1023 -g 1023 -l /data/media /mnt/shell/emulated
     82     class late_start
     83 </code></pre>
     84 
     85 <h3>storage_list.xml</h3>
     86 
     87 <pre><code>&lt;storage
     88     android:storageDescription="@string/storage_internal"
     89     android:emulated="true"
     90     android:mtpReserve="100" /&gt;
     91 </code></pre>
     92 
     93 
     94 <h2>Emulated primary, physical secondary (like Xoom)</h2>
     95 
     96 <p>This is a typical configuration for a device with multiple external
     97 storage devices, where the primary device is backed by internal storage
     98 on the device, and where the secondary device is a physical SD card.</p>
     99 
    100 <p>The raw physical device must first be mounted under
    101 <code>/mnt/media_rw</code> where only the system and FUSE daemon can
    102 access it. <code>vold</code> will then manage the <code>fuse_sdcard1</code>
    103 service when media is inserted/removed.</p>
    104 
    105 <h3>fstab.hardware</h3>
    106 
    107 <pre><code>[physical device node]  auto  vfat  defaults  voldmanaged=sdcard1:auto
    108 </code></pre>
    109 
    110 <h3>init.hardware.rc</h3>
    111 
    112 <pre><code>on init
    113     mkdir /mnt/shell/emulated 0700 shell shell
    114     mkdir /storage/emulated 0555 root root
    115 
    116     mkdir /mnt/media_rw/sdcard1 0700 media_rw media_rw
    117     mkdir /storage/sdcard1 0700 root root
    118 
    119     export EXTERNAL_STORAGE /storage/emulated/legacy
    120     export EMULATED_STORAGE_SOURCE /mnt/shell/emulated
    121     export EMULATED_STORAGE_TARGET /storage/emulated
    122     export SECONDARY_STORAGE /storage/sdcard1
    123 
    124 on fs
    125     setprop ro.crypto.fuse_sdcard true
    126 
    127 service sdcard /system/bin/sdcard -u 1023 -g 1023 -l /data/media /mnt/shell/emulated
    128     class late_start
    129 
    130 service fuse_sdcard1 /system/bin/sdcard -u 1023 -g 1023 -w 1023 -d /mnt/media_rw/sdcard1 /storage/sdcard1
    131     class late_start
    132     disabled
    133 </code></pre>
    134 
    135 <h3>storage_list.xml</h3>
    136 
    137 <pre><code>&lt;storage
    138     android:storageDescription="@string/storage_internal"
    139     android:emulated="true"
    140     android:mtpReserve="100" /&gt;
    141 &lt;storage
    142     android:mountPoint="/storage/sdcard1"
    143     android:storageDescription="@string/storage_sd_card"
    144     android:removable="true"
    145     android:maxFileSize="4096" /&gt;
    146 </code></pre>
    147