安装:在 /mnt/sda2 上安装 /dev/sda2 失败:参数无效

安装:在 /mnt/sda2 上安装 /dev/sda2 失败:参数无效

我正在跟进本教程。但我卡在了第 9 步,不知何故我无法安装我的 USB。

每次我尝试安装 USB 时都会收到以下错误:

root@OpenWrt:~# mount /dev/sda2 /mnt/sda2
mount: mounting /dev/sda2 on /mnt/sda2 failed: Invalid argument

USB 似乎正常并已连接,但不知何故我无法安装 sda2 (ext4) 分区。

分区似乎也没有问题:

root@OpenWrt:~# blkid
/dev/mtdblock2: TYPE="squashfs"
/dev/sda1: UUID="e39964e8-1b51-4b1f-b034-0147fa394eea" TYPE="swap"
/dev/sda2: UUID="157cfc0d-f33d-4103-950d-6ae01baa7177" TYPE="ext4"

这是我的dmesg输出:

root@OpenWrt:~# dmesg | grep sda
[    9.360000] sd 0:0:0:0: [sda] 7987200 512-byte logical blocks: (4.08 GB/3.80 GiB)
[    9.370000] sd 0:0:0:0: [sda] Write Protect is off
[    9.370000] sd 0:0:0:0: [sda] Mode Sense: 23 00 00 00
[    9.370000] sd 0:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[    9.400000]  sda: sda1 sda2
[    9.410000] sd 0:0:0:0: [sda] Attached SCSI removable disk
[   41.850000] EXT4-fs (sda2): couldn't mount as ext3 due to feature incompatibilities
[   41.870000] EXT4-fs (sda2): couldn't mount as ext2 due to feature incompatibilities
[   41.880000] EXT4-fs (sda2): couldn't mount RDWR because of unsupported optional features (400)
[  270.660000] EXT4-fs (sda2): couldn't mount as ext3 due to feature incompatibilities
[  270.670000] EXT4-fs (sda2): couldn't mount as ext2 due to feature incompatibilities
[  270.670000] EXT4-fs (sda2): couldn't mount RDWR because of unsupported optional features (400)
[  585.040000] EXT4-fs (sda2): couldn't mount as ext3 due to feature incompatibilities
[  585.050000] EXT4-fs (sda2): couldn't mount as ext2 due to feature incompatibilities
[  585.060000] EXT4-fs (sda2): couldn't mount RDWR because of unsupported optional features (400)
[  586.540000] EXT4-fs (sda2): couldn't mount as ext3 due to feature incompatibilities
[  586.550000] EXT4-fs (sda2): couldn't mount as ext2 due to feature incompatibilities
[  586.560000] EXT4-fs (sda2): couldn't mount RDWR because of unsupported optional features (400)
[  651.570000] EXT4-fs (sda2): couldn't mount as ext3 due to feature incompatibilities
[  651.580000] EXT4-fs (sda2): couldn't mount as ext2 due to feature incompatibilities
[  651.590000] EXT4-fs (sda2): couldn't mount RDWR because of unsupported optional features (400)

这是我的fdisk -l输出:

WARNING: GPT (GUID Partition Table) detected on '/dev/sda'! The util fdisk doesn't support GPT. Use GNU Parted.


Disk /dev/sda: 4089 MB, 4089446400 bytes
255 heads, 63 sectors/track, 497 cylinders, total 7987200 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1     7987199     3993599+  ee  GPT

答案1

错误消息来自以下行<Linux kernel source code>/fs/ext4/super.c

        if (ext4_has_unknown_ext4_ro_compat_features(sb)) {
            ext4_msg(sb, KERN_ERR, "couldn't mount RDWR because of "
                     "unsupported optional features (%x)",
                     (le32_to_cpu(EXT4_SB(sb)->s_es->s_feature_ro_compat) &
                            ~EXT4_FEATURE_RO_COMPAT_SUPP));

错误消息中的数字的占位符是%x,因此实际错误消息中的数字 400 是十六进制的 0x400。如果特征由EXT4_FEATURE_RO_COMPAT_常量识别,则它是一种。

这些常量的定义可以在<Linux kernel source code>/fs/ext4/ext4.h

#define EXT4_FEATURE_RO_COMPAT_METADATA_CSUM    0x0400

dir_nlinksourcejedi提到的特征是0x20,而不是0x400 :

#define EXT4_FEATURE_RO_COMPAT_DIR_NLINK        0x0020

因此,MR3020 无法以读/写模式挂载文件系统,因为其操作系统无法处理 ext4 元数据校验和。因此,您需要使用用于创建 USB 记忆棒的 Linux 系统关闭该功能。将 USB 记忆棒移回该系统(不要挂载 ext4 文件系统)并运行:

tune2fs -O^metadata_csum /dev/sdX2

(将 X 替换为 Linux 系统中 USB 记忆棒的实际标识符。)

成功运行此命令后,该metadata_csum功能将在 USB 记忆棒的 ext4 文件系统中被禁用,并且 MR3020 现在应该能够使用它。

答案2

看来挂载尝试只尝试 ext3 和 ext2,而不是 ext4。你的内核中确实有 ext4 对吧? (它已列在 中/proc/filesystems。)您是否已将其/dev/sda2列为/etc/fstab外部3

答案3

我在 TL-MR3020 v3 上也遇到这个问题,我通过创建 ext3 分区而不是 ext4 解决了这个问题,并成功安装了驱动器。

这是我采取的步骤(按照OpenWRT网站上的步骤操作,只需将ext4替换为ext3):

root@OpenWrt:~# mkfs.ext3 /dev/sda1
mke2fs 1.44.5 (15-Dec-2018)
/dev/sda1 contains a ext4 file system
        created on Sun Sep 27 06:13:56 2020
Proceed anyway? (y,N) y
Creating filesystem with 511744 4k blocks and 128000 inodes
Filesystem UUID: 2bbb533d-925f-43fb-946a-4190fe612186
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912

Allocating group tables: done
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done

root@OpenWrt:~# block detect | uci import fstab
root@OpenWrt:~# uci set fstab.@mount[0].enabled='1' && uci set fstab.@global[0].anon_mount='1' && uci commit fstab
root@OpenWrt:~# /etc/init.d/fstab boot
root@OpenWrt:~# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                 2.5M      2.5M         0 100% /rom
tmpfs                    29.3M      1.1M     28.2M   4% /tmp
/dev/mtdblock4            3.8M      1.2M      2.5M  33% /overlay
overlayfs:/overlay        3.8M      1.2M      2.5M  33% /
tmpfs                   512.0K         0    512.0K   0% /dev
/dev/sda1                 1.9G      3.0M      1.8G   0% /mnt/sda1
root@OpenWrt:~#

我知道这是一个老问题,但也许会对某人有所帮助

答案4

你创建分区后用ext4格式化了吗?

mkfs.ext4 /dev/sda2

然后尝试挂载或通过显式指定文件系统类型使用 ext4 挂载mount -t ext4 /dev/sda2 /mnt/sda2

相关内容