1 <html devsite> 2 <head> 3 <title>Configuration Examples</title> 4 <meta name="project_path" value="/_project.yaml" /> 5 <meta name="book_path" value="/_book.yaml" /> 6 </head> 7 <body> 8 <!-- 9 Copyright 2017 The Android Open Source Project 10 11 Licensed under the Apache License, Version 2.0 (the "License"); 12 you may not use this file except in compliance with the License. 13 You may obtain a copy of the License at 14 15 http://www.apache.org/licenses/LICENSE-2.0 16 17 Unless required by applicable law or agreed to in writing, software 18 distributed under the License is distributed on an "AS IS" BASIS, 19 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 See the License for the specific language governing permissions and 21 limitations under the License. 22 --> 23 24 25 26 <p>Below are examples of external storage configurations 27 for various device types. Only the relevant portions of the configuration 28 files are included. 29 <p>Due to configuration changes in Android 6.0 (like the removal of the 30 <code>storage_list.xml</code> resource overlay), the configuration examples are 31 split into two categories.</p> 32 33 <h2 id=android_5_x>Android 5.x and earlier</h2> 34 <h3 id=android_5_x_physical>Physical primary only</h3> 35 <p>This is a typical configuration for a device with single external storage 36 device which is a physical SD card, like Nexus One.</p> 37 <p>The raw physical device must first be mounted under 38 <code>/mnt/media_rw</code> where only the system and FUSE daemon can access 39 it. <code>vold</code> will then manage the <code>fuse_sdcard0</code> service 40 when media is inserted/removed. 41 <h4>fstab.hardware</h4> 42 <pre class="devsite-click-to-copy"> 43 [physical device node] auto vfat defaults voldmanaged=sdcard0:auto,noemulatedsd 44 </pre> 45 <h4>init.hardware.rc</h4> 46 <pre class="devsite-click-to-copy"> 47 on init 48 mkdir /mnt/media_rw/sdcard0 0700 media_rw media_rw 49 mkdir /storage/sdcard0 0700 root root 50 export EXTERNAL_STORAGE /storage/sdcard0 51 service fuse_sdcard0 /system/bin/sdcard -u 1023 -g 1023 -d /mnt/media_rw/sdcard0 /storage/sdcard0 52 class late_start 53 disabled 54 </pre> 55 <h4>storage_list.xml</h4> 56 <pre class="devsite-click-to-copy"> 57 <storage 58 android:mountPoint="/storage/sdcard0" 59 android:storageDescription="@string/storage_sd_card" 60 android:removable="true" 61 android:primary="true" 62 android:maxFileSize="4096" /> 63 </pre> 64 <h3 id=android_5_x_emulated>Emulated primary only</h3> 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, like Nexus 4.</p> 67 <h4>init.hardware.rc</h4> 68 <pre class="devsite-click-to-copy"> 69 on init 70 mkdir /mnt/shell/emulated 0700 shell shell 71 mkdir /storage/emulated 0555 root root 72 export EXTERNAL_STORAGE /storage/emulated/legacy 73 export EMULATED_STORAGE_SOURCE /mnt/shell/emulated 74 export EMULATED_STORAGE_TARGET /storage/emulated 75 on fs 76 setprop ro.crypto.fuse_sdcard true 77 service sdcard /system/bin/sdcard -u 1023 -g 1023 -l /data/media /mnt/shell/emulated 78 class late_start 79 </pre> 80 <h4>storage_list.xml</h4> 81 <pre class="devsite-click-to-copy"> 82 <storage 83 android:storageDescription="@string/storage_internal" 84 android:emulated="true" 85 android:mtpReserve="100" /> 86 </pre> 87 <h3 id=android_5_x_both>Emulated primary, physical secondary</h3> 88 <p>This is a typical configuration for a device with multiple external 89 storage devices, where the primary device is backed by internal storage 90 on the device, and where the secondary device is a physical SD card, like Xoom.</p> 91 <p>The raw physical device must first be mounted under 92 <code>/mnt/media_rw</code> where only the system and FUSE daemon can 93 access it. <code>vold</code> will then manage the <code>fuse_sdcard1</code> 94 service when media is inserted/removed.</p> 95 <h4>fstab.hardware</h4> 96 <pre class="devsite-click-to-copy"> 97 [physical device node] auto vfat defaults voldmanaged=sdcard1:auto 98 </pre> 99 <h4>init.hardware.rc</h4> 100 <pre class="devsite-click-to-copy"> 101 on init 102 mkdir /mnt/shell/emulated 0700 shell shell 103 mkdir /storage/emulated 0555 root root 104 mkdir /mnt/media_rw/sdcard1 0700 media_rw media_rw 105 mkdir /storage/sdcard1 0700 root root 106 export EXTERNAL_STORAGE /storage/emulated/legacy 107 export EMULATED_STORAGE_SOURCE /mnt/shell/emulated 108 export EMULATED_STORAGE_TARGET /storage/emulated 109 export SECONDARY_STORAGE /storage/sdcard1 110 on fs 111 setprop ro.crypto.fuse_sdcard true 112 service sdcard /system/bin/sdcard -u 1023 -g 1023 -l /data/media /mnt/shell/emulated 113 class late_start 114 service fuse_sdcard1 /system/bin/sdcard -u 1023 -g 1023 -w 1023 -d /mnt/media_rw/sdcard1 /storage/sdcard1 115 class late_start 116 disabled 117 </pre> 118 <h4>storage_list.xml</h4> 119 <pre class="devsite-click-to-copy"> 120 <storage 121 android:storageDescription="@string/storage_internal" 122 android:emulated="true" 123 android:mtpReserve="100" /> 124 <storage 125 android:mountPoint="/storage/sdcard1" 126 android:storageDescription="@string/storage_sd_card" 127 android:removable="true" 128 android:maxFileSize="4096" /> 129 </pre> 130 131 <h2 id=android_6>Android 6.0</h2> 132 <h3 id=android_6_physical>Physical primary only</h3> 133 <p>This is a typical configuration for a device with single external storage 134 device which is a physical SD card, like the original Android One. There is no 135 secondary shared storage and the device cannot support multi-user.</p> 136 <h4>fstab.device</h4> 137 <pre class="devsite-click-to-copy"> 138 /devices/platform/mtk-msdc.1/mmc_host* auto auto defaults 139 voldmanaged=sdcard0:auto,encryptable=userdata,noemulatedsd 140 </pre> 141 <h4>init.device.rc</h4> 142 <pre class="devsite-click-to-copy"> 143 on init 144 # By default, primary storage is physical 145 setprop ro.vold.primary_physical 1 146 </pre> 147 <h3 id=android_6_emulated> Emulated primary only</h3> 148 <p>This is a typical configuration for a device with single external storage 149 device which is backed by internal storage on the device, like Nexus 6.</p> 150 <ul> 151 <li>Primary shared storage (<code>/sdcard</code>) is emulated on top of internal storage. 152 <li>No secondary SD card storage. 153 <li>USB OTG storage devices supported. 154 <li>Supports multi-user. 155 </ul> 156 <h4>fstab.device</h4> 157 <pre class="devsite-click-to-copy">/devices/*/xhci-hcd.0.auto/usb* auto auto defaults 158 voldmanaged=usb:auto 159 </pre> 160 <h3 id=android_6_both>Emulated primary, physical secondary</h3> 161 <p>This is a typical configuration for a device with multiple external storage 162 devices, where the primary device is backed by internal storage on the device, 163 and where the secondary device is a physical SD card, like Xoom.</p> 164 <ul> 165 <li>Primary shared storage (<code>/sdcard</code>) is emulated on top of internal storage. 166 <li>Secondary storage is a physical SD card slot that can be adopted. 167 <li>Supports multi-user. 168 </ul> 169 <h4>fstab.device</h4> 170 <pre class="devsite-click-to-copy"> 171 /devices/platform/mtk-msdc.1/mmc_host* auto auto defaults 172 voldmanaged=sdcard1:auto,encryptable=userdata 173 </pre> 174 175 </body> 176 </html> 177