安裝:在 /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

相關內容