2008年6月21日 星期六

節約,省電的好幫手:Cpufrequtils

最近常聽到節約,省電的口號,加上七月份電費要開始上漲,省電變成每台電腦的基本功能。

今天要介紹的就是要讓您的CPU降速、降溫度的好工具:cpufrequtils。

在kernel-2.6中,已經實作了動態調整CPU clock的kernel module:cpufreq,它支援Intel/AMD的CPU,小弟的CPU是Althon Dual Core 3600+,支援CnQ,在待機時可以降下速度,溫度也會降低。

首先,先安裝適當的module,以AMD的CPU而言,採用的是powernow-k8:
modprobe powernow-k8
modprobe cpufreq_ondemand

以及相關的cpufreq module,小弟採用的是ondemand模式,接下來,請安裝cpufrequitls,修改
/etc/default/cpufrequtils

加入
ENABLE="true"
GOVERNOR="ondemand"
MAX_SPEED=1900M
MIN_SPEED=1000M

或者直接修改/etc/init.d/cpufrequtils,內容如上。重新啟動cpufrequtils
/etc/init.d/cpufrequtils restart

執行cpufreq-info

analyzing CPU 0:
driver: powernow-k8
CPUs which need to switch frequency at the same time: 0 1
hardware limits: 1000 MHz - 1.90 GHz
available frequency steps: 1.90 GHz, 1.80 GHz, 1000 MHz
available cpufreq governors: powersave, conservative, userspace, ondemand, performance
current policy: frequency should be within 1000 MHz and 1.90 GHz.
The governor "ondemand" may decide which speed to use
within this range.
current CPU frequency is 1000 MHz.

出現上述字樣就表示cpufreq已經設定成功,檢查/proc/cpuinfo,您就會發現CPU的頻率會在1G~1.9G跳動,剩下的,就是好好享受cpufreq帶給你的便利性了. :-D

PS: cpufreq支援多種policy:
performance: 全速
powersave: 以最省電的方式調整CPU clock,大部份都在最低的頻率
ondemand: 依照CPU loading的程度動態調整,撥SD/HD的影片時,會跳動的最明顯。


PS2: 還有另一套cpufreqd,它是以daemon的方式運作,設定的內容更細,還能依照ACPI來監控電池容量改變CPU頻率,由於弟只有桌上型PC,所以cpufrequtils簡單的設定方法已經符合弟的需求了。

2008年6月18日 星期三

mhddfs: join several real filesystems together to form a single larger one

FYI
http://debaday.debian.net/2008/05/25/mhddfs-join-several-real-filesystems-together-to-form-a-single-larger-one/

該軟體的是利用FUSE(User space filesystem)這個module將多顆硬碟串成一個virtual device,而非像已往的Raid,LVM的方式,

他寫入的機制很簡單,假設有三顆硬碟:A,B,C。當寫入資料時,若資料大於A硬碟所餘的大小,就會換到第二顆。同理,第三顆硬碟的操作也是如此。

另外,當它寫入第一顆時,發現還有空間太小必須換另一顆硬碟時,會搬移剛剛寫入的資料到接續有足夠大小的硬碟。

雖然機制上沒有Raid, LVM那麼有效率和安全,但不失為一個單機版合拼硬碟的方法。

目前Debian testing/unstable已經有,Ubuntu尚未納入,參考看看