Android - 如何更改挂载点

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12271082/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 10:16:18  来源:igfitidea点击:

Android - How to change mount points

android

提问by ghaschel

Simple question: How to change mount points? My sd-ext is mounting on \system\sdbut i need it to mount in \system\sd-extThere is no \etc\fstabfor android, right? So, how to do this?

简单的问题:如何更改挂载点?我的 sd-ext 正在安装,\system\sd但我需要将其安装在android\system\sd-ext上没有\etc\fstab,对吧?那么,如何做到这一点?

回答by Milan Jaros

You are interested in /system/etc/vold.fstab.

您对/system/etc/vold.fstab.

  1. Backup your system.
  2. Install Root Explorer (I use ES File Explorer).
  3. Mount system with write privileges (ES File Explorer has it in Settings).
  4. Backup/system/etc/vold.fstabto sdcard and to your PC.
  5. Open /system/etc/vold.fstabwith Text Editor.
  6. Here you can find mount points in 3rd column:

    dev_mount sdcard /mnt/sdcard

  7. Read something about fstaband comments in file. Be careful. ;o)

  1. 备份您的系统。
  2. 安装根资源管理器(我使用 ES 文件资源管理器)。
  3. 使用写入权限挂载系统(ES 文件资源管理器在“设置”中有它)。
  4. 备份/system/etc/vold.fstab到 SD 卡和您的 PC。
  5. /system/etc/vold.fstab用文本编辑器打开。
  6. 在这里,您可以在第 3 列中找到挂载点:

    dev_mount sdcard /mnt/sdcard

  7. 阅读有关 fstab和文件中的注释的内容。当心。;o)

回答by Sam

You cannot change a device's file structure. You can ask Android where the SD card is with Environment.getExternalStorageDirectory(). This approach works whether a manufacturer specifies the sdcard is in /sdcard/, /mnt/sdcard/, or /way/out/in/the/willy/wacks/sdcard/.

您无法更改设备的文件结构。您可以使用Environment.getExternalStorageDirectory()询问 Android 的 SD 卡在哪里。无论制造商是否指定 sdcard 是在、 或中/sdcard/,此方法都有效。/mnt/sdcard//way/out/in/the/willy/wacks/sdcard/

You should also observe the Android protocol for saving sdcard data in .../sdcard/Android/data/your.package.name/with Environment.getExternalStoragePublicDirectory()or just Context.getExternalFilesDir().

您还应该遵守 Android 协议,用于.../sdcard/Android/data/your.package.name/使用Environment.getExternalStoragePublicDirectory()或仅Context.getExternalFilesDir()保存 sdcard 数据。