Xen 中关于 32G 内存的两个问题

一台 48G 物理内存的服务器,上面做了 xen 虚拟化,重启之后不论是 free 还是 top 发现都只有 32G 的内存。

# free -m
total       used       free     shared    buffers     cached
Mem:         32768        961      31806          0         13        122
-/+ buffers/cache:        824      31943
Swap:         8095          0       8095

但是使用 xm info 查看得出的确实理想的结果:

# xm info

total_memory           : 49139
free_memory            : 15425

# xm list
Name                                      ID Mem(MiB) VCPUs State   Time(s)
Domain-0                                   0    32768     4 r—–     30.3
Continue reading

Generic kernel 和 Server Kernel

有一批机器,原本应该是 2.6.32-33-server 版本的内核,实际却是 2.6.32-33-generic。安装的版本为 Ubuntu-10.04.3-amd64。

server 版跟 generic(desktop) 的版本的差异主要体现在下面几个方面:

* The Server Edition uses the Deadline I/O scheduler instead of the CFQ scheduler used by the Desktop Edition.

* Pre-emption is turned off in the Server Edition.

* The timer interrupt is 100 Hz in the Server Edition and 250 Hz in the Desktop Edition.

* The Server Edition is optimised for i686 processors while the Desktop Edition is optimised for both the i586 and i686.

* Virtualization is better supported in the Server Edition through the enabling of IPC namespaces.

* Multiple routing tables for the IPv6 protocol are also supported in the Server Edition.

* For 32-bit systems the Server Edition is configured to use PAE which allows addressing up to 64GB of memory while the Desktop Edition is configured for 4GB.

* When running a 64-bit version of Ubuntu on 64-bit processors you are not limited by memory addressing space.

以上摘自官方的 serverguide

下面是根据 serverwatch 上对 server 和 generic 的 config 文件的测评大致翻译而来。他们使用的是 2.6.22-14 内核。
Continue reading

Linux 同步上游源

主要分为 debian 系和 rh 系,分别以 Ubuntu 和 CentOS 为代表。

ubuntu

使用 apt-mirror 这个 perl 脚本来同步上游的源:

# apt-get install apt-mirror

该工具默认是在 /var/spool/apt-mirror 下同步源。这里将其改为在 /opt 下:

# mkdir /opt/ubuntu
# mkdir /opt/ubuntu/{mirror,skel,var}
# cat /etc/apt/mirror.list
set base_path    /opt/ubuntu
set mirror_path $base_path/mirror
set skel_path    $base_path/skel
set var_path     $base_path/var
set cleanscript $var_path/clean.sh
set nthreads     20
set defaultarch  amd64
set _tilde 0

deb http://mirrors.ustc.edu.cn/ubuntu/ lucid main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ lucid-backports main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ lucid-proposed main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ lucid-security main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ lucid-updates main restricted universe multiverse
Continue reading

IP 被占用

Xen 启动后进入 DomU 后会出现下面的错误:

Error, some other host already uses address

经实践,并不是 ip 被占用。使用下面的这个方式可以解决问题,原理不明。

注释 /etc/sysconfig/network-scripts/ifup-eth 中下面的这段

if ! arping -q -c 2 -w 3 -D -I ${REALDEVICE} ${IPADDR} ; then
echo $”Error, some other host already uses address ${IPADDR}.”
exit 1
fi

网上有人说注释 /sbin/ifup 中的段,但是在 CentOS-5.6-x86_64 中并没有找到。

Cobbler 下安装 Ubuntu

更新: cobbler 2.2.3 安装 ubuntu 12.04


Cobbler 主要针对的是 RH 系,诸如 Red Hat Enterprise Linux,CentOS,Fedora。但是他也可以用来安装 Debian-based 的版本。

 

1. 下载 Ubuntu 镜像:

# wget http://mirrors.rit.edu/ubuntu-releases/lucid/ubuntu-10.04.2-server-amd64.iso

2. 挂载镜像:

# mount -o loop /home/isos/ubuntu-10.04.2-server-amd64.iso /media

3. 使用 rsync 将 ISO 同步至 /var/www/cobbler/ks_mirror/Ubuntu-lucid-x86_64:

# mkdir /var/www/cobbler/ks_mirror/Ubuntu-lucid-x86_64
# rsync -a /media/ /var/www/cobbler/ks_mirror/Ubuntu-lucid-x86_64 –exclude-from=/etc/cobbler/rsync.exclude
Continue reading