In Android 8.0, the MountService class was renamed to StorageManagerService.

Android SystemUI 通过StorageEventReceiver监听内卡和外卡参考 u盘插入 03-07 09:26:33.789 3141 3271 D UsbHostManager: USB device attached: vidpid 0951:1666 mfg/product/ver/serial Kingston/DataTraveler 3.0/0.01/60A44C425324F250899718BC hasAudio/HID/Storage: fals... 阅读详情

Device Configuration

External storage is managed by a combination of the vold init service and StorageManagerService system service. Mounting of physical external storage volumes is handled by vold, which performs staging operations to prepare the media before exposing it to apps.

Note: In Android 8.0, the MountService class was renamed to StorageManagerService.

File mappings

For Android 4.2.2 and earlier, the device-specific vold.fstab configuration file defines mappings from sysfs devices to filesystem mount points, and each line follows this format:

dev_mount <label> <mount_point> <partition> <sysfs_path> [flags]
  • label: Label for the volume.
  • mount_point: Filesystem path where the volume should be mounted.
  • partition: Partition number (1 based), or 'auto' for first usable partition.
  • sysfs_path: One or more sysfs paths to devices that can provide this mount point. Separated by spaces, and each must start with /.
  • flags: Optional comma separated list of flags, must not contain /. Possible values include nonremovable and encryptable.

For Android releases 4.3 and later, the various fstab files used by init, vold and recovery were unified in the /fstab.<device> file. For external storage volumes that are managed by vold, the entries should have the following format:

<src> <mnt_point> <type> <mnt_flags> <fs_mgr_flags>
  • src: A path under sysfs (usually mounted at /sys) to the device that can provide the mount point. The path must start with /.
  • mount_point: Filesystem path where the volume should be mounted.
  • type: The type of the filesystem on the volume. For external cards, this is usually vfat.
  • mnt_flags: Vold ignores this field and it should be set to defaults
  • fs_mgr_flags: Vold ignores any lines in the unified fstab that do not include the voldmanaged= flag in this field. This flag must be followed by a label describing the card, and a partition number or the word auto. Here is an example: voldmanaged=sdcard:auto. Other possible flags are nonremovable, encryptable=sdcard, noemulatedsd, and encryptable=userdata.

Configuration details

External storage interactions at and above the framework level are handled through StorageManagerService. Due to configuration changes in Android 6.0 (like the removal of the storage_list.xml resource overlay), the configuration details are split into two categories.

Android 5.x and earlier

The device-specific storage_list.xml configuration file, typically provided through a frameworks/base overlay, defines the attributes and constraints of storage devices. The <StorageList> element contains one or more <storage> elements, exactly one of which should be marked primary. <storage> attributes include:

  • mountPoint: filesystem path of this mount.
  • storageDescription: string resource that describes this mount.
  • primary: true if this mount is the primary external storage.
  • removable: true if this mount has removable media, such as a physical SD card.
  • emulated: true if this mount is emulated and is backed by internal storage, possibly using a FUSE daemon.
  • mtp-reserve: number of MB of storage that MTP should reserve for free storage. Only used when mount is marked as emulated.
  • allowMassStorage: true if this mount can be shared via USB mass storage.
  • maxFileSize: maximum file size in MB.

Devices may provide external storage by emulating a case-insensitive, permissionless filesystem backed by internal storage. One possible implementation is provided by the FUSE daemon in system/core/sdcard, which can be added as a device-specific init.rc service:

# virtual sdcard daemon running as media_rw (1023) service sdcard /system/bin/sdcard <source_path> <dest_path> 1023 1023 class late_start

Where source_path is the backing internal storage and dest_path is the target mount point.

When configuring a device-specific init.rc script, the EXTERNAL_STORAGE environment variable must be defined as the path to the primary external storage. The /sdcard path must also resolve to the same location, possibly through a symlink. If a device adjusts the location of external storage between platform updates, symlinks should be created so that old paths continue working.

Android 6.0

