我是第一次使用Google Compute Engine并尝试将其他磁盘附加到我的实例.我按照本页面上的说明没有运气.
这是我到目前为止所做的事情:
创建了一个10GB的磁盘 - "测试盘".我现在正在使用一个小磁盘,因为我只是第一次尝试.
使用此附加磁盘启动了一个实例:
$ ./bin/gcutil --service_version ="v1"--project ="my-project-id"ssh --zone ="us-central1-a""test-disk"
通过SSH登录到实例并运行the safe_format_and_mount
命令.
$ sudo mkdir/disk
$ 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 8193safe_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.除此之外,我没有做任何改变.任何帮助深表感谢.
谢谢.
以下是一些要检查的事项:
如果您是通过Google Developers Console创建的,则首先确认您创建了"源类型"为"无(空白磁盘)"的附加磁盘.如果您是通过gcutil创建磁盘,则在创建磁盘时不应指定"source_image"以创建空白磁盘.您可以通过查看Developers Console中的磁盘详细信息来确认永久磁盘是否为空白磁盘.如果没有与磁盘关联的"源映像",则它是一个空白磁盘.
一旦确认您有空白磁盘,下一个问题是 - 当您进入实例并运行以下命令时,您是否看到磁盘的名称?
$ls -l /dev/disk/by-id/*
如果没有,则需要将磁盘附加到Developers Console中的Instance或使用gcutil.这是gcutil命令:
gcutil --project=attachdisk --zone= --disk= ,[deviceName= ,mode= ]
对于名为"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