3

I'm following this tutorial. But I got stuck at step 9, somehow I'm not able to mount my USB.

Every time I try to mount my USB I get the following error:

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

The USB seems to be OK and connected but somehow I'm not able to mount the sda2 (ext4) partition.

The partitions seems to be OK as well:

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"

And this is my dmesg output:

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)

This is my fdisk -l output:

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
  • where is /dev/sda2 in the fdisk output? – Rui F Ribeiro Oct 31 '16 at 23:04
  • Well I left my stuff home, so I'm not able to check now, but fdisk -l only showed the linux-swap partition /dev/sda1... I'm having some trouble with ext4 types it seems. Before inserting the USB I first had to install opkg install kmod-fs-ext4. Possible it has to do something with that? – Erik van de Ven Nov 1 '16 at 10:02
  • you need to show your kernel version (uname -r), and the version of mkfs.ext4 that was used to create the filesystem. A short explanation of the general error can be seen in the comment here: tutel.me/c/unix/questions/287159/… There's another post specific to feature 400, to me it suggests that flag 400 is the feature dir_nlink, but it's not 100% clear. tosiek.pl/… – sourcejedi Aug 9 '17 at 10:39
  • 1
    Did you try mount -t ext4 yet? – Zeta Jan 1 '18 at 20:45
2

The error message comes from this line in <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));

The placeholder for the number in the error message is %x, so the number 400 in the actual error message is hexadecimal 0x400. And it is one if the features identified by the EXT4_FEATURE_RO_COMPAT_ constants.

The definitions for those constants can be found in <Linux kernel source code>/fs/ext4/ext4.h:

#define EXT4_FEATURE_RO_COMPAT_METADATA_CSUM    0x0400

The dir_nlink feature mentioned by sourcejedi is 0x20, not 0x400:

#define EXT4_FEATURE_RO_COMPAT_DIR_NLINK        0x0020

So, the MR3020 could not mount the filesystem in read/write mode because its operating system cannot handle ext4 metadata checksums. So you'll need to turn that feature off using the Linux system you used to create the USB stick. Move the USB stick back to that system (don't mount the ext4 filesystem) and run:

tune2fs -O^metadata_csum /dev/sdX2

(replace X with whatever is the actual identifier of the USB stick in your Linux system.)

After running this command successfully, the metadata_csum feature will be disabled in the USB stick's ext4 filesystem, and the MR3020 should now be able to use it.

1

It seems the mount attempt only tries ext3 and ext2, not ext4. You do have ext4 in your kernel right? (It's listed in /proc/filesystems.) Could it be that you have /dev/sda2 listed in /etc/fstab as ext3?

  • Yes, ext4 is listed in /proc/filesystems, but /etc/fstab contains only one line: # WARNING: this is an auto generated file, please use uci to set defined filesystems – Erik van de Ven Oct 31 '16 at 22:39
  • That should be ok. So it's something else then. Hm ... – Göran Uddeborg Oct 31 '16 at 22:45
  • 1
    fdisk cannot handle GPT. parted -l – user192526 Nov 1 '16 at 19:54
0

Did you format it with ext4 after creating the partition?

mkfs.ext4 /dev/sda2

Then try mounting or mounting with ext4 by explicitly specifying the filesystem type mount -t ext4 /dev/sda2 /mnt/sda2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.