Configuration of the storage subsystem is now concentrated in the device-specific fstab file, and several historical static configuration files/variables have been removed to support more dynamic behavior:

  • The storage_list.xml resource overlay has been removed and is no longer used by the framework. Storage devices are now configured dynamically when detected by vold.
  • The EMULATED_STORAGE_SOURCE/TARGET environment variables have been removed and are no longer used by Zygote to configure user-specific mount points. Instead, user separation is now enforced with user-specific GIDs, and primary shared storage is mounted into place by vold at runtime.
    • Developers may continue to build paths dynamically or statically depending on their use case. Including the UUID in the path identifies each card to make location clearer for developers. (For example, /storage/ABCD-1234/report.txt is clearly a different file than /storage/DCBA-4321/report.txt.)
  • The hard-coded FUSE services have been removed from device-specific init.rc files and are instead forked dynamically from vold when needed.

In addition to these configuration changes, Android 6.0 includes the notion of adoptable storage. For Android 6.0 devices, any physical media that is not adopted is viewed as portable.

Adoptable storage

To indicate an adoptable storage device in the fstab, use the encryptable=userdata attribute in the fs_mgr_flagsfield. Here’s a typical definition:

/devices/platform/mtk-msdc.1/mmc_host* auto auto defaults voldmanaged=sdcard1:auto,encryptable=userdata

When a storage device is adopted, the platform erases the contents and writes a GUID partition table that defines two partitions:

  • a small empty android_meta partition that is reserved for future use. The partition type GUID is 19A710A2-B3CA-11E4-B026-10604B889DCF.
  • a large android_ext partition that is encrypted using dm-crypt and formatted using either ext4 or f2fsdepending on the kernel capabilities. The partition type GUID is 193D1EA4-B3CA-11E4-B075-10604B889DCF.
Portable storage

In the fstab, storage devices with the voldmanaged attribute are considered to be portable by default unless another attribute like encryptable=userdata is defined. For example, here’s a typical definition for USB OTG devices:

