内存排查手册

硬盘

  • 资源

    df -hT -x tmpfs -x devtmpfs -x squashfs
  • 目录占用

    sudo du -h --max-depth=1 / 2>/dev/null | sort -hr | head -20

内存资源

x99@x99:~$ free -h

               total        used        free      shared  buff/cache   available
内存:          39Gi        30Gi       1.8Gi       1.6Gi       8.8Gi       8.5Gi
交换:         8.0Gi       673Mi       7.3Gi

占用top(静态)

  • 原始信息
x99@x99:~$ ps aux --sort=-%mem | head

USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
x99      3407690 17.4 71.9 86286524 29443164 ?   Sl   09:54   3:00 /www/llama/data/strata/home/.local/share/strata/components/engine/0.1.52-linux-x86_64-cuda-cuda12/strata --serve --pack /www/llama/data/strata/packs/gyro-gyro-m --native /www/llama/data/models_sata/agentionai/Qwen3.8-Flash-Next-Gyro-GGUF/_strata-view/Qwen3.8-Flash-Next-Gyro-M-TQ2_0.gguf --ple-gguf /www/llama/data/models_sata/agentionai/Qwen3.8-Flash-Next-Gyro-GGUF/_strata-view/Qwen3.8-Flash-Next-Gyro-M-TQ2_0.gguf --expert-profile /www/llama/data/strata/build/terminal/data/expert-profile.bin --expert-cache auto --prefill auto --spec 4 --max-context 102400 --kv q4_0 --resident-experts --kv-resident 32768
gdm         2795  0.7  0.6 5039888 250248 tty1   Sl+  9月07 538:26 /usr/bin/gnome-shell
x99      3407663  0.9  0.5 924780 207596 ?       Ssl  09:54   0:09 /www/llama/data/strata/build/terminal/python/bin/python3.12 /www/llama/data/strata/build/terminal/strata.py serve --profile launch-v100-qwen38-125b-strata100k --host 0.0.0.0 --port 8080
root        2025  0.2  0.2 4876100 98004 ?       Ssl  9月07 194:09 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
x99      3016175  0.1  0.1 1440976 66500 ?       Ssl  10月27   1:31 /usr/local/bin/gitea -c /var/lib/gitea/custom/conf/app.ini web
root     3012708  0.5  0.1 1513536 64892 ?       Ssl  10月27   4:27 /mihomo
root         511  0.0  0.1 165836 46696 ?        S<s  9月07   2:24 /usr/lib/systemd/systemd-journald
root     3012758  0.0  0.0 11202208 38712 ?      Ssl  10月27   0:10 node /app/.output/server/index.mjs
root        3191  0.3  0.0 1621248 35996 ?       Sl   9月07 259:45 tailscaled --socket=/tmp/tailscaled.sock --statedir=/var/lib/tailscale --tun=userspace-networking
  • 简化信息
x99@x99:~$ ps -eo pid,user,%mem,rss,comm --sort=-%mem | head -n 11 | awk 'NR==1{printf "%-8s %-10s %-6s %-10s %s\n","PID","USER","%MEM","RSS","COMMAND"; next} {rss=$4; if(rss>=1048576) r=sprintf("%.1fG",rss/1048576); else if(rss>=1024) r=sprintf("%.1fM",rss/1024); else r=rss"K"; printf "%-8s %-10s %-6s %-10s %s\n",$1,$2,$3,r,$5}'

PID      USER       %MEM   RSS        COMMAND
3407690  x99        71.9   28.1G      strata-host
2795     gdm        0.6    244.4M     gnome-shell
3407663  x99        0.5    202.7M     python3.12
2025     root       0.2    95.7M      dockerd
3016175  x99        0.1    64.9M      gitea
3012708  root       0.1    58.9M      mihomo
511      root       0.1    45.6M      systemd-journal
3012758  root       0.0    37.8M      node
3191     root       0.0    35.2M      tailscaled
1600     root       0.0    34.9M      containerd
  • 详细信息
x99@x99:/www/llama$ ps -eo pid,ppid,user,%cpu,%mem,rss,vsz,ni,stat,nlwp,etime,comm --sort=-rss | head -n 11 | awk 'function h(k){if(k>=1048576)return sprintf("%.1fG",k/1048576);if(k>=1024)return sprintf("%.1fM",k/1024);return k"K"} function sw(p, l,a,v){v="-";while((getline l<("/proc/"p"/status"))>0){if(l~/^VmSwap:/){split(l,a,/[ \t]+/);v=a[2];break}}close("/proc/"p"/status");return v} function wc(p, w){w="-";if((getline w<("/proc/"p"/wchan"))>0){if(w=="")w="0"}close("/proc/"p"/wchan");return w} NR==1{printf "%-8s%-8s%-8s%-6s%-6s%-8s%-8s%-8s%-4s%-6s%-6s%-12s%-16s%s\n","PID","PPID","USER","%CPU","%MEM","RSS","VSZ","SWAP","NI","STAT","THR","ELAPSED","COMMAND","WCHAN";next} {s=sw($1);printf "%-8s%-8s%-8s%-6s%-6s%-8s%-8s%-8s%-4s%-6s%-6s%-12s%-16s%s\n",$1,$2,$3,$4,$5,h($6),h($7),(s=="-"?"-":h(s+0)),$8,$9,$10,$11,$12,wc($1)}'

PID     PPID    USER    %CPU  %MEM  RSS     VSZ     SWAP    NI  STAT  THR   ELAPSED     COMMAND         WCHAN
3407690 3407663 x99     4.0   71.9  28.1G   82.3G   0K      0   Sl    49    01:15:47    strata-host     futex_do_wait
2795    2331    gdm     0.7   0.6   246.4M  4.8G    42.6M   0   Sl+   28    50-22:01:49 gnome-shell     0
3407663 3407662 x99     0.4   0.5   202.7M  903.1M  0K      0   Ssl   7     01:15:54    python3.12      hrtimer_nanosleep
2025    1       root    0.2   0.2   95.8M   4.7G    18.0M   0   Ssl   44    50-22:01:50 dockerd         0
3016175 3016051 x99     0.1   0.1   64.9M   1.4G    33.4M   0   Ssl   8     14:38:06    gitea           futex_do_wait
3012708 3012683 root    0.5   0.1   56.5M   1.4G    5.4M    0   Ssl   8     14:42:44    mihomo          0
511     1       root    0.0   0.1   45.8M   161.9M  1.1M    -1  S<s   1     50-22:02:00 systemd-journal 0
3012758 3012733 root    0.0   0.0   37.8M   10.7G   5.6M    0   Ssl   7     14:42:44    node            0
1600    1       root    0.2   0.0   35.3M   4.0G    4.6M    0   Ssl   40    50-22:01:54 containerd      0
3191    2751    root    0.3   0.0   35.2M   1.5G    11.6M   0   Sl    10    50-22:01:48 tailscaled      0