Disk 完整
错误信息
能不 extend file: 否空间左 on device
快速摘要
服务器's disk 有运行 out 的空间 — 数据库 cannot 编写新 数据, WAL logs, or temporary files.
为什么发生
disk 是完整 due 到数据 growth
事务 logs (WAL) 有 grown 也大
Temporary files 从大 排序是 filling disk
Backups or log files 是 consuming disk 空间
最小示例
# Disk is full — database cannot write
INSERT INTO logs (message) VALUES ('new event');
# → ERROR: could not extend file: No space left on device# Free up space first
df -h # check disk usage
rm /var/log/app/old_logs/*.log # remove old logs
# Now the insert can succeed
INSERT INTO logs (message) VALUES ('new event');Freeing disk 空间 (e.g., 移除旧 log files) 允许数据库到 编写再次.
如何诊断
检查 disk 空间:
df -h检查大小的 数据 directory and WAL logs
Identify 大表:
SELECT pg_size_pretty(pg_total_relation_size('表'))检查 for 旧 backups or log files 那个能 是 cleaned 上
如何修复
Free 上 disk 空间 — 移除旧 backups, logs, and temporary files
Increase disk 大小
Archive or partition 旧数据到 separate storage
Clean 上 WAL logs or adjust retention 设置
如何预防
Monitor disk usage and alert 之前它 reaches 80-90%
设置 automated log rotation and backup retention policies
Use 表 partitioning 到 manage 大 datasets
计划 capacity based on 数据 growth projections
相关资源
相关术语
相关课程
- 数据库 Overview
学习关于数据库操作.