/devices/*/xhci-hcd.0.auto/usb* auto auto defaults voldmanaged=usb:auto

The platform uses blkid to detect filesystem types before mounting, and users can choose to format the media when the filesystem is unsupported.

Android 12系统源码_存储(二)StorageManagerService服务 结合Android12系统源码解析StorageManagerService的相关源码。 阅读详情

相关推荐

SWT/ANR问题--StorageManagerService卡住

SWT/ANR问题--StorageManagerService卡住

专业开发者的博客,一个从事Android WiFi和蓝牙的工程师 1188

插入SD卡后设备异常重启

但是,只发了一次ACMD41后,卡回复busy状态之后,主机就复位重新发CMD0了,正常情况应该是发送一次ACMD41,卡回复busy后,host再重复多发几次ACMD41,直到卡ACMD41的响应显示初始化完成,不处于busy状态。202407221502_ylog_重启\ap\006-0722_145915_poweron\traces\07-22_150054–anr_2024-07-22-15-00-53-958.log。这个方法调用前的log正常打印了,但是后面这个log没有打印。

weixin_43761183的博客 1151

App inventor2通过蓝牙控制Arduino Uno LED开关

App inventer2控制Arduino Uno LED开关 如果学会这个小程序,大部分的手机通过蓝牙控制Arduino的功能都可以实现,这个小示例是通过蓝牙模块向Arduino发送"0"和"1",而其它功能要发送其它不同的字符串内容给Arduino. 所需硬件: Arduino Uno JDY-16 蓝牙模块(我的是蓝牙4.2版本) 草帽LED(可选) 手机(我用的是安卓,苹果手机应该也可以,最近其应用商店也有App inventor(AI)伴侣) 软件: Aduino IDE或者Platfom

Firmin123456的博客 5514

android下存储设备的使用

本文转自android官网,原文地址:https://source.android.google.cn/devices/storage 1、概览 1.1、存储 Android 一直在不断发展,可支持各种存储设备类型和功能。所有 Android 版本均支持配有传统存储(包括便携式存储和内置存储)的设备。便携式存储是指物理介质(如 SD 卡或 USB 设备),用于进行临时数据传输/文件存储。...

80后的梦想 2756

Pintos project 1 实验报告(代码分享)

任务一 Alarm Clock 用到的相干目录有: pintos/src/devices time.h && time.c pintos/src/threads thread.h && thread.c 预期pass希望:暂无,安装pintos之后,第一次对threads进行make check操作,可以发现以alarm--开头的前六个文件,以及mlfqs-fair-2和mlfqs-fair-20文件,一开始就测试成功pass。但是为了避免对后期的修改有影响,这里还是要

m0_53112875的博客 6886

康耐视VisionPro必学技巧:用CogCopyRegionTool实现图像拼接与局部替换

本文深入探讨了康耐视VisionPro中CogCopyRegionTool的高级应用,重点解析如何利用其精确的像素级复制与坐标对齐功能,实现工业视觉中的多相机图像拼接与印刷品局部替换。通过实战案例与代码示例,详细指导了从坐标标定、画布创建到顺序复制的完整流程,并分享了性能优化与常见避坑指南,帮助工程师高效解决复杂图像合成难题。

weixin_29204121的博客 506

android存储系统源码走读

android存储系统源码走读 1、storageManagerservice的启动: 在SystemServer的startOtherServices中,storageManagerservice启动。 private void startOtherServices() { final Context context = mSystemContext; Vibra...

搬砖的老牛 1088

TSMC40nmLP版图实战:从Design Rule解读到Cadence高效布局布线

本文详细解析了TSMC40nmLP工艺的版图设计实战,从Design Rule解读到Cadence高效布局布线技巧。重点介绍了40nm工艺中的关键设计规则,如最小线宽、间距规则和深N阱规则,并分享了Cadence Virtuoso中的高效工作流和射频模块设计技巧,帮助工程师提升版图设计效率和质量。

weixin_29250403的博客 389

StorageManagerService流程分析

文章目录附录前言本文涉及代码路径StorageManagerServicestartService 附录 本人前一阵子一直在学习文件系统方面的知识,都说好记性不如烂笔头,我决定从今天开始总结学习到的知识,和大家一起学习,一起进步。 前言 Android外部存储空间由 vold init 服务和 StorageManagerService 系统服务共同管理。外部实体存储卷的装载由 vold 处理:通过执行分阶段操作准备好媒体,然后再将其提供给应用。 从 Android 8.0 开始,MountService

ChenQiaNg0923的博客 3191

金现代面试题—— i++,++i, &&,&|自动装箱和自动拆箱(int,byte,float等)|取int等基本类型的最大值

public static void main(String[] args){ int i=1,j=1; if(i++==2&amp;amp;amp;amp;amp;amp;amp;amp;&amp;amp;amp;amp;amp;amp;amp;amp;++j==2){ i=7; } System.out.println(“i=”+i+”,j=”+j); } 请给出 输出结果:

老孟嘚吧嘚 1413

第20期-英伟达笔试题型解析

英伟达作为AI领域的缔造者及硬件基石,是这几年最为炙手可热的公司。英伟达以其高性能GPU设计闻名,硬件工程师岗位的招聘通常包括笔试和技术面试,考察领域涵盖数字电路设计、处理器架构、嵌入式系统和信号处理等。通过搜索公开平台,收集了候选人的面试经历和相关技术问题,,通过分析公开平台收集的笔试面试经验,结合英伟达的GPU架构特点,整理出可能涉及的典型题目,并提供详细解析。 以下是基于英伟达(Nvidia)硬件工程师笔试题型的解析与总结,涵盖核心知识点、解题思路及案例分析。

启芯硬件的博客 761

Androd开机时挂载大容量硬盘导致系统异常

问题现象 当开机接入小容量U盘或者移动硬盘时,该问题不会显现。但当容量超过1T时,有可能会出发watchdong,导致system_server重启,从而引发系统操作异常。 先把Solution放上: --- a/services/core/java/com/android/server/StorageManagerService.java +++ b/services/core/java/com...

qiangsf123的博客 1354

【codex从入门到精通实战教程】第 02 讲 · 3 种使用形态怎么选:90% 的人第一步就选错

本讲结构: 1. 先给结论(对号入座表),急性子看完 §2 就能做决定; 2. 用一个真实任务在三种形态下各走一遍(含完整操作记录); 3. 从"任务属性"反推形态的方法论——学会了这套推理,以后平台出新形态你也能自己判断; 4. 三个典型用户的选型案例(学生党 / 在职后端 / 接单自由职业); 5. 新手最常见的三个错误起步及其纠正。

企鹅码农的专属播客,分享10多年的实战案例和经验解读,包含YOLO、RT-DETR、AI等各个工作领域。 34

Android存储(3)-- 设备配置

外部存储由vold init服务和MountService系统服务的组合管理。物理外部存储卷的安装由vold处理,vold执行临时操作以在将媒体暴露给应用程序之前准备媒体。 文件映射 对于Android 4.2.2及更早版本,设备特定的vold.fstab配置文件定义了从sysfs设备到文件系统挂接点的映射,每行都遵循以下格式: dev_mount &lt;label&gt; &lt;mount_...

weixin_34341229的博客 348

100天精通Python(基础篇)——第3天:运算符全解析(算术运算符、比较运算符、逻辑运算符、赋值运算符及其优先级规则)

100天精通Python(基础篇)——第3天:运算符全解析(算术运算符、比较运算符、逻辑运算符、赋值运算符及其优先级规则)

努力让自己发光,对的人才能迎着光而来 14万+

蓝牙模块HM-10手册

蓝牙模块HM-10手册,该手册对蓝牙模块HM-10进行了详细的介绍和使用方法以及一些AT指令。

android 8.0 MountService -->StorageManagerService

android 8.0 MountService -->StorageManagerService 从android开始一直以来的MountService变更成了StorageManagerService。 位置: W:\mtk8.0\v7200\mydroid\frameworks\base\services\core\java\com\android\server\StorageManag

qq_37610155的博客 5011

最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版

Part-E1-SDIO-Specification-Ver4.00-Final-120220.pdf:最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版,包括SDIO 接口的外设,SDIO 接口官方协议等。

Android8.0 存储系统

Android 一直在不断发展,可支持各种存储设备类型和功能。所有 Android 版本均支持配有传统存储(包括便携式存储和内置存储)的设备。便携式存储是指物理介质(如 SD 卡或 USB 设备),用于进行临时数据传输/文件存储。物理介质可以随设备一起保留更长时间,但并非固定在设备上,可以移除。自 Android 1.0 开始,SD 卡已可用作便携式存储;Android 6.0 增加对 USB 的...

Sherlock的博客 2337

NTscan扫描工具

ntscan是一个扫描器,可以扫描没有密码和弱密码的共享,先到配置文件中填写猜测的用户名和密码,扫描过程中右侧出现的是扫描日志。

计算机控制技术及应用

《计算机控制技术及应用》通过总结作者的科研成果和吸收国内外的先进理论、方法和技术,以计算机控制系统的网络化、开放化、智能化和集成化发展趋势为主线索,主要介绍计算机控制系统的基本概念和计算机控制系统的典型形式,计算机控制系统的数学描述与基本分析方法,以及数字PID控制器、最少拍控制系统、达林算法、状态变量设计法等设计方法及其各种改进算法。重点突出计算机控制系统输入输出通道接口的设计方法和典型控制系统的设计案例与实现方法等。

Android 8.0 中如何读取内部和外部存储以及外置SDcard

最近碰到询问我这个读取SDcard的问题, 很久没有看这部分了,所以大致看了一下, 顺便记录一下。在Android 8.0上做了测试。一般的Android App能读取的存储空间主要有三种:app自己的私有目录,也就是/data/data/《app 目录》。 读写这个目录不需要单独的权限。每个app只能读写自己的目录,而不能读写其他app的目录。 Android通过Seandroid对权限进行了管...

omnispace的博客 1万+

Userdata 分区 resize 功能

1. 挂载分区时添加resize功能 system/core/fs_mgr/fs_mgr.cpp #include "cryptfs.h" #define RESIZE2FS_BIN "/system/bin/resize2fs" static void resize_fs(const char *blk_device, char *fs_type, char *key_loc) { uint64_t device_sz; uint64_t device_ss;

蓝精灵的专栏 1896

Android 8.1 客制化OTG U盘的挂载路径名称

有时候项目需要特殊的或者固定的U盘挂载路径,可以参考下面的办法修改!先大概看一下U盘挂载的过程:Android 8.1默认U盘是没有挂载到storage目录下面的,并且文件管理里面也看不到U盘,如果需要能在文件管理里面看到U盘,参考我另外一篇博客:[Android 8.1 OTG U盘无法显示在系统文件管理的修改] 1.当U盘插入之后,会先new一个Disk类,其构造函数会传入一个参数“***eventPath***”,源文件:system/vold/Disk.cpp

杨涂涂的博客 4655

Android源码解析--DeviceStorageManagerService(DeviceStorageMonitorService)服务详解

DiskStatsService和DeviceStorageMonitorService两个服务都和系统内部存储管理、监控有关。 这一篇继续学习DeviceStorageMonitorService(以下简称DSMS)。 DeviceStorageMonitorService和DeviceStorageManagerService是一个东西,只是在5.0以后,名字改为了DeviceStorageM...

追yi流年 3011

i.MX8MPlus EVK Android12外部SD卡自动挂载

原文:Vold之存储设备和fstab配置 - liutimo - 博客园 分类 traditional storage(传统存储) portable storage(便携式存储): SD卡或USB设备。 emulated storage(模拟存储):将部分内部存储暴露于模拟层来实现存储。 adoptable storage(可合并的存储设备) 这种存储设备是指可以像内部存储设备那样进行加密和格式化的物理介质(例如 SD 卡或 USB 设备)。 fst

Muggle的博客 1755

Android 8.0 user版本adb remount后系统卡死问题分析

先说结论: 执行adbremount重新将system分区以读写方式挂载的时候,需要将相关的信息保存到devinfo分区中。 这个分区在user版本中是被保护起来的,不允许写!(保护动作在LK中) 所以user版本LK,adb remount时会卡死(触发了分区保护机制), Userdebug不会。       问题现象: V12BNLite 8.0 user版本替换userde

guofeizhi的博客 2022

Android外部存储设备管理——vold挂载大容量存储设备

Android 的外部存储设备挂载管理

qq_42291035的博客 1万+

Android8.0 USB系统框架

USB(通用串行总线)主机模式向外设进行供电,使 Android 设备能够驱动 USB 总线,并且可以使用各种 USB 外设(包括音频接口,存储,MIDI),USB 和蓝牙低功耗连接都可以用于传输 MIDI 协议。USB配件模式,受外设供电驱动,包括数据传输,充电。USB开发模式,应用调试,唯一可见的外设功能是 Android fastboot 或 Android 调试桥 (adb)。fastbo...

Sherlock的博客 5964

Android8.0 文件的存储权限

首先Android6.0之后都是需要动态申请权限的,注意在AndroidManifest.xml中也是和以前一样需要些权限的;前段时间在做上传头像的时候,拍照再对图片进行裁剪的时候遇到的Android8.0的手机会失败,上网查找里一下原来是Android8.0以后的权限又加了限制条件。我总结了一下:首先要在res的文件夹下建立一个xml的文件夹,再建立一个provider_paths.xml,如图...

bloom的专栏 2万+
上一篇: 构建和运行您的应用
下一篇: UML图中类之间的关系
conceptcon
博客等级 码龄17年 84粉丝 31原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值