什么是Android等同于/ etc / fstab? -- file-system 领域 和 mount 领域 android 相关 的问题

What's the Android equivalent of /etc/fstab?


简体版||繁體版
29
vote

问题

中文

有时我真的希望他们这么多搞砸了Linux!我知道有一个 /etc/fstab 在某处,但在哪里?

我想用替代文件系统挂载一些分区(因为我不喜欢FAT32)。

english

Sometimes I really wish they hadn't messed around with Linux so much! I know there's an /etc/fstab in there somewhere, but where?

I'd like to mount some partitions with alternative filesystems (because I don't like FAT32).

     

回答列表

20
 
vote
vote
最佳答案
 

不要考虑Android作为一个严重修改的Linux发行版。因为它不是。近似只有一个与Linux分发的Android共享的东西是内核。甚至修改了此组件。其他核心组件,如libc,不同。

android没有 /etc/fstab

您不需要 /etc/fstab 来装入分区。但是有IIRC NO ABCDEFGHIJKLMNABCDEFGHIJKLMN2 命令。 dev_mount 应该工作(根必需的根)。 回答你的问题标题:所有启动系统安装都是使用 /etc/vold.fstab 帮助脚本完成的。

 

Don't think about Android as a heavily modified Linux distribution. Because it's not. The nearly only thing that Android shares with a Linux distribution is the kernel. And even this component is modified. Also other core components, like the libc, differ.

Android has no /etc/fstab

You don't need /etc/fstab to mount an partition. But there is IIRC no mount command either.dev_mount should work (root required). To answer your questions title: All startup system mounting is done with the/etc/vold.fstab helper script.

 
 
   
   
8
 
vote

fstab文件是 /

它被称为 /fstab.$systemname.rc 其中 $systemname 基于听筒的指纹属性,可以被标识为芯片组或手机本身的类别。

 

The fstab file is in /.

It's called /fstab.$systemname.rc where $systemname is based on the handset's fingerprint property, either identified as category of chipset or handset itself.

 
 
       
       
5
 
vote

我看到相互冲突的信息。 一个资源说它是硬逻辑的,所以不是你可以改变用户端的东西:

特定于android的init程序在设备/系统/ init中找到。添加日志消息以帮助您使用设备/系统/ init / init.c中定义的日志宏调试潜在问题。

init程序直接使用通过探测sysfs文件系统生成的硬编码文件名或设备名称(从而消除了Android中的需要)。

其他地方 /etc/vold.fstab /etc/vold.conf 。我在CM 7.1下面有我的设备,但我不确定如何使用它们。

 

I'm seeing conflicting information. One resource says it's hardcoded, so not something you can change user-side:

Android-specific init programs are found in device/system/init. Add LOG messages to help you debug potential problems with the LOG macro defined in device/system/init/init.c.

The init program directly mounts all filesystems and devices using either hard-coded file names or device names generated by probing the sysfs filesystem (thereby eliminating the need for a /etc/fstab file in Android).

Elsewhere /etc/vold.fstab and /etc/vold.conf are mentioned. I have them on my device under CM 7.1 but I'm not sure of how they are used.

 
 
 
 
5
 
vote

您可以通过运行

重新安装外部存储以可执行
  /etc/fstab0  

这将删除Noexec,NosuID和Nodev标志,但它仍将是VFAT FS。您可以与此fs的链接进行链接,但不在内部。重新汇位不会在重新启动中生存,因为vold.fstab文件将被读取,并且它们将以重新启动重新安装,其中noexec标志。

如果将任何外部存储重新格式化为VFAT以外的任何内容,那么它们将不会重新启动以重新启动,以及您移动到任何外部存储器的任何应用程序都无法使用。如果您不打算为应用程序使用外部存储,那么您可以卸载外部存储和使用 /etc/fstab1 使其成为ext2。使用 /etc/fstab2 将其返回给vfat并再次使用它。

注意<代码> /etc/fstab3 被打破,你会得到类似的东西

lseek:定义数据类型的值太大

所以不要浪费你的时间。所有这一切都假定您植根于植物,并且具有工作BusyBox二进制文件。

 

You can remount your external storage to be executable by running

mount -o remount, rw /mnt/sdcard 

