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
Android - How to change mount points
提问by ghaschel
Simple question: How to change mount points? My sd-ext is mounting on \system\sd
but i need it to mount in \system\sd-ext
There is no \etc\fstab
for 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
.
- Backup your system.
- Install Root Explorer (I use ES File Explorer).
- Mount system with write privileges (ES File Explorer has it in Settings).
- Backup
/system/etc/vold.fstab
to sdcard and to your PC. - Open
/system/etc/vold.fstab
with Text Editor. Here you can find mount points in 3rd column:
dev_mount sdcard /mnt/sdcard
Read something about fstaband comments in file. Be careful. ;o)
- 备份您的系统。
- 安装根资源管理器(我使用 ES 文件资源管理器)。
- 使用写入权限挂载系统(ES 文件资源管理器在“设置”中有它)。
- 备份
/system/etc/vold.fstab
到 SD 卡和您的 PC。 /system/etc/vold.fstab
用文本编辑器打开。在这里,您可以在第 3 列中找到挂载点:
dev_mount sdcard /mnt/sdcard
阅读有关 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 数据。