【问题标题】:Cannot format and mount disk on GCE instance无法在 GCE 实例上格式化和挂载磁盘
【发布时间】:2014-04-29 22:56:12
【问题描述】:

我是第一次使用 Google Compute Engine 并尝试将其他磁盘附加到我的实例。我正在按照this page 上的说明进行操作,但没有运气。

这是我到目前为止所做的:

  1. 创建了一个 10GB 的磁盘 - 'test-disk'。我现在使用的是一个小磁盘,因为我只是第一次尝试。

  2. 用这个额外的磁盘启动了一个实例:

    $ ./bin/gcutil --service_version="v1" --project="my-project-id" ssh --zone="us-central1-a" "test-disk"

  3. 通过 SSH 登录实例并运行the safe_format_and_mount 命令。

    $ sudo mkdir /磁盘

    $ sudo /usr/share/google/safe_format_and_mount -m "mkfs.ext4 -F" test-disk /disk

此时我不断收到此错误:

safe_format_and_mount: Running: fsck.ext4 -a test-disk
safe_format_and_mount: fsck.ext4: No such file or directory while trying to open test-disk
safe_format_and_mount: test-disk: 
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 test-disk
safe_format_and_mount: Running: mount -o defaults test-disk /disk
safe_format_and_mount: mount: you must specify the filesystem type
safe_format_and_mount: Running: mkfs.ext4 -F test-disk
safe_format_and_mount: mke2fs 1.41.12 (17-May-2010)
safe_format_and_mount: mkfs.ext4: No such file or directory while trying to determine filesystem size
safe_format_and_mount: Format of test-disk failed.
safe_format_and_mount: Running: mount -o defaults test-disk /disk
safe_format_and_mount: mount: you must specify the filesystem type
safe_format_and_mount: Tried everything we could, but could not mount test-disk.

我使用的是 CentOS 6.0,我已禁用 SELINUX。除此之外,我没有做任何改变。任何帮助深表感谢。

谢谢。

【问题讨论】:

    标签: centos google-cloud-storage mount google-compute-engine


    【解决方案1】:

    这里有几件事要检查:

    首先确认您创建的附加磁盘的“源类型”为“无(空白磁盘)”(如果您是通过 Google Developers Console 创建的)。如果您通过 gcutil 创建磁盘,则不应在创建磁盘时指定“source_image”以创建空白磁盘。您可以通过在 Developers Console 中查看磁盘详细信息来确认 Persistent Disk 是否为空白磁盘。如果没有与磁盘关联的“源图像”,则它是空白磁盘。

    一旦你确认你有一个空白磁盘,下一个问题是 - 当你 ssh 进入实例并运行以下命令时,你看到磁盘的名称了吗?

    $ls -l /dev/disk/by-id/*
    

    如果没有,那么您需要在 Developers Console 中或使用 gcutil 将磁盘附加到实例。这是 gcutil 命令:

    gcutil --project=<project-id> attachdisk --zone=<zone> --disk=<disk-name>,[deviceName=<alias-name>,mode=<mode>] <instance-name>
    

    对于名为“test-instance”的实例,附加磁盘的命令应该是:

    gcutil --project="my-project-id" attachdisk --zone=us-central1-a --disk=test-disk test-instance
    

    如果您的磁盘 在您运行 ls -l /dev/disk/by-id/* 时列出,那么您可能只需要在 format_and_mount 命令中指定磁盘的完整路径。 鉴于您在问题中提到的值,format_and_mount 命令应如下所示:

    $sudo /usr/share/google/safe_format_and_mount -m "mkfs.ext4 -F" /dev/disk/by-id/scsi-0Google_PersistentDisk_test-disk /disk
    

    【讨论】:

      【解决方案2】:

      如果您尝试挂载先前附加到不同实例且在分离之前未从该实例卸载的磁盘,则有时磁盘挂载会失败。见this google clouddoc

      我发现解决它的一种方法是重新创建磁盘。

      【讨论】:

        猜你喜欢
        • 2017-12-01
        • 1970-01-01
        • 1970-01-01
        • 2017-10-28
        • 2016-11-15
        • 1970-01-01
        • 2014-01-17
        • 2013-04-04
        • 2017-10-16
        相关资源
        最近更新 更多