this will remove the noexec, nosuid and nodev flags, but it will still be vfat fs. You can make links to this fs but not from within. The remount does not survive a reboot, because the vold.fstab file will be read and they will be remounted at reboot with the noexec flags.

If you reformat any of your external storage to anything other than vfat, then they will not be remounted at reboot, and any apps that you have moved to any external storage will not be usable. If you don't intend to use external storage for apps then you can unmount your external storage and use busybox mke2fs DEVICE to make it ext2. Use busybox newfs_msdos DEVICE to return it to vfat and make it usable again.

Note busybox mkfs.vfat is broken, you will get something like

lseek: Value too large for defined data type

so don't waste your time. All of this assumes you are rooted, and have a working busybox binary.

 
 
5
 
vote

我意识到这是一个旧话题,但这里的一些答案实际上阻碍了我努力了解 fstab 和android,因为它们如此强烈意味着 fstab Android中的情​​况与其他Linux发行版非常不同。从我可以说的话,它不是。

然而,阅读不同的响应让我想知道:什么 fstab - 等效文件或文件在我的设备上?

踩回一瞬间,注意到" android没有/ etc / fstab " 可能对OP可能没有帮助,因为它们必须已经知道这个。如果这是不真实的,他们的问题(询问Android等同于 /etc/fstab 是什么)不会有任何意义。另一方面,我们知道@flow不是试图暗示Android上没有等同于android,因为他们提到了其中一个,一个名为 /etc/vold.fstab 的"帮助程序脚本" 。

一切,我认为从@ flow的帖子中的外带是在一些系统上,有一个文件(可能是一个"帮助者脚本" - 我无法验证在我的手机上)称为 /etc/vold.fstab ,以及在这些系统上,此文件是最接近的相同于 /etc/fstab

回到想知道我自己的设备,我将在这里发布我的发现,因为OP的年龄:

  • 首先,我想记录 abcdefghijklmnfstab -style文件的所有
  • 第二,我想向人们展示,特别是Linux / Android Newbies,这相当容易找到您自己的设备上的这些文件("将它们教为鱼" )。
  • 第三,写下我的发现有助于(奖金:我永远能够在stackexchange上再次找到它!)。
  • 最后,谷歌仍在为此页面提供服务,所以有机会,这将有助于其他人以外的人。

所以让我试着总结一下我所吸取的所有内容:

android,或者至少是我可以访问的变体,确实使用 fstab -style文件。但是,这些文件的确切名称,位置和功能因分发而异 - 由Android版本和设备的意思,以及如果您使用自定义ROM,则由ROM。

要在系统上查找这些文件,请打开终端仿真器,如 tmux fstab0 并运行类似的: fstab1 。文件2( fstab2 )重定向到 fstab3 将使您的输出更清晰,因为您将能够从 fstab4获取的错误消息的鼻塞。 ,即使您是 fstab5

在我的系统上(像素2xl,代码名称"taimen" ),我发现了三个候选文件:

  fstab6  

前两个是单独的文件中,也不是另一个符号链接到另一个,但如果 fstab7 他们会发现它们是相同的。如果您在文件中运行 fstab8 ,则看起来有点更深,您将看到它们具有相同的设备和inode值:

  fstab9  

fstab0 将这两个文件名报告为常规文件,每个文件只有一个链接(所以没有涉及硬或符号链接)。我不是文件系统专家,但此处发生了哪些设备已安装两次。您可以在以下命令的输出中看到它,其中两行输出之间的唯一差异是挂载点("开启之后的零件" ):

  fstab1  

如果我以root身份登录,则只能对我看起来是可见的,因此如果您的设备与我的设备相同,则除非您的手机植根,否则您仍然找不到或可以访问此文件。该文件与一个名为Open Mobile Alliance设备管理的服务有关,但这是一个我很少了解的服务,所以我只会在这里提及它,您可以谷歌了解有关您的详细信息,如果您想要的话。

 

I realize that this is an old topic, but some of the answers here actually hindered my efforts to learn about fstab and Android because they so strongly imply that the fstab situation in Android is extremely different from other Linux distributions. From what I can tell, it isn't.

