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