ERROR: could not create directory "base/16386": No space left on device

ERROR: could not create directory "base/16386": No space left on device

当我尝试使用

创建数据库时收到同样的错误
CREATE DATABASE dwh;

createdb dwh;

即:

createdb: database creation failed: ERROR:  could not create directory "base/16385": No space left on device

ERROR:  could not create directory "base/16386": No space left on device

我在 aws 上使用 postgres AMI(PostgreSQL/Ubuntu 由 OpenLogic 提供)https://aws.amazon.com/marketplace/ordering/ref=dtl_psb_continue?ie=UTF8&productId=13692aed-193f-4384-91ce-c9260eeca63d&region=eu-west-1

配备 m2.xlarge 机器,应该有 17GB RAM 和 350GB SSD

根据提供的描述,您尚未将 Postgres /data 目录映射到实际的 350GB 分区。

如果您是 运行 生产服务器,首先 - 尝试清理日志(/pg_log 文件夹)以保存磁盘 space 并启动框正常运行并创建数据库备份。

运行 df -h 查看磁盘设备利用率和 lsblk 已安装到磁盘的内容。很有可能,AWS 默认情况下没有为您提供扩展的 350GB 卷。您有 2 个选择:

  • 添加新磁盘查看 Ubuntu add new drive procedure 并将其映射到您的 Postgres /data 文件夹
  • 尝试使用 resize2fs 执行现有文件系统的大小调整,相关 answer 可以在 AskUbuntu
  • 找到