However, reading different responses here made me wonder: what fstab-equivalent file or files are on my device?

Stepping back for a moment, noting that "Android has no /etc/fstab" is probably not helpful to the OP since they must have already known this. If this were untrue, their question (asking what the Android equivalent of /etc/fstab is) would not make any sense. On the other hand, we know @Flow was not trying to imply that there was no equivalent on Android, since they mentioned one of them, a "helper script" named /etc/vold.fstab.

All in all, I think the takeaway from @Flow's post is that on some systems, there is a file (possibly a "helper script" - I can't verify that on my phone) called /etc/vold.fstab, and on those systems, this file is the nearest equivalent to /etc/fstab.

Getting back to wondering about my own device, I am going to post my findings here for several reasons, in spite of the age of the OP:

  • First, I want to document all of the fstab-style files I can find on my phone, a Pixel 2XL.
  • Second, I want to show people, especially Linux/Android newbies, that it is fairly easy to find these files on your own device ("teach them to fish").
  • Third, it's helpful for me to write up my findings (bonus: I'll always be able to find it again here on StackExchange!).
  • Finally, Google is still serving this page up so there's a chance this will help someone other than me.

So let me try to sum up everything I have learned from all of this:

Android, or at least its variants that I have access to, does make use of fstab-style files. However, the exact name, location, and function of these files vary by distribution - meaning by Android version and device, and also by ROM if you use a custom ROM.

To find these files on your system, open up a terminal emulator like tmux or adb shell and run something like this: find / -type f -iname '*fstab*' 2>/dev/null. The redirection of file 2 (stderr) to /dev/null will make your output much cleaner as you will be able to ignore the onslaught of error messages you will get from find, even if you are root.

On my system (a Pixel 2XL, code name "taimen"), I found three candidate files:

taimen:/ # find / -type f -iname '*fstab*' 2>/dev/null  /sbin/.core/mirror/vendor/etc/fstab.taimen /vendor/etc/fstab.taimen /data/data/com.android.omadm.service/files/dm/dmt_data/fstab 

The first two are separate files in that neither is a hard or symbolic link to the other, but if you diff them you will find that they are identical. Looking a little deeper, if you run stat on the files you will see that they have the same Device and Inode values:

taimen:/ # stat /sbin/.core/mirror/vendor/etc/fstab.taimen /vendor/etc/fstab.taimen    File: `/sbin/.core/mirror/vendor/etc/fstab.taimen'   Size: 1326     Blocks: 16      IO Blocks: 512 regular file Device: fc00h/64512d     Inode: 925      Links: 1 Access: (644/-rw-r--r--)        Uid: (    0/    root)   Gid: (    0/    root) Access: 2009-01-01 02:00:00.000000000 Modify: 2009-01-01 02:00:00.000000000 Change: 2009-01-01 02:00:00.000000000    File: `/vendor/etc/fstab.taimen'   Size: 1326     Blocks: 16      IO Blocks: 512 regular file Device: fc00h/64512d     Inode: 925      Links: 1 Access: (644/-rw-r--r--)        Uid: (    0/    root)   Gid: (    0/    root) Access: 2009-01-01 02:00:00.000000000 Modify: 2009-01-01 02:00:00.000000000 Change: 2009-01-01 02:00:00.000000000 

stat reports both of these filenames as regular files with only one link each (so no hard or symbolic links are involved). I'm not a filesystem expert but what has happened here is that the same device has been mounted twice. You can see this in the output of the following command, where the only differences between the two lines of output in are the mount points (the part immediately after "on"):

taimen:/ $ mount | grep vendor  /dev/block/dm-0 on /vendor type ext4 (ro,seclabel,relatime,block_validity,delalloc,barrier,user_xattr) /dev/block/dm-0 on /sbin/.core/mirror/vendor type ext4 (ro,seclabel,relatime,block_validity,delalloc,barrier,user_xattr) 

The third file is only visible to me if I login as root, so if you have a device identical to mine, you still will not find, or have access to, this file unless your phone is rooted. That file has to do with a service called Open Mobile Alliance Device Management, but that is a service I know very little about, so I will just mention it here, and you can Google for details about that if you'd like.

 
 
   
   

相关问题

