記憶體不足還是磁碟空間不足?

記憶體不足還是磁碟空間不足?

我正在運行一個失敗的資料庫載入進程(osm2pgsql):

Processing: Node(17404k 148.8k/s) Way(1351k 6.38k/s) Relation(9520 29.94/s)way_done failed: ERROR:  could not extend file "base/140667/152463": No space left on device
HINT:  Check free disk space.
(7)
Arguments were: 187226311, 

導入開始時,mem報告:

             total       used       free     shared    buffers     cached
Mem:           31G        29G       2.4G         0B       178M        24G
-/+ buffers/cache:       4.5G        26G
Swap:           0B         0B         0B

接近結束時:

             total       used       free     shared    buffers     cached
Mem:           31G        31G       227M         0B       178M        26G
-/+ buffers/cache:       4.8G        26G
Swap:           0B         0B         0B

同時,df在開始時:

Filesystem     1K-blocks      Used Available Use% Mounted on
/dev/vda1       10309828   7879412   1997036  80% /
udev            16470572        12  16470560   1% /dev
tmpfs            6590080       260   6589820   1% /run
none                5120         0      5120   0% /run/lock
none            16475196         0  16475196   0% /run/shm
none              102400         0    102400   0% /run/user
/dev/vdb       247709760 105978300 129148548  46% /mnt

從整個過程的大約 3/4 開始。使用率為 100%。

Filesystem     1K-blocks      Used Available Use% Mounted on
/dev/vda1       10309828   9854348     22100 100% /
udev            16470572        12  16470560   1% /dev
tmpfs            6590080       260   6589820   1% /run
none                5120         0      5120   0% /run/lock
none            16475196         0  16475196   0% /run/shm
none              102400         0    102400   0% /run/user
/dev/vdb       247709760 105978300 129148548  46% /mnt

我無法識別磁碟上填充 /dev/vda1 的任何實際檔案:

du -h -d 3 / 2>/dev/null | grep -v ^0 > /tmp/o2p1.txt
[start import]
du -h -d 3 / 2>/dev/null | grep -v ^0 > /tmp/o2p2.txt

diff /tmp/o2p1.txt /tmp/o2p2.txt

那什麼也沒透露。

這是怎麼回事?

答案1

好吧,這很簡單。 Postgres 資料庫位於 /dev/vda1 上並且變得越來越大。它沒有出現在du命令中,因為我沒有以 root 身份運行它。

我猜想在磁碟填滿後,Postgres 會停止保存到磁碟並將其全部保留在記憶體中 - 直到記憶體也耗盡。

相關內容