1. linux硬碟緩存大小應該怎麼查看
Linux中要查看硬碟緩存大小,可以使用hdparm命令。
1、在終端中執行如下命令。
sudohdparm-I/dev/sdb
2、執行效果如下圖所示,其中cache/buffer
size行即為緩存大小。
說明:-I:直接讀取硬碟所提供的硬體規格信息,/dev/sdb指的電腦中的第二塊硬碟。
3、hdparm常用參數及說明如下:
-a<快取分區>:設定讀取文件時,預先存入塊區的分區數,若不加上<快取分區>選項,則顯示目前的設定;
-A<0或1>:啟動或關閉讀取文件時的快取功能;
-c<I/O模式>:設定IDE32位I/O模式;
-C:檢測IDE硬碟的電源管理模式;
-d<0或1>:設定磁碟的DMA模式;
-f:將內存緩沖區的數據寫入硬碟,並清楚緩沖區;
-g:顯示硬碟的磁軌,磁頭,磁區等參數;
-h:顯示幫助;
-i:顯示硬碟的硬體規格信息,這些信息是在開機時由硬碟本身所提供;
-I:直接讀取硬碟所提供的硬體規格信息;
-k<0或1>:重設硬碟時,保留-dmu參數的設定;
-K<0或1>:重設硬碟時,保留-APSWXZ參數的設定;
-m<磁區數>:設定硬碟多重分區存取的分區數;
-n<0或1>:忽略硬碟寫入時所發生的錯誤;
-p<PIO模式>:設定硬碟的PIO模式;
-P<磁區數>:設定硬碟內部快取的分區數;
-q:在執行後續的參數時,不在屏幕上顯示任何信息;
-r<0或1>:設定硬碟的讀寫模式;
-S<時間>:設定硬碟進入省電模式前的等待時間;
-t;評估硬碟的讀取效率;
-T:平谷硬碟快取的讀取效率;
-u<0或1>:在硬碟存取時,允許其他中斷要求同時執行;
-v:顯示硬碟的相關設定;
-w<0或1>:設定硬碟的寫入快取;
-X<傳輸模式>:設定硬碟的傳輸模式;
-y:使IDE硬碟進入省電模式;
-Y:使IDE硬碟進入睡眠模式;
-Z:關閉某些Seagate硬碟的自動省電功能。
2. 怎樣查看linux cache內容
一、Linux下查看CPU Cache級數,每級大小
(1) 第一種方法:
dmesg | grep cache
(2) 第二種方法:
[root@gc15 ~]# ls /sys/devices/system/cpu/cpu0/cache/index
index0/ index1/ index2/ index3/
一級cache, Data cache
index0和Index1是一級cache中的data和instruction cache
[root@gc15 ~]# cat /sys/devices/system/cpu/cpu0/cache/index0/level
1
[root@gc15 ~]# cat /sys/devices/system/cpu/cpu0/cache/index0/type
Data
[root@gc15 ~]# cat /sys/devices/system/cpu/cpu0/cache/index0/size
32K
一級cache, Instruction cache
[root@gc15 ~]# cat /sys/devices/system/cpu/cpu0/cache/index1/level
1
[root@gc15 ~]# cat /sys/devices/system/cpu/cpu0/cache/index1/type
Instruction
[root@gc15 ~]# cat /sys/devices/system/cpu/cpu0/cache/index1/size
32K
二級cache,共享的
[root@gc15 ~]# cat /sys/devices/system/cpu/cpu0/cache/index2/level
2
[root@gc15 ~]# cat /sys/devices/system/cpu/cpu0/cache/index3/type
Unified
[root@gc15 ~]# cat /sys/devices/system/cpu/cpu0/cache/index2/size
256K
三級cache,共享的
[root@gc15 ~]# cat /sys/devices/system/cpu/cpu0/cache/index3/level
3
[root@gc15 ~]# cat /sys/devices/system/cpu/cpu0/cache/index3/type
Unified
[root@gc15 ~]# cat /sys/devices/system/cpu/cpu0/cache/index3/size
12288K
3. linux cached內存過大
cached主要負責緩存文件使用, 日誌文件過大造成cached區內存增大把內存佔用完 .
Free中的buffer和cache:(它們都是佔用內存):buffer : 作為buffer cache的內存,是塊設備的讀寫緩沖區cache: 作為page cache的內存, 文件系統的cache如果 cache 的值很大,說明cache住的文件數很多。
手動釋放
cached
To free pagecache:
echo 1 > /proc/sys/vm/drop_caches
To free dentries and inodes:
echo 2 > /proc/sys/vm/drop_caches
To free pagecache, dentries and inodes: echo 3 > /proc/sys/vm/drop_caches
4. 如何查看Linux磁碟空間大小
Ubuntu 查看文件以及磁碟空間大小管理
(1)查看文件大小
查看當前文件夾下所有文件大小(包括子文件夾)
-sh
#-h
15M./package
16K./.fontconfig
4.0K./.cache
5.1M./.rpmdb
20M.