Google-Compute-Engine 虚拟机实例:添加磁盘后无法登录/SSH 虚拟机实例 [英] Google-Compute-Engine Virtual Machine Instance: Unable to login/SSH the VM instance after adding a disk

查看:63
本文介绍了Google-Compute-Engine 虚拟机实例:添加磁盘后无法登录/SSH 虚拟机实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

GCP 虚拟机实例:操作系统:Ubuntu(18.04 仿生)磁盘大小:10GB.后来又加了一个10GB的磁盘.

GCP VM instance: OS: Ubuntu (18.04 bionic) Disk size: 10GB. Later added another disk of 10 GB.

在处理 GCP 虚拟机实例时,我遇到了没有剩余磁盘空间"的问题.然后,我创建了另一个 10 GB 的磁盘并添加到这个 GCP VM 实例中,如 https://cloud.google.com/compute/docs/disks/add-persistent-disk?&_ga=2.217520658591252068592.-1610658595958585955458585955485858554561658585854552416662.-1617520662.-1058520662.-1058595688.1590395241#formatting" rel="nofollow noreferrer">https://cloud.google.com/compute/docs/disks/add-persistent-disk

While working on the GCP VM instance, I was facing the issue for 'no-disk space left'. Then, I created another disk of 10 GB and added to this GCP VM instance as referred in https://cloud.google.com/compute/docs/disks/add-persistent-disk?&_ga=2.217520662.-1058595688.1590395241#formatting

现在,我退出了 GCP 虚拟机实例并停止了它.

Now, I exited the GCP VM instance and stopped it.

后来,当我重新启动 GCP 虚拟机实例时,我无法连接.我尝试使用 GCP、putty、WinSCP 和 telnet 上可用的 SSH 连接选项进行连接,但现在无法连接.

Later on, when I restarted the GCP VM instance, I am unable to connect. I tried to connect using the SSH connection option available on GCP, putty, WinSCP and telnet, but I am unable to connect now.

我对此的理解是,GCP 虚拟机实例上的某些服务可能已停止.有没有办法检查服务是否在 GCP VM 实例上运行.如果是,那怎么办?

My understanding to this is that it might be possible that some services might have stopped on the GCP VM instance. Is there a way to check whether the services are running or not on the GCP VM instances. If yes,then how?

如果您认为连接到 GCP 虚拟机实例还有其他问题,请告诉我.

If you think, there is some other issue for connecting to the GCP VM instance then please let me know.

推荐答案

可能有几个原因;

  1. 防火墙规则 - 检查它们以确保没有阻止 SSH 流量到你的机器.
  2. 查看串行控制台输出 - 您可以通过控制台 gui 或 gcloud compute instances get-serial-port-output instance_name --zone=my_zone 来完成.
  1. Firewall rules - check them to be sure nothing blocks SSH traffic to your machine.
  2. Have a look at the serial console output - you can do it via console gui or gcloud compute instances get-serial-port-output instance_name --zone=my_zone.

如果您的驱动器已满,您可能无法登录(无论如何).

If your drive gets full you may not be able to login (no matter how).

如果第一个磁盘已满,添加另一个持久磁盘将无济于事.

Adding another persistend disk won't help if the first one is full.

您可以增加它的大小 -也可以通过控制台或 gcloud 计算磁盘调整大小 example-disk-1 --size=11GB - 这将增加 1GB,如果是磁盘空间问题,它应该允许您登录.<​​/p>

You can increase it's size though - also via console or gcloud compute disks resize example-disk-1 --size=11GB - this will add 1GB more and if it's the matter of disk space it should allow you to log in.

  1. 如果您仍然无法登录,请尝试 启用与串行控制台的交互 gcloud compute instances add-metadata instance-name --metadata serial-port-enable=TRUE 并连接到它 gcloud compute connect-to-serial-端口实例名称,因为如果其他一切都失败了,这是最全面的方法.
  1. If you're still not able to log in try enabling interaction with serial console gcloud compute instances add-metadata instance-name --metadata serial-port-enable=TRUE and connect to it gcloud compute connect-to-serial-port instance-name since this is the most full-proof method if everything else fails.

如果您能够通过串行控制台连接,请检查 SSH 服务是否正在侦听:

If you're able to connect via serial console check if the SSH service is listening:

sudo service ssh status - 如果不是用 sudo service ssh start 启动它并注意任何错误.

sudo service ssh status - if not start it with sudo service ssh start and watch for any errors.

也讨论了类似的情况 此处.

Similar case was also discussed here.

这篇关于Google-Compute-Engine 虚拟机实例:添加磁盘后无法登录/SSH 虚拟机实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