设备错误,没有剩余空间

设备错误,没有剩余空间

我无法再在数据库中生成新列。我的堆栈如下。我是管理自己的服务器的新手,不熟悉 Apache、Ubuntu 和 AWS。目前我收到一条错误消息,提示我没有剩余空间。

看起来我的文件夹 /dev/xvda1 的容量已达到 100%。如何确定空间是如何分配的以及如何开辟更多空间?

如果您能帮助我分享更多信息,我将非常乐意与您分享。

我的错误

irb(main):107:0> Survey.generate_for_appointment(a, b)
PG::DiskFull: ERROR:  could not extend file "base/16402/25415": No space left on device
HINT:  Check free disk space.
: INSERT INTO "questions" ("choices", "content", "created_at", "position", "question_type", "survey_group", "survey_group_question_id", "survey_id", "updated_at") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9) RETURNING "id"
log writing failed. No space left on device @ io_write - /etc/projects/myapp/log/production.log
ActiveRecord::StatementInvalid: PG::DiskFull: ERROR:  could not extend file "base/16402/25415": No space left on device
HINT:  Check free disk space.

贮存

ubuntu@ip-172-31-33-140:/etc/projects/myapp$ sudo du -h --max-depth=1 /
4.0K    /media
752K    /tmp
0   /sys
9.6M    /bin
1.3G    /home
908M    /usr
4.0K    /mnt
20M /boot
24K /root
4.0K    /opt
3.7G    /etc
du: cannot access ‘/proc/7489/task/7489/fd/4’: No such file or directory
du: cannot access ‘/proc/7489/task/7489/fdinfo/4’: No such file or directory
du: cannot access ‘/proc/7489/fd/4’: No such file or directory
du: cannot access ‘/proc/7489/fdinfo/4’: No such file or directory
0   /proc
9.4M    /sbin
4.0K    /srv
16K /lost+found
60M /lib
12K /dev
649M    /var
4.0K    /lib64
212K    /run
7.5G    /

ubuntu@ip-172-31-33-140:/etc/projects/myapp$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/xvda1      7.8G  7.5G     0 100% /
none            4.0K     0  4.0K   0% /sys/fs/cgroup
udev            284M   12K  284M   1% /dev
tmpfs            59M  212K   59M   1% /run
none            5.0M     0  5.0M   0% /run/lock
none            295M     0  295M   0% /run/shm
none            100M     0  100M   0% /run/user

详细存储

ubuntu@ip-172-31-33-140:/etc/projects/myapp$ sudo du -x / | sort -n | tail -40
98880   /home/ubuntu/.rvm/rubies/ruby-2.1.2
98908   /home/ubuntu/.rvm/gems/ruby-2.1.2/gems/nokogiri-1.6.4.1
98908   /home/ubuntu/.rvm/rubies/ruby-2.1.5/lib
99436   /home/ubuntu/.rvm/rubies/ruby-2.1.5
107920  /home/ubuntu/.rvm/gems/ruby-2.1.2/gems/nokogiri-1.6.1/ext/nokogiri/tmp/x86_64-linux-gnu/ports
107924  /home/ubuntu/.rvm/gems/ruby-2.1.2/gems/nokogiri-1.6.1/ext/nokogiri/tmp/x86_64-linux-gnu
107928  /home/ubuntu/.rvm/gems/ruby-2.1.2/gems/nokogiri-1.6.1/ext/nokogiri/tmp
108520  /var/lib/apt/lists
108572  /var/lib/apt
111044  /usr/src
119420  /home/ubuntu/.rvm/gems/ruby-2.1.2/gems/nokogiri-1.6.1/ext/nokogiri
119424  /home/ubuntu/.rvm/gems/ruby-2.1.2/gems/nokogiri-1.6.1/ext
145780  /home/ubuntu/.rvm/gems/ruby-2.1.2/gems/nokogiri-1.6.1
146972  /var/cache
155528  /home/ubuntu/.rvm/gems/ruby-2.1.2/gems/passenger-4.0.45/buildout
155916  /usr/lib/x86_64-linux-gnu
158396  /etc/projects/myapp/public/assets
163068  /etc/projects/myapp/public
198320  /home/ubuntu/.rvm/rubies
200824  /home/ubuntu/.rvm/gems/ruby-2.1.2/gems/passenger-4.0.45
207540  /home/ubuntu/.rvm/gems/ruby-2.1.5/gems
231732  /var/lib
264856  /home/ubuntu/.rvm/gems/ruby-2.1.5
271292  /var/log/apache2
284432  /var/log
292684  /usr/share
403300  /usr/lib
583604  /home/ubuntu/.rvm/gems/ruby-2.1.2/gems
650888  /home/ubuntu/.rvm/gems/ruby-2.1.2
664560  /var
915752  /home/ubuntu/.rvm/gems
929616  /usr
1174228 /home/ubuntu/.rvm
1262052 /home/ubuntu
1262056 /home
3470180 /etc/projects/myapp/log
3782520 /etc/projects/myapp
3782524 /etc/projects
3789104 /etc
7795236 /

使用中的节点

ubuntu@ip-172-31-33-140:/etc/projects/myapp$ df -i
Filesystem     Inodes  IUsed  IFree IUse% Mounted on
/dev/xvda1     524288 153278 371010   30% /
none            75346      2  75344    1% /sys/fs/cgroup
udev            72620    381  72239    1% /dev
tmpfs           75346    266  75080    1% /run
none            75346      3  75343    1% /run/lock
none            75346      1  75345    1% /run/shm
none            75346      2  75344    1% /run/user

乘客版

Phusion Passenger version 4.0.55

Apache 版本

Server version: Apache/2.4.7 (Ubuntu)

RVM版本

rvm 1.26.4 (latest) by Wayne E. Seguin <[email protected]>, Michal Papis <[email protected]> [https://rvm.io/]

Ruby 版本

rvm rubies

   ruby-2.1.2 [ x86_64 ]
=* ruby-2.1.5 [ x86_64 ]

# => - current
# =* - current && default
#  * - default

答案1

您必须探索您的硬盘并清理过时和/或未使用的文件。

最简单的方法是停止所有服务,如 postgres/apache/postfix 等(以防止数据丢失),然后深入研究目录大小。命令

du -d 1 | sort -nr

列出当前位置的所有嵌套目录及其大小。经过一定次数的迭代后,您将发现空间贩子,然后您将需要另一条建议 - 如何处理它们。

相关内容