Android 使用 BusyBox 挂载 ext2 SD 卡

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12013140/
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 09:27:07  来源:igfitidea点击:

Mount ext2 sd card with BusyBox

androidbusybox

提问by Justin

I am trying to mount an sd card that I put into my tablet. The sd card is in ext2 format. I tried using BusyBox with the following command in my terminal app on the tablet:

我正在尝试安装我放入平板电脑的 SD 卡。SD卡为ext2格式。我尝试在平板电脑上的终端应用程序中使用 BusyBox 和以下命令:

busybox mkfs.ext2

But it seems I need to add some arguments to the command. What commands would I need to add to it? Or is there an easier way to mount the sd card?

但似乎我需要在命令中添加一些参数。我需要添加哪些命令?或者有没有更简单的方法来安装 SD 卡?

I would like to not format the sd card as there is data on it; but whatever it takes to read it as ext2 format is ok.

我不想格式化sd卡,因为上面有数据;但无论如何将其读取为 ext2 格式都可以。

采纳答案by zapl

Should be busybox mount /dev/block/something /mountpoint. mkfscreates a filesystem like formatin Windows

应该是busybox mount /dev/block/something /mountpointmkfs创建一个类似于formatWindows的文件系统

http://www.busybox.net/downloads/BusyBox.html#mount

http://www.busybox.net/downloads/BusyBox.html#mount

Or is there an easier way to mount the sd card?

或者有没有更简单的方法来安装 SD 卡?

It usually happens automatically, check busybox mountwithout arguments if it is already mounted somewhere.

它通常会自动发生,busybox mount不带参数检查它是否已经安装在某处。

回答by Akos Cz

you need to mountthe ext2 filesystem not create the filesystem.

您需要挂载ext2 文件系统而不是创建文件系统。

Depending on your tablet, the device in /dev could be different from my example. but in general you want to run a similar command :

根据您的平板电脑,/dev 中的设备可能与我的示例不同。但一般来说你想运行一个类似的命令:

busybox mount -t ext2 /dev/block/vold/179:2 /data/sd-ext

where /dev/block/vold/179:2is the device that you are trying to mount.

其中/dev/block/vold/179:2是您尝试挂载的设备。

and /data/sd-extis the path where you want to mount your sd card to.

/数据/ SD-EXT是要你的SD卡安装到的路径。

here's the help page for the mount command

这是 mount 命令的帮助页面

1|shell@android:/ $ busybox mount -t
option requires an argument -- t
BusyBox v1.20.0.git (2012-03-21 01:44:00 GMT) multi-call binary.

Usage: mount [OPTIONS] [-o OPTS] DEVICE NODE

Mount a filesystem. Filesystem autodetection requires /proc.

    -a      Mount all filesystems in fstab
    -f      Dry run
    -i      Don't run mount helper
    -r      Read-only mount
    -w      Read-write mount (default)
    -t FSTYPE[,...] Filesystem type(s)
    -O OPT      Mount only filesystems with option OPT (-a only)
-o OPT:
    loop        Ignored (loop devices are autodetected)
    [a]sync     Writes are [a]synchronous
    [no]atime   Disable/enable updates to inode access times
    [no]diratime    Disable/enable atime updates to directories
    [no]relatime    Disable/enable atime updates relative to modification time
    [no]dev     (Dis)allow use of special device files
    [no]exec    (Dis)allow use of executable files
    [no]suid    (Dis)allow set-user-id-root programs
    [r]shared   Convert [recursively] to a shared subtree
    [r]slave    Convert [recursively] to a slave subtree
    [r]private  Convert [recursively] to a private subtree
    [un]bindable    Make mount point [un]able to be bind mounted
    [r]bind     Bind a file or directory [recursively] to another location
    move        Relocate an existing mount point
    remount     Remount a mounted filesystem, changing flags
    ro/rw       Same as -r/-w

There are filesystem-specific -o flags.