美文网首页
无法挂载的Ext4,because of unsupported

无法挂载的Ext4,because of unsupported

作者: 我要牛肉面面 | 来源:发表于2018-12-11 17:22 被阅读129次

    今天需要将一块硬盘安装到服务器上。硬盘上没有重要数据,但为保险起见我还是想先挂载上去看一下数据。
    尝试最简单的挂载命令:

    [root@localhost ~]# mount /dev/sdf1 /mnt/
    mount: wrong fs type, bad option, bad superblock on /dev/sdf1,
           missing codepage or helper program, or other error
           In some cases useful info is found in syslog - try
           dmesg | tail  or so
    

    emm... 我记得这块盘之前是格式化成ext4的啊,就算不是ext4也是ntfs,mount也不应该有问题啊。。。
    算了先看看文件系统是不是ext4吧:

    [root@localhost ~]# file /dev/sdf1
    /dev/sdf1: block special
    

    (错误命令,什么都看不到 ps: 此时需要的写法为file -sL /dev/sdf1-s -L分别表示分析special文件以及跟随连接)

    [root@localhost ~]# parted /dev/sdf
    GNU Parted 2.1
    使用 /dev/sdf
    Welcome to GNU Parted! Type 'help' to view a list of commands.
    (parted) unit s
    (parted) print
    Model: ATA ST5000LM000-2AN1 (scsi)
    Disk /dev/sdf: 9767541168s
    Sector size (logical/physical): 512B/4096B
    Partition Table: gpt
    
    Number  Start  End          Size         File system  Name            标志
     1      2048s  9756481535s  9756479488s  ext4         ST5000LM000-00
    
    (parted) q
    

    (也不对啊,这样看到的是分区表里记录的文件系统类型)
    好吧,回到原点,先看看挂载出错的日志:

    [root@localhost ~]# dmesg |tail
    sd 0:0:5:0: [sdf] physical block alignment offset: 4096
    sd 0:0:5:0: [sdf] 9767541168 512-byte logical blocks: (5.00 TB/4.54 TiB)
    sd 0:0:5:0: [sdf] 4096-byte physical blocks
    sd 0:0:5:0: [sdf] Write Protect is off
    sd 0:0:5:0: [sdf] Mode Sense: 73 00 00 08
    sd 0:0:5:0: [sdf] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
     sdf: sdf1
    sd 0:0:5:0: [sdf] Attached SCSI disk
    EXT4-fs (sdf1): couldn't mount RDWR because of unsupported optional features (200)
    EXT4-fs (sdf1): couldn't mount RDWR because of unsupported optional features (200)
    

    随手在某个不推荐假医院的网站搜索一下“couldn't mount RDWR because of unsupported optional features”,老外们遇到的多是features (400)。那么这次遇到的200又是什么呢。。。
    这个问答指出了400的含义:

    #define EXT4_FEATURE_RO_COMPAT_METADATA_CSUM    0x0400
    

    以及定义这个400的位置,跟进去然后Ctrl-F搜一下0200,发现如下定义:

    #define EXT2_MOUNT_NO_UID32     0x0200  /* Disable 32-bit UIDs */
    #define EXT4_FEATURE_COMPAT_SPARSE_SUPER2   0x0200
    #define EXT4_FEATURE_RO_COMPAT_BIGALLOC     0x0200
    #define EXT4_FEATURE_INCOMPAT_FLEX_BG       0x0200
    #define EXT4_DEFM_BLOCK_VALIDITY 0x0200
    

    其中BIGALLOC这一行下面紧接着的就是原问题中的METADATA_CSUM,看来就是这个原因了。

    回想一下当时这个文件系统是怎么创建的。。。
    当时考虑到ST5000LM000是一块Drive-managed SMR硬盘,于是参考了这篇文章下面的评论:

    Posted Apr 20, 2017 2:02 UTC (Thu) by Jonno (subscriber, #49613) [Link]

    The way that ext4 uses the disk is particularly bad for SMR devices, he said, because the metadata is spread across the disk.

    While that is indeed the default, you can easily create an ext4 file system with all metadata located at the very start of the disk. By using something like this all metadata of an 8 TB drive would be located within the first 2 GiB of the drive:
    > mkfs.ext4 -b 4k -C 64k -i 1M -E packed_meta_blocks=1 -O ^resize_inode,sparse_super2,bigalloc ...
    Obviously you still have the double write of all metadata, the second being random [within the first 2 GiB], so not really ideal for an SMR drive (just not quite as bad as the default config)...

    emm... 当时确实用到了sparse_super2以及bigalloc这些参数来着,在Ubuntu 16.04.x(x >= 4)上是支持的,而EL6不支持。
    那么我也大致知道里面装的是什么了,换台机器确认一下,然后在EL6上用默认参数重新格一下,性能是没法兼顾了。

    ps: 装硬盘之前没有在另一台机器上抹掉数据已经是不规范操作了,所以请不要问为什么直接用root账号操作,而不是sudo了。

    更新:
    此盘无负载挂机11天后挂掉,提示指令超时。此车已翻。数据未受影响。

    相关文章

      网友评论

          本文标题:无法挂载的Ext4,because of unsupported

          本文链接:https://www.haomeiwen.com/subject/nxhehqtx.html