GCE 实例磁盘已满,即使调整大小后也无法登录

GCE 实例磁盘已满,即使调整大小后也无法登录

我们的网络服务器磁盘已满,无法登录实例。我们将磁盘大小从 10gb 调整为 100gb,但仍然无法登录。我尝试从快照创建新服务器,从映像创建新实例,甚至尝试将磁盘副本附加到现有服务器,这导致现有服务器也出现故障(我无法登录)。我假设分区需要调整大小,但鉴于我无法登录机器,这是不可能的。

启动日志(从串行端口提取)表明设备上没有剩余空间,但调整大小后应该有足够的空间。但是,我无法登录实例,即使通过串行端口也是如此。我们所有的博客都存储在这台服务器上,所以我需要一种方法来访问磁盘上的数据。

[  OK  ] Started Monitoring of LVM2 mirrors,…sing dmeventd or progress polling.
[    7.939339] systemd-journald[426]: Failed to open system journal: No space left on device
[    7.940946] systemd-journald[426]: Failed to open system journal: No space left on device
[    7.942235] systemd-journald[426]: Failed to open system journal: No space left on device
[    7.947117] systemd-journald[426]: Failed to open system journal: No space left on device
[    7.948522] systemd-journald[426]: Failed to open system journal: No space left on device
[  OK  ] Started udev [    7.951801] systemd-journald[426]: Failed to open system journal: No space left on device

Jul 14 08:57:59 webserver google-accounts: ERROR Exception calling the response handler. [Errno 2] No usable temporary directory found in ['/tmp', '/var/tmp', '/usr/tmp', '/'].#012Traceback (most recent call last):#012  File "/usr/lib/python3/dist-packages/google_compute_engine/metadata_watcher.py", line 200, in WatchMetadata#012    handler(response)#012  File "/usr/lib/python3/dist-packages/google_compute_engine/accounts/accounts_daemon.py", line 285, in HandleAccounts#012    self.utils.SetConfiguredUsers(desired_users.keys())#012  File "/usr/lib/python3/dist-packages/google_compute_engine/accounts/accounts_utils.py", line 318, in SetConfiguredUsers#012    mode='w', prefix=prefix, delete=True) as updated_users:#012  File "/usr/lib/python3.6/tempfile.py", line 681, in NamedTemporaryFile#012    prefix, suffix, dir, output_type = _sanitize_params(prefix, suffix, dir)#012  File "/usr/lib/python3.6/tempfile.py", line 269, in _sanitize_params#012    dir = gettempdir()#012  File "/usr/lib/python3.6/tempfile.py", line 437, in gettempdir#012    tempdir = _get_default_tempdir()#012  File "/usr/lib/python3.6/tempfile.py", line 372, in _get_default_tempdir#012    dirlist)#012FileNotFoundError: [Errno 2] No usable temporary directory found in ['/tmp', '/var/tmp', '/usr/tmp', '/']
Jul 14 08:58:22 webserver systemd[1]: snapd.service: Start operation timed out. Terminating.
Jul 14 09:00:06 webserver google-accounts: ERROR Exception calling the response handler. [Errno 2] No usable temporary directory found in ['/tmp', '/var/tmp', '/usr/tmp', '/'].#012Traceback (most recent call last):#012  File "/usr/lib/python3/dist-packages/google_compute_engine/metadata_watcher.py", line 200, in WatchMetadata#012    handler(response)#012  File "/usr/lib/python3/dist-packages/google_compute_engine/accounts/accounts_daemon.py", line 285, in HandleAccounts#012    self.utils.SetConfiguredUsers(desired_users.keys())#012  File "/usr/lib/python3/dist-packages/google_compute_engine/accounts/accounts_utils.py", line 318, in SetConfiguredUsers#012    mode='w', prefix=prefix, delete=True) as updated_users:#012  File "/usr/lib/python3.6/tempfile.py", line 681, in NamedTemporaryFile#012    prefix, suffix, dir, output_type = _sanitize_params(prefix, suffix, dir)#012  File "/usr/lib/python3.6/tempfile.py", line 269, in _sanitize_params#012    dir = gettempdir()#012  File "/usr/lib/python3.6/tempfile.py", line 437, in gettempdir#012    tempdir = _get_default_tempdir()#012  File "/usr/lib/python3.6/tempfile.py", line 372, in _get_default_tempdir#012    dirlist)#012FileNotFoundError: [Errno 2] No usable temporary directory found in ['/tmp', '/var/tmp', '/usr/tmp', '/']

答案1

调整虚拟机启动磁盘的大小后,大多数虚拟机都会调整根文件系统的大小并重新启动虚拟机。但是,对于某些虚拟机映像类型,您可能必须手动调整文件系统的大小。如果您的虚拟机不支持自动调整根文件系统大小,或者您调整了数据(非启动)持久磁盘的大小,则必须手动调整文件系统和分区的大小。

以下是一些故障排除步骤由于启动磁盘已满,无法访问虚拟机

答案2

我调整磁盘大小后,根分区没有调整大小,这是问题的根源。看来标准持久磁盘上的分区不会自动调整大小,而是平衡的,SSD 磁盘会自动调整大小。

最后,我克隆了磁盘并将其作为第二个磁盘(未安装)附加到新 VM,然后按照此处的说明调整分区大小。然后将新磁盘附加到新 VM。

https://medium.com/100-days-of-linux/how-to-resize-a-linux-root-file-system-af3e5096b4e4

相关内容