Google Cloud GCE 启动盘空间不足,先查容量还是 inode?

Linux 虚拟机出现「No space left on device」时,先确认写入失败的路径属于哪个文件系统。启动盘、数据盘和容器卷可能分别挂载,直接查看根目录容易查错对象。

Y

Written by

  • 23 November 2026
  • 1 min read
  • 0 views

Linux 虚拟机出现「No space left on device」时,先确认写入失败的路径属于哪个文件系统。启动盘、数据盘和容器卷可能分别挂载,直接查看根目录容易查错对象。

用实际写入路径定位挂载点

把下面的路径替换为应用实际写入的目录。若目标文件尚未创建,使用最近的已存在父目录。

findmnt -T /var/log

df -h /var/log

df -i /var/log

df -h 查看空间使用率,df -i 查看 inode。空间还有余量但 inode 耗尽时,常见原因是积累了大量小文件。先查应用日志、缓存和作业输出的保留策略。若空间确实用满,通过 du -x -h --max-depth=1 在目标挂载点内缩小范围,避免把其他文件系统算进去。

为什么删了文件,空间还是没回来?

如果 df 显示占用很高,但 du 找不到相应文件,可用 sudo lsof +L1 查找已删除但仍被进程打开的文件。先确认进程和文件用途,再按服务的运维流程让它重新打开日志或关闭文件。直接删除正在写入的日志可能让排障更困难。

扩盘后如何验收?

先在 Google Cloud 控制台核对要扩的是哪块盘,确认备份可用。扩容后,通过 lsblk 检查块设备和分区,再用 df -h 确认同一挂载点的文件系统容量。如果设备容量已增加、文件系统仍是旧大小,按实例的分区布局和文件系统类型继续处理。最后检查应用能否写入,并保留变更前后的容量记录。

更多运维笔记:谷歌云 GCE 专题站

https://yungcepro.com/

技术咨询:Telegram

https://t.me/ak6793

What do you think?

About the author

Y

Yang Li

@yli140657

Author and writer at CandyWrite. Sharing knowledge, tutorials, and reflections on technology, design, and ideas.

Join the conversation

Discussion0

Join the conversation. Sign in to leave a response or reply to comments.

No responses yet. Be the first to share your thoughts!

Liked this one? Get the best of the week.

One email a week with the most-read essays on CandyWrite. Free, and you can unsubscribe any time.