Ubuntu

設備錯誤上沒有剩餘空間

  • June 8, 2015

我無法再在我的數據庫中生成新列。我的堆棧在下面。我是管理自己的伺服器的新手,不熟悉 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

阿帕奇版本

Server version: Apache/2.4.7 (Ubuntu)

RVM 版本

rvm 1.26.4 (latest) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]

紅寶石版本

rvm rubies

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

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

您必須探索您的 HDD 並清理過時和/或未使用的文件。

最簡單的方法是停止所有服務,如 postgres/apache/postfix 等(以防止數據失去)並探勘目錄大小。命令

du -d 1 | sort -nr

列出目前位置的所有嵌套目錄及其大小。在某些迭代之後,您會找到太空販子,然後您將需要另一個建議 - 如何處理它們。

引用自:https://serverfault.com/questions/697453