blob: 91be81ba9320f1e609d7ef4f207900a42c442bb4 [file] [log] [blame]
Danielle Roberts20334fc2015-09-24 16:36:35 -07001page.title=Configuration Examples
Jeff Sharkey790c02d2013-10-18 13:57:33 -07002@jd:body
Jeff Sharkey790c02d2013-10-18 13:57:33 -07003<!--
Danielle Roberts20334fc2015-09-24 16:36:35 -07004 Copyright 2015 The Android Open Source Project
Jeff Sharkey790c02d2013-10-18 13:57:33 -07005 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 Sharkey790c02d2013-10-18 13:57:33 -07008 http://www.apache.org/licenses/LICENSE-2.0
Jeff Sharkey790c02d2013-10-18 13:57:33 -07009 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 Roberts20334fc2015-09-24 16:36:35 -070015<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 Sharkey790c02d2013-10-18 13:57:33 -070022
Danielle Roberts20334fc2015-09-24 16:36:35 -070023<p>Below are examples of external storage configurations
24for various device types. Only the relevant portions of the configuration
Jeff Sharkey790c02d2013-10-18 13:57:33 -070025files are included.
Danielle Roberts20334fc2015-09-24 16:36:35 -070026<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
28split into two categories.</p>
Jeff Sharkey790c02d2013-10-18 13:57:33 -070029
Danielle Roberts20334fc2015-09-24 16:36:35 -070030<h2 id=android_5_x>Android 5.x and earlier</h2>
31<h3 id=android_5_x_physical>Physical primary only</h3>
Jeff Sharkey790c02d2013-10-18 13:57:33 -070032<p>This is a typical configuration for a device with single external storage
Danielle Roberts20334fc2015-09-24 16:36:35 -070033device which is a physical SD card, like Nexus One.</p>
Jeff Sharkey790c02d2013-10-18 13:57:33 -070034<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
36it. <code>vold</code> will then manage the <code>fuse_sdcard0</code> service
37when media is inserted/removed.
Danielle Roberts20334fc2015-09-24 16:36:35 -070038<h4>fstab.hardware</h4>
Jeff Sharkey790c02d2013-10-18 13:57:33 -070039<pre><code>[physical device node] auto vfat defaults voldmanaged=sdcard0:auto,noemulatedsd
40</code></pre>
Danielle Roberts20334fc2015-09-24 16:36:35 -070041<h4>init.hardware.rc</h4>
Jeff Sharkey790c02d2013-10-18 13:57:33 -070042<pre><code>on init
43 mkdir /mnt/media_rw/sdcard0 0700 media_rw media_rw
44 mkdir /storage/sdcard0 0700 root root
Jeff Sharkey790c02d2013-10-18 13:57:33 -070045 export EXTERNAL_STORAGE /storage/sdcard0
Jeff Sharkey790c02d2013-10-18 13:57:33 -070046service 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 Roberts20334fc2015-09-24 16:36:35 -070050<h4>storage_list.xml</h4>
Jeff Sharkey790c02d2013-10-18 13:57:33 -070051<pre><code>&lt;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" /&gt;
57</code></pre>
Danielle Roberts20334fc2015-09-24 16:36:35 -070058<h3 id=android_5_x_emulated>Emulated primary only</h3>
Jeff Sharkey790c02d2013-10-18 13:57:33 -070059<p>This is a typical configuration for a device with single external storage
Danielle Roberts20334fc2015-09-24 16:36:35 -070060device which is backed by internal storage on the device, like Nexus 4.</p>
61<h4>init.hardware.rc</h4>
Jeff Sharkey790c02d2013-10-18 13:57:33 -070062<pre><code>on init
63 mkdir /mnt/shell/emulated 0700 shell shell
64 mkdir /storage/emulated 0555 root root
Jeff Sharkey790c02d2013-10-18 13:57:33 -070065 export EXTERNAL_STORAGE /storage/emulated/legacy
66 export EMULATED_STORAGE_SOURCE /mnt/shell/emulated
67 export EMULATED_STORAGE_TARGET /storage/emulated
Jeff Sharkey790c02d2013-10-18 13:57:33 -070068on fs
69 setprop ro.crypto.fuse_sdcard true
Jeff Sharkey790c02d2013-10-18 13:57:33 -070070service sdcard /system/bin/sdcard -u 1023 -g 1023 -l /data/media /mnt/shell/emulated
71 class late_start
72</code></pre>
Danielle Roberts20334fc2015-09-24 16:36:35 -070073<h4>storage_list.xml</h4>
Jeff Sharkey790c02d2013-10-18 13:57:33 -070074<pre><code>&lt;storage
75 android:storageDescription="@string/storage_internal"
76 android:emulated="true"
77 android:mtpReserve="100" /&gt;
78</code></pre>
Danielle Roberts20334fc2015-09-24 16:36:35 -070079<h3 id=android_5_x_both>Emulated primary, physical secondary</h3>
Jeff Sharkey790c02d2013-10-18 13:57:33 -070080<p>This is a typical configuration for a device with multiple external
81storage devices, where the primary device is backed by internal storage
Danielle Roberts20334fc2015-09-24 16:36:35 -070082on the device, and where the secondary device is a physical SD card, like Xoom.</p>
Jeff Sharkey790c02d2013-10-18 13:57:33 -070083<p>The raw physical device must first be mounted under
84<code>/mnt/media_rw</code> where only the system and FUSE daemon can
85access it. <code>vold</code> will then manage the <code>fuse_sdcard1</code>
86service when media is inserted/removed.</p>
Danielle Roberts20334fc2015-09-24 16:36:35 -070087<h4>fstab.hardware</h4>
Jeff Sharkey790c02d2013-10-18 13:57:33 -070088<pre><code>[physical device node] auto vfat defaults voldmanaged=sdcard1:auto
89</code></pre>
Danielle Roberts20334fc2015-09-24 16:36:35 -070090<h4>init.hardware.rc</h4>
Jeff Sharkey790c02d2013-10-18 13:57:33 -070091<pre><code>on init
92 mkdir /mnt/shell/emulated 0700 shell shell
93 mkdir /storage/emulated 0555 root root
Jeff Sharkey790c02d2013-10-18 13:57:33 -070094 mkdir /mnt/media_rw/sdcard1 0700 media_rw media_rw
95 mkdir /storage/sdcard1 0700 root root
Jeff Sharkey790c02d2013-10-18 13:57:33 -070096 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 Sharkey790c02d2013-10-18 13:57:33 -0700100on fs
101 setprop ro.crypto.fuse_sdcard true
Jeff Sharkey790c02d2013-10-18 13:57:33 -0700102service sdcard /system/bin/sdcard -u 1023 -g 1023 -l /data/media /mnt/shell/emulated
103 class late_start
Jeff Sharkey790c02d2013-10-18 13:57:33 -0700104service 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 Roberts20334fc2015-09-24 16:36:35 -0700108<h4>storage_list.xml</h4>
Jeff Sharkey790c02d2013-10-18 13:57:33 -0700109<pre><code>&lt;storage
110 android:storageDescription="@string/storage_internal"
111 android:emulated="true"
112 android:mtpReserve="100" /&gt;
113&lt;storage
114 android:mountPoint="/storage/sdcard1"
115 android:storageDescription="@string/storage_sd_card"
116 android:removable="true"
117 android:maxFileSize="4096" /&gt;
118</code></pre>
Danielle Roberts20334fc2015-09-24 16:36:35 -0700119
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
123device which is a physical SD card, like the original Android One. There is no
124secondary 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
127voldmanaged=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
136device 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
148devices, where the primary device is backed by internal storage on the device,
149and 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
157voldmanaged=sdcard1:auto,encryptable=userdata
158</code></pre>