【问题标题】:Google Compute Engine safe_format_mount issue - specify the filesystem type errorGoogle Compute Engine safe_format_mount 问题 - 指定文件系统类型错误
【发布时间】:2014-10-20 04:51:27
【问题描述】:

我一直在关注关于在 GCE 中使用 MongoDB 的教程

http://docs.mongodb.org/ecosystem/platforms/google-compute-engine/

我为 MongoDB 存储创建了一个单独的 SSD 磁盘并将其附加到实例,但是当我尝试安全挂载时

sudo /usr/share/google/safe_format_and_mount \ -m "mkfs.ext4 -F -o defaults,auto,noatime,noexec" /dev/sdb /data

我收到此错误:

safe_format_and_mount: Running: fsck.ext4 -a /dev/sdb
safe_format_and_mount: fsck.ext4: Bad magic number in super-block while trying to open /dev/sdb
safe_format_and_mount: /dev/sdb: 
safe_format_and_mount: The superblock could not be read or does not describe a correct ext2
safe_format_and_mount: filesystem.  If the device is valid and it really contains an ext2
safe_format_and_mount: filesystem (and not swap or ufs or something else), then the superblock
safe_format_and_mount: is corrupt, and you might try running e2fsck with an alternate superblock:
safe_format_and_mount:     e2fsck -b 8193 <device>
safe_format_and_mount: 
safe_format_and_mount: Fsck could not correct errors on /dev/sdb
safe_format_and_mount: Running: mount -o discard,defaults /dev/sdb /data
safe_format_and_mount: mount: you must specify the filesystem type
/usr/share/google/safe_format_and_mount: line 83: file: command not found
safe_format_and_mount: Running: mkfs.ext4 -F -o defaults,auto,noatime,noexec /dev/sdb
safe_format_and_mount: mke2fs 1.42.5 (29-Jul-2012)
safe_format_and_mount: Discarding device blocks: done                            
safe_format_and_mount: mkfs.ext4: unknown os - defaults,auto,noatime,noexec
safe_format_and_mount: Format of /dev/sdb failed.
safe_format_and_mount: Running: mount -o discard,defaults /dev/sdb /data
safe_format_and_mount: mount: you must specify the filesystem type
safe_format_and_mount: Tried everything we could, but could not mount /dev/sdb.

但是当我删除默认值、auto、noatime、noexec 并只使用 mkfs.ext4 -F 时它可以工作。

但是如果我设置了 MongoDB 的 dbpath,MongoDB 服务器将无法启动。如果我们运行 MongoDB,它会给出坏扇区。

那么如何挂载额外的磁盘并使用 GCE 创建一个合适的 ext4 文件系统?

【问题讨论】:

    标签: mongodb google-compute-engine


    【解决方案1】:

    您提供的链接中似乎有错字:

    根据命令的帮助,正确的语法是:

    /usr/share/google/safe_format_and_mount [-f fsck_cmd] [-m mkfs_cmd] [-o mount_opts] <device> <mountpoint>
    

    如您所见,-m 参数用于指定对设备进行分区的选项,但"mkfs.ext4 -F -o defaults,auto,noatime,noexec" 混合了 mkfs 和 mount 参数。您需要先关闭双引号,然后您的命令应如下所示:

    sudo /usr/share/google/safe_format_and_mount -m "mkfs.ext4 -F" -o defaults,auto,noatime,noexec /dev/sdb /data/
    

    【讨论】:

      猜你喜欢
      • 2023-02-16
      • 2015-08-11
      • 1970-01-01
      • 1970-01-01
      • 2017-06-20
      • 1970-01-01
      • 1970-01-01
      • 2015-09-13
      • 2014-03-25
      相关资源
      最近更新 更多