问题描述
我一直在关注有关将MongoDB与GCE一起使用的教程,
I have been following the tutorial about using MongoDB with GCE from
http://docs.mongodb.org/ecosystem/platforms/google-compute-engine/
我为MongoDB存储创建了一个单独的SSD磁盘,并将其附加到实例,但是当我尝试安全挂载时
I created a separate SSD disk for MongoDB storage and attached it to instance but when I tried to safe mount
sudo/usr/share/google/safe_format_and_mount \ -m"mkfs.ext4 -F -o默认值,自动,noatime,noexec"/dev/sdb/data
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.
但是当我删除默认值时,自动,noatime,noexec并仅使用mkfs.ext4 -F即可.
but when I remove defaults, auto, noatime, noexec and just use mkfs.ext4 -F it works.
但是,如果我设置了MongoDB的dbpath,MongoDB服务器将无法启动.如果我们运行MongoDB,则会产生错误的扇区.
But if i set the dbpath of MongoDB, MongoDB server can't start. If we run MongoDB it gives bad sector.
那么如何使用GCE挂载更多磁盘并创建正确的ext4文件系统?
So how to mount additional disk and create a proper ext4 filesystem with GCE?
推荐答案
您提供的链接中似乎有错字:
Looks like there is a typo in the link you provide:
根据命令的帮助,正确的语法是:
As per the help of the command, the correct syntax is:
/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参数.您需要先关闭双引号,并且命令应如下所示:
As you can see there, the -m
parameter is used to specify the options to partition the device but "mkfs.ext4 -F -o defaults,auto,noatime,noexec"
mixes mkfs and mount parameters. You need to close the double quotes before and your command should look like:
sudo /usr/share/google/safe_format_and_mount -m "mkfs.ext4 -F" -o defaults,auto,noatime,noexec /dev/sdb /data/
这篇关于Google Compute Engine safe_format_mount问题-指定文件系统类型错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!