Linux

為什麼 /dev 滿了?

  • December 20, 2013

/dev.. 已滿:

SERVER:/dev # df -mP /dev
Filesystem         1048576-blocks      Used Available Capacity Mounted on
udev                     12042     12042         0     100% /dev

沒有佔用空間的文件!

SERVER:/dev # find . -ls | sort -r | head -2
2790517    0 -rw-r--r--   1 root     root            0 Dec 16 10:04 ./devnull
1490005831    0 -rw-------   1 root     root            0 Dec 16 07:54 ./nul
120387    0 lrwxrwxrwx   1 root     root           12 Dec 03 05:42 ./disk/by-uuid/xx..foo..xx -> ../../dm-13
SERVER:/dev # du -sm * 2>/dev/null | sort -nr | head -4
1   shm
0   zero
0   xconsole
0   watchdog

交換被大量使用:

SERVER:/dev # free -m
        total       used       free     shared    buffers     cached
Mem:         24083      23959        124          0        327      21175
-/+ buffers/cache:       2455      21627
Swap:        10245      10245          0

已刪除但仍使用的文件(?):

SERVER:/dev # lsof /dev | grep deleted
su         4510   bar   14u   REG    0,14 6269616128 2689827477 /dev/shm/kdfoo.a4o (deleted)
grep       4512       root    1u   REG    0,14 6269616128 2689827477 /dev/shm/kdfoo.a4o (deleted)
bash       4517   bar   14u   REG    0,14 6269616128 2689827477 /dev/shm/kdfoo.a4o (deleted)
sh         4606   bar   14u   REG    0,14 6269616128 2689827477 /dev/shm/kdfoo.a4o (deleted)
ksh       24134       root    1u   REG    0,14 6329864192 2685851781 /dev/shm/foo5.44m (deleted)
ksh       29209       root    1u   REG    0,14 6269616128 2689827477 /dev/shm/kdfoo.a4o (deleted)
su        29571   bar   14u   REG    0,14 6329864192 2685851781 /dev/shm/foo5.44m (deleted)
grep      29573       root    1u   REG    0,14 6329864192 2685851781 /dev/shm/foo5.44m (deleted)
bash      29578   bar   14u   REG    0,14 6329864192 2685851781 /dev/shm/foo5.44m (deleted)
sh        29694   bar   14u   REG    0,14 6329864192 2685851781 /dev/shm/foo5.44m (deleted)
SERVER:/dev # 

我的問題:“udev on /dev type tmpfs (rw)”的所有 12 GB 空間是什麼用完了?

共享記憶體使用的是 12GB。

在文件系統的 Linux 版本/dev/shm部分/dev(在某些版本中,它有自己的專用文件系統安裝在那裡)。

如 所示lsof,總和為 12 GB:

/dev/shm/foo5.44m is 6269616128 bytes   
/dev/shm/kdfoo.a4o is 6269616128 bytes

find不能ls顯示這些文件,因為它們未連結(= 它們的名稱已被刪除)。

引用自:https://unix.stackexchange.com/questions/105387