0  交换分区不适用于华为U8160运行Cyanogenmod 7.2  ( Swap partition not working on huawei u8160 running cyanogenmod 7 2 ) 
我有一个Huawei U8160(也称为:沃达丰858智能),它正在运行Cyanogenmod 7.2(由Madteam于2012年2月7日发布)。 更新到2/7/2012更新后,我发现一个选项要使用交换分区而不是compcache(压缩缓存),因此我将SD卡重新分区,以使用 mini工具分区向导大小和主要(我有一个...

2  TWRP:未能挂载'/ preload'(无效的参数)  ( Twrp failed to mount preload invalid argument ) 
使用twrp,几乎每个操作我得到 无法挂载'/ preload'(无效参数) 我的设备目前无法启动,这可能会与它有关, /preload 当前在 /etc/fstab 中,我可以在这里看到这里的条目 /dev/block/mmcblk0p16 /preload ext4 rw 0 0 当我尝试安装它时,...

1  / sd-ext突然重新安装在工作期间只读  ( Sd ext gets suddenly remounted read only during work ) 
我对Cyanogenmod 7.2(用少于斑点贴剂)和分区microSD卡(第一:脂肪,第二:Ext3)。 第二个分区会自动安装读/可写作 /sd-ext ,因为它应该是。 我正在使用S2E在这个ext3分区上存储我的应用程序和应用程序数据。 mount 命令显示,ext3分区不仅安装到 /sd-ext ,还为 /...

1  无法使用简单的MTPFS安装Galaxy S7(使用S4它用于工作正常)  ( Cannot mount galaxy s7 with simple mtpfs with s4 it used to work fine ) 
我想使用简单mtpfs 将我的三星Galaxy s7(sm-g930f)挂载到文件夹,我不能按照我曾经(上一个) Fedora和较旧的Galaxy S4)。 如果我只需将s7插入我的电脑,我可以使用Nautilius浏览它,但我无法在终端中访问它作为普通文件夹,究竟是什么需要实现的。 每次我插头s7我检查它在mt...

3  我可以在Android挂载LoopDevice吗?  ( Can i mount loopdevice in android ) 
我扎根了我的Android手机并获得shell thr adb。我想在Android中挂载一个ROM图像。但我总是失败: mount -o循环/sdcard/myimage.img / mnt 挂载:无法设置循环设备:没有这样的文件或目录 ...

0  Android X86>错误:Sysrq:紧急Remount R / 0 [复制]  ( Android x86 error sysrq emergency remount r 0 ) 
这个问题已经在这里有一个答案: 无法启动android-x86在pc - 紧急remount (1答) ...

29  什么是Android等同于/ etc / fstab?  ( Whats the android equivalent of etc fstab ) 
有时我真的希望他们这么多搞砸了Linux!我知道有一个 /etc/fstab 在某处,但在哪里? 我想用替代文件系统挂载一些分区(因为我不喜欢FAT32)。 ...

2  来自Android的SSHFS到NAS  ( Sshfs from android to nas ) 
我正在尝试通过 abcdefghijklmnabcdefghijklmnobcdefghijklmn0 安装到我的NAS上的文件夹上安装任何文件夹。目标将是例如 /sdcard/My Documents/My Recordings 文件夹设置,因此它几乎无限制了。我安装了通过 adb shell 连接。在 /data...

3  / data / sdext2安装未找到link2sd  ( Data sdext2 mount not found link2sd ) 
我安装了cm 7.2稳定(Android 2.3。)frome 这里。然后我遵循这个为link2sd准备我的SD卡。然后我在手机上安装了link2sd,并创建了ext2分区的挂载脚本。它生成精细,我重新启动了手机,但仍未安装ext2分区,它永远不会被安装。 Link2SD可获得root访问权限。 安装或创建脚本时不会...

0  如何修复“mount:'remount' - >'/ system':没有这样的文件或目录”?  ( How to fix mount remount system no such file or directory ) 
angler:/ # mount -o rw, remount /system mount: 'remount'->'/system': No such file or directory 1|angler:/ # 当我在手机中尝试在Kali Linux中: root@kali:~# mount -o ...




© 2022 it.wenda123.org All Rights Reserved. 问答之家 版权所有