Rocky Linux9 キャッシュを確認、解放する方法

環境
Rocky Linux release 9.0 (Blue Onyx)

操作方法
1.ページキャッシュを確認します(-m : megabyteで表示)

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# free -m
total used free shared buff/cache available
Mem: 1748 1056 236 30 456 502
Swap: 2047 608 1439
# free -m total used free shared buff/cache available Mem: 1748 1056 236 30 456 502 Swap: 2047 608 1439
# free -m
               total        used        free      shared  buff/cache   available
Mem:            1748        1056         236          30         456         502
Swap:           2047         608        1439

2.単位付きで表示したい場合は-h オプションを付けると確認します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# free -h
total used free shared buff/cache available
Mem: 1.7Gi 1.0Gi 227Mi 30Mi 456Mi 494Mi
Swap: 2.0Gi 608Mi 1.4Gi
# free -h total used free shared buff/cache available Mem: 1.7Gi 1.0Gi 227Mi 30Mi 456Mi 494Mi Swap: 2.0Gi 608Mi 1.4Gi
# free -h
               total        used        free      shared  buff/cache   available
Mem:           1.7Gi       1.0Gi       227Mi        30Mi       456Mi       494Mi
Swap:          2.0Gi       608Mi       1.4Gi

3.キャッシュを解放します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# sudo sh -c "echo 3 > /proc/sys/vm/drop_caches"
# sudo sh -c "echo 3 > /proc/sys/vm/drop_caches"
#  sudo sh -c "echo 3 > /proc/sys/vm/drop_caches"

4.再度キャッシュの状態を確認します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# free -h
total used free shared buff/cache available
Mem: 1.7Gi 1.0Gi 507Mi 34Mi 186Mi 511Mi
Swap: 2.0Gi 608Mi 1.4Gi
# free -h total used free shared buff/cache available Mem: 1.7Gi 1.0Gi 507Mi 34Mi 186Mi 511Mi Swap: 2.0Gi 608Mi 1.4Gi
#  free -h
               total        used        free      shared  buff/cache   available
Mem:           1.7Gi       1.0Gi       507Mi        34Mi       186Mi       511Mi
Swap:          2.0Gi       608Mi       1.4Gi

 

Rocky Linux 9

Posted by arkgame