Centos 32bit系统只支持3GB内存的解决办法(让它支持4GB或更大内存)

作者:美云 发布日期:2015/6/22 22:38:03 浏览次数:7772 复制

操作系统在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