這用到了 kernel-PAE,首先介紹一下什麼是 kernel-PAE?
操作系統在32bit x86平台上最大尋址空間只有4GB,如果要使用大於4GB的內存,就必須使用Intel的PAE(物理地址擴展)模式。在Windows NT平台實現PAE只需要對boot.ini加上/pae即可。而對於RHEL5/CentOS,缺省安裝模式下是不允許檢測超過4GB內存,所以我們需要在內核安裝完畢後再安裝kernel-PAE套件。
x86平台的硬件支持兩級頁表,Intel Pentium pro以上的型號均支持PAE和三級頁表,使得系統最大尋址達到36位,就是64GB的內存。但是系統進程運行時使用的永遠是虛擬地址,在32位字長的i386機器上,一個進程永遠無法訪問超出4G的字節。kernel只能通過拼湊的方式計算出大於4G的內存地址。
在Linux kernel配置項裡有High Memmory Support, 如果總內存小於等於1G的選"off",大於4G的選"64G"
Note: Linux can use up to 64 Gigabytes of physical memory on x86 systems. However, the address space of 32-bit x86 processors is only 4 Gigabytes large. Thus means that, if you have a large amount of physical memory, not all of it can be "permanently mapped" by the kernel. The physical memory that's not permanently mapped is called "high memory".
還有一項Allocate 3rd-level pagetables from highmem,使用這一項可以在內存很多(大於4G)的機器上將用戶空間的頁表放到高位內存區,以節約寶貴的低端內存。
具體如何操作才可以支持大內存?
1. yum install kernel-PAE
2. 安裝好後,更改一下啟動選項:
vi /boot/grub/grub.conf
如果看到類似如下代碼 代表PAE內核已經安裝好了
title CentOS (2.6.18-8.1.4.el5PAE)
root (hd0,0)
kernel /vmlinuz-2.6.18-8.1.4.el5PAE ro root=LABEL=/
initrd /initrd-2.6.18-8.1.4.el5PAE.img
修改設置為默認啟動
使 default=0
3. 重啟服務器 init 6
二.
[root@http://www.ctohome.com]# free
total used free shared buffers cached
Mem: 3881968 637928 3244040 0 111292 461680
-/+buffers/cache: 64956 3817012
Swap: 4192924 0 4192924
[root@http://www.ctohome.com]# yum install kernel-PAE
Loaded plugins: fastestmirror
Loading mirror speeds fromcached hostfile
centos-burstnet | 1.1 kB 00:00
updates-burstnet | 1.9 kB 00:00
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package kernel-PAE.i6860:2.6.18-194.32.1.el5 set to be installed
--> Finished DependencyResolution
Dependencies Resolved
================================================================================================================================================================================
Package Arch Version Repository Size
================================================================================================================================================================================
Installing:
kernel-PAE i686 2.6.18-194.32.1.el5 updates-burstnet 17 M
Transaction Summary
================================================================================================================================================================================
Install 1 Package(s)
Upgrade 0 Package(s)
Total download size: 17 M
Is this ok [y/N]: y
Downloading Packages:
kernel-PAE-2.6.18-194.32.1.el5.i686.rpm | 17 MB 00:01
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing :kernel-PAE 1/1
Installed:
kernel-PAE.i6860:2.6.18-194.32.1.el5
Complete!
[root@http://www.ctohome.com]# free
total used free shared buffers cached
Mem: 3881968 637928 3244040 0 111292 461680
-/+buffers/cache: 64956 3817012
Swap: 4192924 0 4192924
[root@http://www.ctohome.com]# vi /boot/grub/grub.conf
default=0 (把default=1改成default=0)
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS(2.6.18-194.32.1.el5PAE) (有這行PAE的就表示安裝pae內核成功)root (hd0,0)
kernel /vmlinuz-2.6.18-194.32.1.el5PAE ro root=LABEL=/
initrd /initrd-2.6.18-194.32.1.el5PAE.img
title CentOS(2.6.18-194.32.1.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-194.32.1.el5 ro root=LABEL=/
initrd /initrd-2.6.18-194.32.1.el5.img
title CentOS (2.6.18-194.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-194.el5 ro root=LABEL=/
initrd /initrd-2.6.18-194.el5.img
[root@http://www.ctohome.com]#reboot