Google Compute Engine safe_format_mount issue - specify the filesystem type error

a 夏天 提交于 2019-12-13 00:49:35

问题


I have been following the tutorial about using MongoDB with GCE from

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

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 defaults,auto,noatime,noexec" /dev/sdb /data

I get this error:

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.

but when I remove defaults, auto, noatime, noexec and just use mkfs.ext4 -F it works.

But if i set the dbpath of MongoDB, MongoDB server can't start. If we run MongoDB it gives bad sector.

So how to mount additional disk and create a proper ext4 filesystem with GCE?


回答1:


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>

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/


来源:https://stackoverflow.com/questions/25512996/google-compute-engine-safe-format-mount-issue-specify-the-filesystem-type-erro

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!