blob: fd55db8dbc3a1d07582082e3bbec6833203de064 [file] [log] [blame]
Jeff Sharkey790c02d2013-10-18 13:57:33 -07001page.title=Typical Configuration Examples
2@jd:body
3
4<!--
Clay Murphy1d5f8fe2015-05-18 16:44:07 -07005 Copyright 2015 The Android Open Source Project
Jeff Sharkey790c02d2013-10-18 13:57:33 -07006
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-->
Clay Murphy1d5f8fe2015-05-18 16:44:07 -070019<div id="qv-wrapper">
20 <div id="qv">
21 <h2>In this document</h2>
22 <ol id="auto-toc">
23 </ol>
24 </div>
25</div>
Jeff Sharkey790c02d2013-10-18 13:57:33 -070026
27<p>Below are examples of external storage configurations as of Android 4.4
28for various typical devices. Only the relevant portions of the configuration
29files are included.
30
31<h2>Physical primary only (like Nexus One)</h2>
32
33<p>This is a typical configuration for a device with single external storage
34device which is a physical SD card.</p>
35
36<p>The raw physical device must first be mounted under
37<code>/mnt/media_rw</code> where only the system and FUSE daemon can access
38it. <code>vold</code> will then manage the <code>fuse_sdcard0</code> service
39when media is inserted/removed.
40
41<h3>fstab.hardware</h3>
42
43<pre><code>[physical device node] auto vfat defaults voldmanaged=sdcard0:auto,noemulatedsd
44</code></pre>
45
46<h3>init.hardware.rc</h3>
47
48<pre><code>on init
49 mkdir /mnt/media_rw/sdcard0 0700 media_rw media_rw
50 mkdir /storage/sdcard0 0700 root root
51
52 export EXTERNAL_STORAGE /storage/sdcard0
53
54service fuse_sdcard0 /system/bin/sdcard -u 1023 -g 1023 -d /mnt/media_rw/sdcard0 /storage/sdcard0
55 class late_start
56 disabled
57</code></pre>
58
59<h3>storage_list.xml</h3>
60
61<pre><code>&lt;storage
62 android:mountPoint="/storage/sdcard0"
63 android:storageDescription="@string/storage_sd_card"
64 android:removable="true"
65 android:primary="true"
66 android:maxFileSize="4096" /&gt;
67</code></pre>
68
69
70<h2>Emulated primary only (like Nexus 4)</h2>
71
72<p>This is a typical configuration for a device with single external storage
73device which is backed by internal storage on the device.</p>
74
75<h3>init.hardware.rc</h3>
76
77<pre><code>on init
78 mkdir /mnt/shell/emulated 0700 shell shell
79 mkdir /storage/emulated 0555 root root
80
81 export EXTERNAL_STORAGE /storage/emulated/legacy
82 export EMULATED_STORAGE_SOURCE /mnt/shell/emulated
83 export EMULATED_STORAGE_TARGET /storage/emulated
84
85on fs
86 setprop ro.crypto.fuse_sdcard true
87
88service sdcard /system/bin/sdcard -u 1023 -g 1023 -l /data/media /mnt/shell/emulated
89 class late_start
90</code></pre>
91
92<h3>storage_list.xml</h3>
93
94<pre><code>&lt;storage
95 android:storageDescription="@string/storage_internal"
96 android:emulated="true"
97 android:mtpReserve="100" /&gt;
98</code></pre>
99
100
101<h2>Emulated primary, physical secondary (like Xoom)</h2>
102
103<p>This is a typical configuration for a device with multiple external
104storage devices, where the primary device is backed by internal storage
105on the device, and where the secondary device is a physical SD card.</p>
106
107<p>The raw physical device must first be mounted under
108<code>/mnt/media_rw</code> where only the system and FUSE daemon can
109access it. <code>vold</code> will then manage the <code>fuse_sdcard1</code>
110service when media is inserted/removed.</p>
111
112<h3>fstab.hardware</h3>
113
114<pre><code>[physical device node] auto vfat defaults voldmanaged=sdcard1:auto
115</code></pre>
116
117<h3>init.hardware.rc</h3>
118
119<pre><code>on init
120 mkdir /mnt/shell/emulated 0700 shell shell
121 mkdir /storage/emulated 0555 root root
122
123 mkdir /mnt/media_rw/sdcard1 0700 media_rw media_rw
124 mkdir /storage/sdcard1 0700 root root
125
126 export EXTERNAL_STORAGE /storage/emulated/legacy
127 export EMULATED_STORAGE_SOURCE /mnt/shell/emulated
128 export EMULATED_STORAGE_TARGET /storage/emulated
129 export SECONDARY_STORAGE /storage/sdcard1
130
131on fs
132 setprop ro.crypto.fuse_sdcard true
133
134service sdcard /system/bin/sdcard -u 1023 -g 1023 -l /data/media /mnt/shell/emulated
135 class late_start
136
137service fuse_sdcard1 /system/bin/sdcard -u 1023 -g 1023 -w 1023 -d /mnt/media_rw/sdcard1 /storage/sdcard1
138 class late_start
139 disabled
140</code></pre>
141
142<h3>storage_list.xml</h3>
143
144<pre><code>&lt;storage
145 android:storageDescription="@string/storage_internal"
146 android:emulated="true"
147 android:mtpReserve="100" /&gt;
148&lt;storage
149 android:mountPoint="/storage/sdcard1"
150 android:storageDescription="@string/storage_sd_card"
151 android:removable="true"
152 android:maxFileSize="4096" /&gt;
153</code></pre>