LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 6378|回复: 1

¤绝对原创¤红帽子认证第二章 安装计划和硬件选择 2003.1.10

[复制链接]
发表于 2003-1-10 08:50:50 | 显示全部楼层 |阅读模式
¤绝对原创¤红帽子认证第二章2003.1.10  
声明:  
本文的中文版权属于译者probing所有  
你可以随便使用和补充资料但请注明译者,前提是不要用在商业用途上.如果用于商业请与我联系.  
probinger@21cn.com zhoubinn@yeah.net  
做为redhat的非官方的补充学习资料,通过以认证资料的学习为主线来贯串整个有关的知识.  
原英文资料目前你可以从www.linuxsir.cn的发行版redhat专题中找到  
本文不遵循任何条约,但在全部完成后可能会有改变.  
特别注意:  
如果你在阅读本文档时发现所写的内容与你所知不符或者你觉得错处太多或者在该用专业术语的地方却被不明确的词语代替,请原凉,因为译者的水平有限,但是任推荐你阅读本文档,因为好的教科书好找,但是撰文让你挑错的文档难寻,但这也不是说译者没有认真的做这件事.^-^  
别的论坛及网站请勿转载 如要转载请和linuxsir及我联系(方式是去linuxsir上发贴注明要求)  
翻译说明:  
本人不保证这些翻译是完全正确的,也不保证它对你有用,虽然我想保证.  
由于本人水平有限,本文中必然存在许多错误和不当之处,本人欢迎你对此修改  
所以,我采用中英文对照方式,便于大家查询使用文档.
文档约定:  
本文档随时更新,如要确定你拿到的是否是最新的版本请看标题旁的修改时间  
类似(*注,....)的内容就是原英文资料没有的,是译者的补充  
有些经验参照了linuxsir上兄弟们的经验,如果你按步就班的出了问题不要来问我,请到www.linuxsir.cn上发贴询问.  
本文档首先考虑的是基于理论上的完整性,但在适当的地方译者会放上实际操作中可能出现的问题及解决的办法,当然本人觉的这更象个大杂烩而不太象一个标准的文档,但这也没有什么关系,重要的是你知道了新的东西,你的知识又充足了一点.  
基于译者的机器配置如下  
主板 磐英EPOX BX3  
处理器 intel celeron433超541  
显卡 国产金鹰TNT2PRO版 32M  
声卡 国产青苹果CMI8738  
显示器 三星550S  
硬盘 IBM 桌面之星系列15.3G + 希捷ST32120A 2.1G  
内存 KINGMAX64M + KINGMAX128M  
光驱 国产狮王50x  
软驱 三星1.44M  
鼠标 普通双飞燕3D  
键盘 ACER  
系统 redhat8.0硬盘完全安装 英文版
主板 大众FIC VL601
处理器 intel celeron433
显卡 国产金鹰TNT2PRO版 32M  
声卡 国产青苹果CMI8738  
显示器 三星550S  
硬盘 IBM 桌面之星系列15.3G + 希捷ST U5 20G
内存 KINGMAX64M + KINGMAX128M +HY64M
光驱 国产狮王50x  
软驱 三星1.44M  
鼠标 普通双飞燕3D  
键盘 ACER  
系统 redhat8.0硬盘完全安装 英文版
红帽子认证工程师辅导教程  
(第二版) 翻译robing  
第二章 准备安装分区  

具体目标  
2.01 安装计划  
2.02 Intel CPU 的硬件选择和配置  

软件包安装  
硬盘分区  
硬件的兼容性  
内存设置调整和高速缓存寄存器  
驱动器系统 (IDE, EIDE, and SCSI)  
IRQ 设置  
IRQs 和标准端口序列表  
标准的和其他的Mice界面  
PC卡(PCMCIA)  

红帽子的一个优点就是它很容易安装.它有若干种不同的安装选项,每一种选项都最大限度的自动化了.然而,在实际的安装之前,仍然需要要做一些准备.  
(*注:为了能较好的理解以后将讨论的内容有必要先了解linux的主要文件目录及作用:  
  ( )中的内容基于REDHAT8.0完全安装加了少数应用程序的系统,所以实际安装应该小些.  
/bin:存放着一百多个Linux下常用的命令、工具 (7.8M)  
  /dev:存放着Linux下所有的设备文件! (416.1KB)  
  /home:用户主目录,每建一个用户,就会在这里新建一个与用户同名的目录,给该用户一个自己的空间 (根据你的实际情况来了)  
  /lost+found:顾名思义,一些丢失的文件可能可以在这里找到  
  /mnt:外部设备的挂接点,通常用cdrom与floppy两个子目录!它的存在简化了光盘与软盘的使用。你只需在塞入光盘后,运行:mount /mnt/cdrom,就可以将光盘上的内容Mount到/mnt/cdrom上,你就可以访问了。不过你使用完成后,应该离开该目录,并执行umount /mnt/cdrom。同样的,软盘就是  mount /mnt/floppy和umount /mnt/floppy了。  
  /proc:这其实是一个假的目录,通过这里你可以访问到内存里的内容。(191.9M,是偶的内存大小)  
  /sbin:这里存放着系统级的命令与工具 (16.8M)  
  /usr:通常用来安装各种软件的地方 (3.7G)  
  /usr/X11R6 X Window目录 (140M)  
  /usr/bin与/usr/sbin 一些后安装的命令与工具 (268.8M 47.2M)  
  /usr/include、/usr/lib及/usr/share 则是存放一些共享链接库 (67.3M 1.5GB 1.2GB)  
  /usr/local 常用来安装新软件 (301.5M)  
  /usr/src Linux源程序 (116.9M)  
  /boot:Linux就是从这里启动的 (12.8M)  
  /etc:这里存放Linux大部分的配置文件 (12.4M)  
  /lib:静态链接库 (126.4M)  
  /root:root用户的主目录,这就是特权之一!  
  /var:通常用来存放一些#变化中的东西! (131.5M)  
  /var/log:存放系统日志 (21M)  
  /var/spool:存放一些邮件、新闻、打印队列等 (1.2M)  
  另外,要说明的是,在Linux下"当前目录"、"路径"等概念与Windows下是一样的。  
注 这部分的内容直接取自linuxsir的教程,偶的分区是/7.8G/home6.8G/swap 480M  
由于在以下的讨论中有些翻译不准确,所以你应该先看看专业术语的解释,这有助于你能正确的判断文档的正确性.  
1 存储器  
所有系统都有一个存储器层次结构,在这个层次结构的不同层上有不同速度和大小的存储器.速度最快的存储器就是我们所知道的高速缓存.就像听起来的那样,它是用来暂时保留或缓存主存储器内容的存储器.这种存储器速度很快但也很贵,所以大多数系统有少量的片上(on-chip)缓存和稍多的系统级(板上)缓存.有的处理器用一个缓存保存指令和数据,但其它的处理器有两个缓存,一个指令缓存和一个数据缓存.Alpha AXP处理器就有两个内部缓存:一个是数据的(D-Cache),一个是指令的(L-Cache).外部缓存(B-Cache)将两者结合在了一起.最后是主存储器,相对外部缓存来说是很慢的.相对于CPU片上缓存,主存慢的就象爬一样.  
高速缓存和主存储器必须保持同步(一致).也就是说,如果主存储器的一个字保存在高速缓存的一个或多个位置,则系统必须要保证高速缓存和主存储器的内容是相同的.高速缓存一致性的工作一部分由硬件完成,一部分有操作系统完成,许多主要的系统任务也是这样,要求硬件和软件配合来达到目标.  
你可以看看现在的关于英特尔CPU的规格介绍(去中关村在线上就可找到)有助于理解这些内容.  
2 进程  
一个进程可以被想象成一个运行的程序,每个进程都是一个运行特定程序的独立实体.如果你察看一下linux系统上的进程,就会发现有许多进程.例如,开启一个终端,键入$:ps 回车.  
如果机器中有许多CPU,那么每个进程就能(至少理论上能)在不同的cpu上运行.不幸的是只有一个cpu,所以操作系统又得使用技巧,把每个进程依次运行一段很短的时间.这一段时间就是我们所知的时间片(time-slice).这个技巧叫做多进程或调度,它骗使每个进程都以为自己是唯一的进程.进程相互之间受到保护,所以当一个进程崩溃或出错时不会影响其它的进程.操作系统通过给每个进程一个独立的,只有它自己能访问的地址空间来达到这个目的.  
所以,今天运用了多线程技术的Pentuim4可以让你在一台机器上看到两个或多个CPU!COOL!  

CERTIFICATION OBJECTIVE 2.01  
安装计划  
在安装任何软件之前,计算机应该有能被识别的可用的硬件.安装程序将会向你询问这些硬件的信息,所以以下数据是你在开始之前要准备的.  
如果你有以下的硬件你应该知道它们每一个的制造商,工作模式:  
SCSI 控制器  
网卡 (NIC)  
显示卡  
声卡  
你或许还需要其他的信息,如基本的I/O地址和每个硬件用的中断.在本章的结尾我们将讨论linux的硬件兼容问题.  

Packages to Be Installed  
软件包的安装  
红帽子可以很方便的管理编译软件包.很可能的是你将不需要安装这些软件包,即使是因为安全(或是官方说明)声明这不是一个好主意.你的老板可能不赞同安装了阿帕奇网络服务器的办公室网络被用来为一个个人的网页服务.同时,你的网络上的所有的计算机不需要运行innd网络新闻服务。  

仅仅安装你需要的那些软件包.如果以后还需要安装的话,rpm工具可以很方便的安装.  


硬盘分区  

建议在安装linux之前先在硬盘上划分好分区.因为各种各样的原因这是一个好主意.首先,红帽子的运行要两个文件系统:一个是linux交换空间,一个是linux本地文件系统.第二,如果你要在同一台机器上安装红帽子和其它的操作系统你必须为它们分别创建不同的分区.  

接下来的章节将讨论这样分区的优点.  
稳定而安全  
linux的本地文件系统(nativefilesystem)通常是在硬盘的分区中分别划分的.推荐配置是为这些目录分别划分不同的分区/,/usr,/tmp,/var,特别的/home和公司数据,数据库服务,甚至网络和ftp站点,如果你希望它们占有更多的空间就要为它们划分不同的分区.  
以这种方式分区来保持系统文件,用户文件,应用程序相互独立互不干扰.这些有助于保证linux内核和应用程序的文件空间.文件不能跨越分区.因此,一个应用程序占据了巨大了磁盘空间,例如新闻组服务器,那么linux内核将没有磁盘空间可用了.另外一个优点是如果硬盘上有坏点的时候,恢复一个单独的分区比恢复整个系统要容易的多.  
改进了安全性.给你的多个分区仅让你能访问一些文件而已.例如,没有理由让任何一个用户(甚至root)可以改写/usr目录,让这些分区处于仅限访问将有助于保护这些文件不被串改.  
这儿有许多种分区方案,但是却不一定是你所希望的方案.对单用户系统,或是磁盘空间紧张的,将要求一个简单的文件系统规划.例如:给目录/var划分了300M的磁盘空间,但是可能它只使用了100M的空间,这就造成了200M的空间被浪费了.对于RH7.X,加上ftp和web目录到/var内,将会另外需要磁盘空间.  
目前没有一个简单直接的办法来设置linux分区.所以当你想为硬盘分区时你必须要很小心谨慎的去做.  

分区需要多少空间?  

你应该按照你的需要和计算机的功能来划分空间.例如,在目录/var中设置一个邮件服务目录为/var/spool/mail,那么邮件服务将需要一些空间来运行.你或许想创建一个单独的分区来容纳/var/spool/mail.对于RH7.X文件管理已经在/var中加入了ftp和web服务.对于/var这需要额外的磁盘空间.普遍的,跟分区是适度的大小,而别的则倚赖于系统的使用和功能来划分.  
例证:文件服务器  
如果你要把你的linux装成文件服务器,那你的文件系统应该看起来像如Table 2-1.  
文件系统 大小 挂载点  
Filesystem Size (MB) Mounted on  
/dev/sda1 400 /  
/dev/sda5 2000 /var  
/dev/sda6 300 /usr  
/dev/sda7 60 Swap space  
/dev/sda8 1000 /home  
/dev/sda9 3000 /home/shared  
Table 1: Example Disk Partition Scheme for a Linux File Server  
(*注,sd**等是指的scsi接口的硬盘)  
/var文件系统有足够大来安装各种服务.还有X11,当然如果你需要这玩意.大多数的磁盘空间分配给了/var,日志文件,FTP和HTTPD服务,对于/home,用户自己的文件,对/home/shared,共用的文件.当然,这仅仅是一个例子.你划分给共享文件的磁盘空间的大小倚赖用户的数目和使用的文件类型.  

linux交换分区  
通常的,linux能支持最大4GB的交换分区.这4GB可以推广到最多8个分区.注意:每个交换分区被限制最大2GB.  
(*注:为什么是4GB的限制呢?解读微型计算机2002年NO.20Page92:bug现象owerVR KYRO 2 显卡在Abit KG7主板上搭配4GB DDR内存使用时会出现开机即死的现象.BUG分析:内存容量若高达4GB时,系统所能使用的内存范围将只能到3.5GB,这个限制是由于PC构架所造成的,而消失的0.5GB内存地址则是用来保留给PCI I/O空间,AGP材质映射空间以及其它设备的I/O空间,也因此,即使AMD761的规格宣称最大支持的内存容量有4GB,但实际上插上4根1GB的内存条,系统也只能够使用3.5GB.换句话说,BIOS和操作系统会会报只有3.5GB内存.而这里遇到的则是硬件兼容性问题.已知解决办法:在BIOS设置界面里将AGP Aperture Size由原来的预设值64M改为256M即可解决此问题.尽管讲的是物理内存,但交换分区就相当是LINUX模拟的内存,所有偶想存在的问题也就在这里吧,有没有兄弟知道的也请告之,偶将在修订版内注明.)

没有权威的准则来判定应该使用多大的交换分区,但是你可以采取基于标准的UNIX的约定,交换分区应该是实际物理内存的2到3倍.硬盘空间相对RAM来说便宜呀.  
(*注:这个意思是否和上面的话有冲突呢?偶估计不是,这样的计算机当然是用来做服务器或超级微型机的了,灵活的来看问题,如果你坚持要用2-3倍的交换分区,那就带着问题看完以后的章节吧,如果还不能解决你的困惑,可以去LINUX的相关网站咨询.)  

系统所使用的最大内存数取决于你运行的所有程序所需要的内存的总和.你可能还拿不定主意你到底需要多大的内存.你可能需要买些你负担的起的内存了.花在内存上的钱相对你花在调试一个反应迟钝的系统上的时间来说还是便宜呀.(*注:很著名的理论渥,时间就是金钱!)linux可以较好的运行在32M内存,64M内存会有很好的效果,128M内存,那太不可思议了.(*注:偶感到有点可笑,7.X系列在偶的机器上没有飞起来,8.0让偶感觉到一分钱一分货,但分析一下,如果去掉不用的程序,关掉不用的服务,重新按照本机的配置编译内核的话应该会有这个效果,装完windows要优化,可是linux偶觉得应该是按需来装,8.0完全安装4.7G,功能齐全,如果要windows达到同样的功能会怎样?对7.x和8.0完全安装使用Xwindows的用户偶建议的内存为128M和256M会有较好的结果)  
对于采用Pentium 1级别及其以下的处理器,linux支持1GB的内存寻址.新的Pentium II和高版本的系统采用linux kernel 2.2可以支持4GB的内存(采用企业级内核).RED HAT 7.1采用新的2.4版内核,在 Pentium II和高版本的系统上内存已经扩展到可支持64GB!(*注:难以置信的64GB!偶看偶的8.0的内核是2.4.18版,目前最新的有2.5版了,不知道有多大的突破.但是现在我们的问题是如上段文章说讲的,这的问题是4GB的限制到底存在么?还是在硬件上有不同,在超级计算机系统中不存在这个问题?有待正确的解答!另,选用Pentium4的朋友应该采用7.2版本以上,如想发挥Pentium4的超线程技术(好象是3.06GH以上的才有)强大威力就的选RED HAT 8.0了,看见自己的机器里有两颗Pentium4绝对的酷!)  
任何要使用的程序使用的随机可寻址的内存的总数量是可使用的物理内存加上交换分区空间的和.通常的情况下linux的实用程序占用的很小,但是除了象数据库服务,读取巨大的数据到内存中,在做某些事情的时候甚至使用全部的可使用内存.同样的,影像处理和尖端图形制表都会占据系统大量的内存.(*注:这段翻译的不太准确,但大概的意思也就是这些了,看不看原文都无所谓的了)  
如前所建议的你必须有一些交换分区;两到三个普通随机存储器(*注:也就是今天的内存条了).当物理内存充足的时候linux优先使用这些,仅当物理内存不够是才把交换分区做为附加的内存来使用.内存的页已经给当时最重要的使用了并且试图优先使用实际的可用的物理内存以防止内存耗尽.Pages of memory that haven't been used for a significant amount of time will be swapped out in an attempt to utilize as much physical memory as possible.(*注:这段偶也只能照着感觉来了,放上原文大家一起来看看,根据整段话的意思偶觉得可以理解为,linux将内存的一部分分配给具有优先权的指令,并试图把别的不重要的数据转存在交换分区,这样就可以防止物理内存耗尽,随时可有可用的物理使用了).
实际上你不希望你的系统频繁的使用交换分区.如果交换分区太频繁的使用,你应该加些内存了.交换分区是在硬盘上,它比物理内存要慢5到6个指令级别,所以它有着很高的命中率.这就是说,你还是的为当出现一些预料不到的事情时系统需要更多的内存时准备一些交换空间.请留心,安装程序将试图把交换分区放置在硬盘的前面而不管它能的到什么速度.(*注:不太明白这句话的意思.偶的交换分区是放在硬盘的最后的,偶在考虑下次是否该放到中间去?  

另一个加速交换的办法是采取策略.你没有被限制在一个地方用交换分区.这很有用尤其当你拥有超过一块以上的硬盘和超过一个以上的控制器(*注:控制器应该指的是SCSI卡),你可以将交换分区放在每个控制器上的硬盘上.这样,如果一个控制器忙的话,那另外的控制器就可以用来处理交换.当然,交换分区放在硬盘的那里的确对性能有影响.如果经常使用的数据放在硬盘开始的地方,而你的交换分区却放在硬盘的末尾,那么驱动器就的在两头来回的读取数据,这增加了数据的寻址时间.将你的交换分区放在你经常使用的数据旁边,这可以提高你的硬盘的工作效率.(*注:闹明白了偶的7200转的硬盘为什么慢了)  

BIOS的限制  

在1998年以前制造的计算机,或许有个BIOS(Basic Input/Output System即基本输入输出系统),它限制了系统不能从硬盘的1024柱面以后启动.关于这个问题的普遍现象是你的计算机在启动的时候不能看到过去所分的超过512M的分区.如果你不遵从这个限制,那么你的linux将不能被BISO识别,也就是说你的系统不能被启动.(*注:当然,在2002年的今天,RED HAT 8.0 和MANDRAKE9.0都已经解决了这个问题,方法方法是先将LILO装在主盘的MBR上,修改LILO,指定内核的位置,具体的暂时先不在这里讨论,到了相关的章节在讨论,如果你等不及的话,可先到LINUXSIR上查看相关帖子.)

分区所用的软件  

有许多的分区工具可以给LINUX分区,即使一些工具不能在LINUX下运行,Red Hat 7.x带有两个小工具:fdisk/cfdisk  
(仅在安装的时候)和 Disk Druid.(注意:cfdisk和fdisk是相似的工具,但cfdisk带有一个图形界面).它们都工作在同样的终端.但红帽子推荐你使用Disk Druid来为你安装分区.Disk Druid 提供了对你的硬盘的图形化表示,这样相对fdisk/cfdisk来说更安全些.一旦安装了LINUX,fdisk/cfdisk就是可以使用的了.  

分区的命名规定  

Unix由于常给硬件创造怪异的文件名而臭名昭著,所有的unix版本都没有一个统一的标准.直到现在linux都一直在用一个简单的标准来使用磁盘驱动器:磁盘设备使用3个字母,接一个数字.第一个字母标明控制器的类型(h是IDE/EIDE,就是偶现在用的这种硬盘了,s是指scsi).第二个字母d是指disk,(*注:就是硬盘的意思了),第三个字母是用来指硬盘的位置了,也就是第一块硬盘用a表示,然后依次是b.c.d.e..这意味着第一个硬盘就是hda,下一个是hdb,接着就是hdc,hdd..(*注:scsi的就是sda,sdb,sdc..了).磁盘上的分区数是从1开始的,但在DOS世界里,它们可能不是连续的,这倚赖于它们是如何创建的.但是在我们的规则里,对于第一个IDE硬盘这些分区将是/dev/hda1, /dev/hda2,/dev/hda3,.../dev/hda16.  
而第二个IDE硬盘就是/dev/hdb1.../dev/hda16.同样的运用在SCSI硬盘上:/dev/sda1, /dev/sda2... /dev/sda15  
(SCSI硬盘只能创建15个分区,但IDE可以创建16个分区).在这个SCSI控制器上的第二个硬盘将是sdaa{1,2,..15}如此等等.第二个控制器上的第一个硬盘将是sdb{1-15},其上的第二个硬盘将是sdba{1-15},如此等等.在RH7.X中,可以构建2048个SCSI设备.硬盘和分区的数目倚赖于linux的版本及其分配.  

习题2-1 分区练习  
Although you probably have never had to do this on a basic MS Windows-oriented computer, for a real server system, one that's Windows- or UNIX-oriented, you should pre-plan your disk usage and partitions very carefully.  
1 On a piece of paper, draw a rectangle to represent each hard drive on your computer.  
2 Label them in order just as Linux would (e.g., Hard Drive 1: /dev/hda, Hard Drive 2: /dev/sda, Hard Drive 3: /dev/sdb).  
3 Use this diagram to plan your Linux partitions visually.  
Using this method, you can organize your data, keeping system or users' files together, as well as strategically plan where to place your swap partition(s)  
尽管你可能永远都不用在一个基本的MS Windows机器上,或一个真正的服务器系统,或者Windows或者UNIX系统上做这些,  
但你应该十分仔细计划你的硬盘的使用和分区.  
1 在一片纸上,用矩形来表示你机器上的每一个硬盘.  
2 象linux样的为它们标示(e.g., 硬盘 1: /dev/hda,硬盘 2: /dev/sda, 硬盘 3: /dev/sdb).  
3 用这个来规划你的linux分区  
用这种办法你可以组织数据,保存系统或者用户的文件,合理的放置你交换分区.  

CERTIFICATION OBJECTIVE 2.02  

Intel CPU Hardware Selection and Configuration  
英特尔平台硬件的选择和配置  
你不得不小心的选择硬件,因为有些硬件linux还不支持.可惜的是,硬件制造商一直把目标放在Microsoft Windows上.  
要想硬件能在linux下可用,这需要硬件制造商认可linux这个市场并为它开发驱动,或者第三方为它开发驱动.今天的linux已经强壮了.linux有着巨大的用户群体,他们中有为linux开发驱动的,并在internet上自由的发布.如果这个硬件是流行的,那么你一定能在英特网的某个地方找到它的驱动,并且已经或者将要集成到诸如REDHAT的发行版中了.  
请留心当你要购买新的计算机来使用linux.虽然最近几年linux已经走过很长的路,你在用最新的PC安装LINUX时任可能会出现些小问题.你不应该假定linux可在任何pc上运行,尤其是膝上型计算机或含最新尖端技术的机器.最新的或含很多新技术的可能还不能被linux支持(当然不是绝对的).这些硬件可能是针对或特意为某些操作系统制造配置.例如Winmodems和Winprinters就不能在linux下工作,因为它们是针对MS Windows制造.集成的硬件(e.g.视频卡和共享随机存储器)和并行串口设备(除了打印机)及其它的是你应该担心的.目前,开发驱动可能给他们带来新的难题就象当初如何制造它们.一个好主意是选择去年的模型硬件:它们便宜了并且很可能被支持.应用到膝上型计算机选择,你的冒险就是选最好牌子的!  
除非已经证明linux可以在一个新机器上运行,选择一个旧一点的机器是一个好的选择.linux可以在低端的机器上运行的很好.这是linux比其它操作系统强的一点,如Microsoft's Windows NT.在32M内存的机器上linux可以运行.当然如果你需要运行更多的程序那就理所当然的需要更多的内存.  

Hardware Compatibility  
硬件的兼容性  
在为linux选择正确的硬件时你可以得到帮助和找到资料.有许多地方你可以找到帮助,包括邮件列表和新闻组.或许最好的地方是去LDP(LINUX技术文档)或者红帽子硬件列表查找.LDP是为了LINUX而产生的全球性的文档,包括硬件兼容性,在这里你可以找到Hardware HOWTO.  

Linux Hardware HOWTO  
LINUX硬件howto  
linux硬件howto是由大多数被linux支持的硬件组成的文件列表,它随着硬件规格的变换也不断更新,因次它的信息是新的.linux硬件howto的各个语言版本的PDF格式的文件在red hat linux7.x的第三张cd-rom上有提供.当前更多的信息可在red hat 的官方网站上找到.http://users.bart.nl/~patrickr/hard...-HOWTO.html,Sun Microsystems' Sunsite (sun微系统)at http://metalab.unc.edu/LDP/HOWTO/Hardware-HOWTO.html 或者任何镜像站点.  

The Red Hat Hardware List  
红帽子硬件列表  
红帽子硬件列表列出了经过redhat linux测试的硬件厂商和硬件商标.红帽子为这些列出的硬件提供安装技术支持.那里还有一个不支持列表.这张列表不一定意味这指定的硬件不能运行linux,它只是简单的标明红帽子不会为这些硬件提供安装支持.有Intel, Alpha和Sparc architectures.(*注:不知道最后这个是什么意思)  
象LDP一样,红帽子的硬件列表是由自愿者提供更新信息,如果你想查找任何最新的硬件(如usb)是否能在你的linux系统上运行,或许你最好先看看红帽子支持列表,然后LDP的硬件HOW TO,如果你希望能肯定被红帽子支持,那你就该好好看看红帽子硬件支持列表了.  
Exercise 2-2 Hardware Compatibility  
习题2-2 硬件兼容性  
On the Web, visit http:// www.ibiblio.org/Linux. Once there, find the Linux Hardware Compatibility HOWTO. Take note of its date (it should be posted near the top). How current is it?  
Research the topology of the network you are on and try to find a mirror of the Linux Documentation Project closest to you on the Internet.  
http:// www.ibiblio.org/Linux,在其上找到lin...o,注意它的日期,(可能在顶端),最近的是哪些?  
搜索离你较近的网络上试着找个linux文档的镜像站点.  

RAM Sizing and Cache Issues  
随机存储器的容量和高速缓存的问题  


访问硬盘相对与访问内存来说慢.为了优化内存,linux核心始终保持追踪曾被装载过的文件.如果万一一个请求是在曾经访问过的文件中,那么系统将使用高速缓冲存储器而非去访问硬盘.例如:当诸如ls的命令被执行时,那有关这个命令的二进制数据镜像就被拷贝到内存中.如果再度调用ls命令,那么这个二进制数据就从内存中调用出来,而不是用另一个"慢"的硬盘读取.  
Write-Through versus Write-Back Buffer Cache  
高速缓冲存储器缓存的写入和写出  
高速缓冲存储器的缓存有两中类型.一种是写入.有了写入高速缓存存储器缓存,高速缓存中的数据块的变化会立刻写入到硬盘中.早期的ms-dos版本用这种类型的内存管理把数据直接写入硬盘.第二种类型是写出(*注:或可称为回写)高速缓存存储器缓存,大多数的多用户系统诸如linux,unix,nt,使用并命名为VMS(虚拟内存系统).这第二种类型也被称为"lazy write."(*注:直译是懒惰的写,我们先暂且称为隋写吧,待我查到相关资料再为其正名好了).系统把文件的变化保持在内存中直到CPU空闲时在把所有变化写入到硬盘中.实际上的写操作是在较晚的时候完成的,通常是在后台运行,这样不会让其它的程序变慢.在CPU的循环时间周期里如果写入缓存占有较少的资源时,写出缓存对错误就更敏感.如果操作系统死机了,或者突然掉电,任何写出缓存缓冲区内的改变还没有写回到硬盘中,那么高速缓存缓冲区内的数据就会丢失.当这发生时,LINUX会在启动的时候自动执行文件系统的检查.随着LINUX在适当的时候中断程序以允许同步保存缓冲器缓存中的数据到硬盘,LINUX会自动仔细处理高速缓冲存储器内的数据.  
Buffer Cache Size and Available Memory  
高速缓冲存储器的缓存大小和可用内存  
linux自动使用空闲的内存做为缓存并且当内存中的进程开始或停止时动态的调整大小.系统的守护进程buffer不断的将不用的数据写回到硬盘.(The system daemon bdflush is used to flush any dirty buffers (buffers where data has changed) back to disk.*注:这句话偶没有弄明白,先按照自己的理解翻译,放上原文.)任何时候你可以强制使用同步命令(通常至少调用三次以确保缓冲器是清空的.典型的是在救援模式中当一个最小的linux在内存中并且你想确保任何你做的文件的改动完全绝对写入到硬盘,因此规定"三次".)将所有没有回写的数据写入到硬盘.当linux启动后,一个名为更新的守护进程开始在后台运行.更新开始运行buffer并且没30秒执行一个同步命令.

Disk Subsystems (IDE, EIDE, and SCSI)  
磁盘子系统(IDE, EIDE, and SCSI)  

这些系统是在操作系统装载前建立和初始化的.在linux装载后,磁盘子系统的设置可以通过软件来修改设置.然而,linux首先应该被装载,这样计算机的bios才能识别出构成这些子系统的硬件.  

IDE and EIDE  
IDE是Integrated Drive Electronics(磁盘集成电子学)的缩写.最初他是用在IBM pc上的16位ISA总线标准,1990年被ANSI美国国家标准协会采用做为高级技术配属(ATA)标准.IDE的一个不足是它只能访问504MB的磁盘空间.围绕着这个问题,增强性IDE(EIDE)创建了.它不仅支持超过504MB的硬盘,还提高了硬盘的访问速度.为了支持附加的硬盘,直接内存访问(DMA),和ATA 接口设备诸如CD-ROMS和磁带机.1994年ANSI采用EIDE做为高级技术标准ATA-2或者说快速ATA.  
另一个问题是英特尔系统的BIOS报告仅发现硬盘1024柱面而不管实际上存在多少柱面,这影响了IDE或SCSI.这是老版本的BIOS固有的限制.由于这个原因,你必须将你的/boot文件放在1024柱面以内,否则将不能启动你的系统因为BIOS不能正确读取柱面数.大多数1995年以后制造的计算机内置了一个补丁叫逻辑寻址,或者叫做LBA,一个系统可以识别LBA,调整柱面,磁盘最前部分,扇区数,使整个磁盘可以逻辑寻址.简言之这仅仅发生在比较旧的机器上.  
如果你不知道这些那这些硬件限制问题造成的障碍是普遍和难以解决的.尽你所能去了解硬件限制,包括老机器固有的1024柱面限制.  

SCSI  
微型计算机接口(SCSI),由苹果计算机发展而来,允许你的机器联接硬盘,光驱,磁带机,打印机和扫描仪.SCSI比EIDE更快更灵活,支持7,15,甚至32个驱动器,这倚赖于SCSI总线带宽.在SCSI上数据的转移可以达到每秒5-160MB或者320MB.由于SCSI硬盘太贵,所以在大部分的台式机上很难见到SCSI控制器.大的PC供应商仍然使用SCSI控制器在他们的尖端服务器以应付巨大的数据交换和更多的总线带宽要求.  

Disk or Partition?  
硬盘和分区?  
一个硬盘需要一个分区表.分区是硬盘上的柱面的逻辑序列组合,而柱面包含所以能被磁头读取的扇区.你可以创建一个分区包含所以的柱面,也可以在IDE上创建16个分区但只有15个可被使用.而SCSI可以创建15个并且这15个都可使用.IDE上的扩展分区不能象通常的分区一样使用,因为它保持着逻辑分区的列表.  

IDE的16个分区只有15可以使用,SCSI的是15个都可以使用.  

主分区'扩展分区'逻辑分区  
在每个硬盘上你被限制只能划分四个主分区.(*:注:记得在windows下用fdisk分区,一个硬盘只能有一个主分区,如有疑问请看下面说明了.)所以发展了扩展分区.在一个扩展分区里,可以创建逻辑分区.IDE硬盘可以最多划分16个分区(3个主分区1个扩展分区,包含最多12个扩展分区),然而SCSI被限制15个.可惜的是在英特尔平台上分区命名规定即不简单也不直接.所有逻辑分区创建在扩展分区里,设备命名从5到16(或者15在SCSI上)没有说明配置了多少个主分区.假设,例如你有一个IDE硬盘,你创建了一个单独的主分区,它该命名为设备hda1.如果你接着创建一个扩展分区,技术上它该是hda2,并且是不可用的.在这个扩展分区,hda2,你必须创建至少一个逻辑分区,它将被命名hda5.  
更糟糕的是当你创建了一个主分区,然后创建一个扩展分区在你产生的逻辑分区.如果你接着从空闲空间创建第二个主分区,IDE硬盘将重编号分区,你的启动程序将完全失败,因为内部分区的名称变化而指向错误的分区.  
你应该知道设备名称,如起始名称和任何基本硬盘上创建的任何逻辑分区.也该意识到在IDE类型的硬盘上创建分区的特性.  
Cylinder/Head/Sector Geometry and Remapping  
柱面/Head/Sector Geometry and Remapping  
硬盘的大小取决于它的几何划分.在硬盘上包括可供使用的柱面,簇,扇区.所有这些构成了硬盘上的一个个地址.通常的,你的BIOS被限制在1024柱面,256簇,63扇区.所以现代的硬盘设备用512字节每扇区.于是1024乘上256乘上63乘上512后大约是8000MB,8GB.如果你有一个大于504MB的硬盘而你的BIOS却报告说只有1024柱面,那你的机器将不支持大硬盘寻址.今天大多数的机器用LBA的方法解决了这个问题.  
SCSI驱动器有它们自己的BIOS,这些限制对SCSI硬盘没有影响.  

Logical Block Addressing (LBA)  
如果你的计算机是在1994年以后制造的,那么你可以幸运的在COMS中选择LBA模式.LBA是一个包含了特殊方法来寻址扇区.代替了硬盘上谈及的柱面,簇,扇区的位置,每个扇区指定了独一无二的数字从0到N-1,N就是硬盘上扇区数.通过LBA模式BIOS可识别出硬盘.  

Example 实例  
一台机器上的硬盘有3045柱面,16簇和63扇区.不使用LBA,限制了不能超过1024柱面,所以基本磁盘操作系统不能访问硬盘上1024柱面以后的空间.使用LBA模式,BIOS报告给系统硬盘有32簇(代替了原来的16簇).这个变化成了1024柱面32簇  
63扇区,新的改变容量和原来的硬盘是相同的,但是通过LBA翻译成可访问.  

Multiple Controllers  
多个控制器  
同时在同样的个人电脑上使用超过一个以上的硬盘控制器是可能和理想的.这是普通的通过在你系统上增加容许能力来  
减轻你渎写单一硬盘的瓶颈.  
在同一台机器上你可以同时使用SCSI和EIDE控制器,但是有些困难你该知道.在启动的时候BIOS仅能访问头两个EIDE硬盘.当然,如果安装了EIDE硬盘SCSI硬盘或许不会被处理.BIOS可以设置你从SCSI硬盘启动.确信你理解在启动的时候哪个驱动器可以被BIOS访问,因为如果你在硬盘中安装了启动扇区但是不能被访问,linux将不会被启动.  
当你的机器启动时,BIOS给每个设备分配了一个数字.BIOS分配给它们的顺序可能和LINUX的顺序不一样.这可以混淆LILO并  
使它失效.  

实例  
你的计算机安装了一个从SCSI硬盘启动的linux,BIOS赋予0x80给/dev/sda(SCSI硬盘)和0x81给/dev/hda(第一个EIDE硬盘).然而linux赋予0x80给/dev/hda,0x81给/dev/hdb(第二个EIDE硬盘),和0x82给SCSI硬盘.这在BIOS和LILO之间就有个争执.LILO将不能在/dev/sda上找到启动扇区,因此将启动不了linux.当你在LINUX里运行/sbin/lilo,你将会得到信息"BIOS-Drive 0x82 may not be accessible"(参看第四章配LILO)."Basic Configuration and Administration," 更多信息,请看/etc/lilo.conf的bios= option  

RAID and MD Systems  

RAID(磁盘冗余阵列)在linux中可以通过硬件或软件来构建.它们之间的折衷方案是相对于价格和性能.硬件实现比软件实现更昂贵,但是性能也是最好的.  
用硬件构建RAID需要用一个RAID控制器来把几个设备联接起来.这个控制器必须安装驱动程序.linux当时提出一种解决办法用md核心补丁用软件来构建RAID.你因该使用linux核心2.0.36或者一个新的2.2.x版本.一旦RAID在你的系统里创建了,linux可以使用它就象别的设备一样.  
RAID有许多种不同的配置,接下来我们要讨论几个linux支持的基本的RAID配置.  
(*注:相关资料 磁盘阵列其实也分为软阵列 (Software Raid)和硬阵列 (Hardware Raid) 两种. 软阵列即通过软件程序并由计算机的CPU提供运行能力所成.由于软件程式不是一个完整系统故只能提供最基本的 RAID容错功能. 其他如热备用硬盘的设置, 远程管理等功能均一一欠奉. 硬阵列是由独立操作的硬件提供整个磁盘阵列的控制和计算功能. 不依靠系统的CPU资源. 由于硬阵列是一个完整的系统, 所有需要的功能均可以做进去. 所以硬阵列所提供的功能和性能均比软阵列好. 而且, 如果你想把系统也做到磁盘阵列中, 硬阵列是唯一的选择. 故 RAID 5 级的磁盘阵列均为硬阵列. 软阵列只适用于 Raid 0 和 Raid 1. 对于做镜像用的镜像塔, 肯定不会用 Raid 0或 Raid 1。)  

RAID0  
将多个较小的磁盘合并成一个大的磁盘,不具有冗余,并行I/O,速度最快。RAID 0亦称为带区集。它是将多个磁盘并列起来,成为一个大硬盘。在存放数据时,其将数据按磁盘的个数来进行分段,然后同时将这些数据写进这些盘中。所以,在所有的级别中,RAID 0的速度是最快的。但是RAID 0没有冗余功能的,如果一个磁盘(物理)损坏,则所有的数据都无法使用.不可恢复.  
RAID0还可称为不带奇偶校验的磁盘阵列.  

RAID1  
两组相同的磁盘系统互作镜像,速度没有提高,但是允许单个磁盘错,可靠性最高。RAID 1就是镜像。其原理为在主硬盘上存放数据的同时也在镜像硬盘上写一样的数据。当主硬盘(物理)损坏时,镜像硬盘则代替主硬盘的工作。因为有镜像硬盘做数据备份,所以RAID 1的数据安全性在所有的RAID级别上来说是最好的。但是其磁盘的利用率却只有50%,是所有RAID上磁盘利用率最低的一个级别。  

RAID4  
这个级别的需要三个或更多的硬盘.就象RAID0,在每个硬盘上数据的读取和写入是平行进行的.其中一个硬盘设置仅仅保存所有数据的奇偶信息.如果一个驱动器出错,那么奇偶信息可以用来恢复所有数据.有较好的可信度,但是随着每一次写入操作奇偶信息的更新,用来做奇偶校验的硬盘可能会成为系统的瓶颈.  

RAID5  
RAID5 works on three or more disks, with optional spare disks. With this level, several disks can be combined with both performance and reliability increases. Unlike RAID4, parity information is striped across all the disks. Instead of dedicating one disk to store the parity information, it is distributed evenly across all disks. If one disk fails, the data can be reconstructed onto a spare disk or from the parity information. In either case, there is no stoppage of the RAID system, all data is still available even with one disk failed. RAID level 5 is the preferred choice in most cases: the performance is good, the recovery is high, and the cost is second best. You lose one disk out of the set essentially to parity, so with 5 disks in RAID level 5, you get 80 percent utilization for data, and 20 percent for parity (recovery) information. With 32 disks, you get 31 of 32 disks for about 96 percent utilization.  
(*注:RAID 5:需要三个以上的硬盘.向阵列中的磁盘写数据,奇偶校验数据存放在阵列中的各个盘上,允许单个磁盘出错。RAID 5也是以数据的校验位来保证数据的安全,但它不是以单独硬盘来存放数据的校验位,而是将数据段的校验位交互存放于各个硬盘上。这样,任何一个硬盘损坏,都可以根据其它硬盘上的校验位来重建损坏的数据。硬盘的利用率为n-1。这与原英文的意思是一样的,只是没有按照原文来翻译.)

RAID系统支持"热拔插".这意味着如果一个硬盘如果出错,系统管理员可以在系统仍在运行时拔下这个坏的硬盘,放入一个新的驱动器.这是一个强大相对昂贵的性能.  

(*注: 以下的内容都是有关这方面知识的,但有些例证是基于windows平台的,请仔细区分!  
作为高性能的存储系统,巳经得到了越来越广泛的应用。RAID的级别从RAID概念的提出到现在,巳经发展了六个级别,其级别分别是0、1、2、3、4、5等。但是最常用的是0、1、3、5四个级别。RAID其他各级别介绍:  
RAID Level 3  
RAID 3存放数据的原理和RAID0、RAID1不同。RAID 3是以一个硬盘来存放数据的奇偶校验位,数据则分段存储于其余硬盘中。它象RAID 0一样以并行的方式来存放数,但速度没有RAID 0快。如果数据盘(物理)损坏,只要将坏硬盘换掉,RAID控制系统则会根据校验盘的数据校验位在新盘中重建坏盘上的数据。不过,如果校验盘(物理)损坏的话,则全部数据都无法使用。利用单独的校验盘来保护数据虽然没有镜像的安全性高,但是硬盘利用率得到了很大的提高,为n-1。
RAID 0-1:同时具有RAID 0和RAID 1的优点。  
冗余:采用多个设备同时工作,当其中一个设备失效时,其它设备能够接替失效设备继续工作的体系。在PC服务器上,通常在磁盘子系统、电源子系统采用冗余技术。  
此外,由这几个RAID级别发展出来的系统对数据的保护更加出色,如0+1、00、30、50等。  
RAID系统的应用范围  
局域网/广域网 存储局域网 集群环境 新闻中心 Internet新闻服务器 企业服务器 高性能桌面系统 PC工作站 工作组/文件服务器 E-Mail服务器 Intranet/Web服务器 应用服务器  

SCSI  

存储技术在计算机技术中受到广泛关注,服务器存储技术更是关心的热点。一谈到服务器存储技术,人们几乎立刻与SCSI(Small Computer Systems Interface)技术联系在一起。尽管廉价的IDE硬盘在性能、容量等关键技术指标上已经大大地提高,可以满足甚至超过原有的服务器存储设备的需求。但由于Internet的普及与高速发展,网络服务器的规模也变得越来越大。同时,Internet不仅对网络服务器本身,也对服务器存储技术提出了苛刻要求。无止境的市场需求促使服务器存储技术飞速发展。而磁盘阵列是服务器存储技术中比较成熟的一种,也是在市场上比较多见的大容量外设之一。
在高端,传统的存储模式无论在规模上,还是安全上,或是性能上,都无法满足特殊应用日益膨胀的存储需求。诸如存储局域网(SAN)等新的技术或应用方案不断涌现,新的存储体系结构和解决方案层出不穷,服务器存储技术由直接连接存储(DAS)向存储网络技术(NAS)方面扩展。在中低端,随着硬件技术的不断发展,在强大市场需求的推动下,本地化的、基于直接连接的磁盘阵列存储技术,在速度、性能、存储能力等方面不断地迈上新台阶。并且,为了满足用户对存储数据的安全、存取速度和超大的存储容量的需求,磁盘阵列存储技术也从讲求技术创新、重视系统优化,以技术方案为主导的技术推动期逐渐进入了强调工业标准、着眼市场规模,以成熟产品为主导的产品普及期。  
回顾磁盘阵列的发展历程,一直和SCSI技术的发展紧密关联,一些厂商推出的专有技术,如IBM的SSA(Serial Storage Architecture)技术等,由于兼容性和升级能力不尽如人意,在市场上的影响都远不及SCSI技术广泛。由于SCSI技术兼容性好,市场需求旺盛,使得SCSI技术发展很快。从最原始5MB/s传输速度的SCSI-1,一直发展到现在LVD接口的160MB/s传输速度的Ultra 160 SCSI,320MB/s传输速度的Ultra 320 SCSI接口也将在2001年出现。从当前市场看,Ultra 3 SCSI技术和RAID(Redundant Array of Inexpensive Disks)技术还应是磁盘阵列存储的主流技术。  
SCSI本身是为小型机(区别于微机而言)定制的存储接口,SCSI协议的Version 1 版本也仅规定了5MB/s传输速度的SCSI-1的总线类型、接口定义、电缆规格等技术标准。随着技术的发展,SCSI协议的Version 2版本作了较大修订,遵循SCSI-2协议的16位数据带宽,高主频的SCSI存储设备陆续出现并成为市场的主流产品,也使得SCSI技术牢牢地占据了服务器的存储市场。SCSI-3协议则增加了能满足特殊设备协议所需要的命令集,使得SCSI协议既适应传统的并行传输设备,又能适应最新出现的一些串行设备的通讯需要,如光纤通道协议(FCP)、串行存储协议(SSP)、串行总线协议等。渐渐地,"小型机"的概念开始弱化,"高性能计算机"和"服务器"的概念在人们的心目中得到强化,SCSI一度成为用户从硬件上来区分"服务器"和PC机的一种标准。
通常情况下,用户对SCSI总线的关心放在硬件上,不同的SCSI的工作模式意味着有不同的最大传输速度。如40MB/s的Ultra SCSI、160MB/s的Ultra 3 SCSI等等。但最大传输速度并不代表设备正常工作时所能达到的平均访问速度,也不意味着不同SCSI工作模式之间的访问速度存在着必然的"倍数"关系。SCSI控制器的实际访问速度与SCSI硬盘型号、技术参数,以及传输电缆长度、抗干扰能力等因素关系密切。提高SCSI总线效率必须关注SCSI设备端的配置和传输线缆的规范和质量。
一般说来,选用高速的SCSI硬盘、适当增加SCSI通道上连接硬盘数、优化应用对磁盘数据的访问方式等,可以大幅度提高SCSI总线的实际传输速度。尤其需要说明的是,在同样条件下,不同的磁盘访问方式下获得的SCSI总线实际传输速度可以相差几十倍,对应用的优化是获得高速存储访问时必须关注的重点,而这却常常被一些用户所忽视。  
随着传输速度的提高,信号传输过程中的信号衰减和干扰问题显得越来越突出,终结器在一定程度上可以起到降低信号波反射,改善信号质量的作用。同时,LVD(Low-Voltage Differential)技术的应用也越来越多。LVD工作模式是和SE(Single-Ended)模式相对应的,它可以很好地抵抗传输干扰,延长信号的传输距离。同时,Ultra 2 SCSI和Ultra 3 SCSI模式也通过采用专用的双绞型SCSI电缆来提高信号传输的质量。LVD工作模式和SE工作模式的对比如图5所示。

RAID  

在磁盘阵列的概念中,大容量硬盘并不是指单个硬盘容量大,而是指将单个硬盘通过RAID技术,按RAID 级别组合成更大容量的硬盘。所以在磁盘阵列技术中,RAID技术是比较关键的,同时,根据所选用的RAID级别的不同,得到的"大硬盘"的功能也有不同。  
RAID是一项非常成熟的技术,但由于其价格比较昂贵,配置也不方便,缺少相对专业的技术人员,所以应用并不十分普及。据统计,全世界75%的服务器系统目前没有配置RAID。由于服务器存储需求对数据安全性、扩展性等方面的要求越来越高,RAID市场的开发潜力巨大。RAID技术是一种工业标准,各厂商对RAID级别的定义也不尽相同。目前对RAID级别的定义可以获得业界广泛认同的只有4种,RAID 0、RAID 1、RAID 0+1和RAID 5。  
RAID 0是无数据冗余的存储空间条带化,具有低成本、极高读写性能、高存储空间利用率的RAID级别,适用于Video / Audio信号存储、临时文件的转储等对速度要求极其严格的特殊应用。但由于没有数据冗余,其安全性大大降低,构成阵列的任何一块硬盘损坏都将带来数据灾难性的损失。所以,在RAID 0中配置4块以上的硬盘,对于一般应用来说是不明智的。  
RAID 1是两块硬盘数据完全镜像,安全性好,技术简单,管理方便,读写性能均好。但其无法扩展(单块硬盘容量),数据空间浪费大,严格意义上说,不应称之为"阵列"。  
RAID 0+1综合了RAID 0和RAID 1的特点,独立磁盘配置成RAID 0,两套完整的RAID 0互相镜像。它的读写性能出色,安全性高,但构建阵列的成本投入大,数据空间利用率低,不能称之为经济高效的方案。  
RAID 5是目前应用最广泛的RAID技术。各块独立硬盘进行条带化分割,相同的条带区进行奇偶校验(异或运算),校验数据平均分布在每块硬盘上。以n块硬盘构建的RAID 5阵列可以有n-1块硬盘的容量,存储空间利用率非常高。任何一块硬盘上数据丢失,均可以通过校验数据推算出来。它和RAID 3最大的区别在于校验数据是否平均分布到各块硬盘上。RAID 5具有数据安全、读写速度快,空间利用率高等优点,应用非常广泛,但不足之处是1块硬盘出现故障以后,整个系统的性能大大降低。  
对于RAID 1、RAID 0+1、RAID 5阵列,配合热插拔(也称热可替换)技术,可以实现数据的在线恢复,即当RAID阵列中的任何一块硬盘损坏时,不需要用户关机或停止应用服务,就可以更换故障硬盘,修复系统,恢复数据,对实现HA(High Availability)高可用系统具有重要意义。  
此外,在系统的可用性方面,单一硬盘系统的可用性比没有数据冗余的磁盘阵列要好,而冗余磁盘阵列的可用性比单个硬盘要好得多。这是因为冗余磁盘阵列允许单个硬盘出错,而继续正常工作;一个硬盘故障后的系统恢复时间也大大缩短(与从磁带恢复数据相比);冗余磁盘阵列发生故障时,硬盘上的数据是故障当时的数据,替换后的硬盘也将包含故障时的数据。但是,要得到完全的容错性能,计算机硬盘子系统的其它部件也必须有冗余。  
各厂商还在不断推出各种RAID级别和标准。例如更高安全性的,从RAID控制器开始镜像的RAID;更快读写速度的,为构成RAID的每块硬盘配置CPU和Cache的RAID等等,但都不普及。用IDE硬盘构建RAID的技术是新出现的一个技术方向,对市场影响也较大,其突出优点就是构建RAID阵列非常廉价。目前IDE RAID可以支持RAID 0、RAID 1和RAID 0+1三个级别,最多支持4块IDE硬盘。由于受IDE设备扩展性的限制,同时,也由于IDE设备也缺乏热可替换的技术支持的原因,IDE RAID的应用还不多。  
总之,发展是永恒的主题,在服务器存储技术领域也不例外。一方面,一些巨头厂商尝试推出新的概念或标准,来领导服务器及存储技术的发展方向,较有代表性的如Intel力推的IA-64架构及存储概念;另一方面,致力于存储的专业厂商以现有技术和工业标准为基础,推动SCSI、RAID、Fibre Channel等基于现有存储技术和方案快速更新和发展。在市场经济条件下,检验技术发展的唯一标准是市场的认同。市场呼唤好的技术,而新的技术必须起到推动市场向前发展作用时才能被广泛接受和承认。随着高性能计算机市场的发展,高性能比、高可靠性、高安全性的存储新技术也会不断涌现。  
*在Linux下用软件实现RAID功能  
在Linux环境下,采用Raidtools工具,不仅可以将两个硬盘进行镜像,还可以制作软RAID0、RAID1、RAID5。说是软RAID,是因为通常情况下,RAID盘是通过专用的RAID卡进行的,而在Linux环境下,可以利用Raidtools软件实现RAID功能,所以称为软RAID。  
一、较早的Linux版本  
自行下载并编译Raidtools软件包,较早版本的Raidtools软件包名为md,现在已正式更名为Raidtools。下载地址:中国自由软件库。  
如果你已经从网上下载了Raidtools-0.41.tar.gz软件包,解压后,自行编译,步骤如下:  
$gunzip -d raidtools-0.41.tar.gz  
$tar -xvf raidtools-0.4.1.tar  
在使用Raidtools之前,首先要知道目前正在使用的核心是否支持md。如果你正在使用的核心是2.0.X,并且不是自己编译过的话,大多数情况下是支持软RAID的。如果不能确定,则应自己编译核心。在配置时,应选择对md的支持。确定了正在使用的核心支持RAID后,编译Raidtools软件包如下:  
$cd raidtools-0.41  
$./configure  
$make  
$make install ##make install在/dev下产生md0-md3共4个设备。  
单击OK按钮,完成安装。  
在使用Raidtools前,还需确定要使用的RAID的种类。目前使用Raidtools可以作RAID0、RAID1、RAID5.除了RAID5外,还可以选择作Linear模式或RAID0。选择作RAID0。以下为制作过程。  
1.建立RAID盘  
(1)关机,将两块小硬盘分别加到第一个IDE控制器的Slave接口上及第二个IDE控制器的Slave接口上(这台机器上的CD-ROM接在第二个IDE控制器的Master上)。  
(2)加电启动系统,以Root登录,运行以下命令对硬盘进行分区:  
#fdisk /dev/hdb  
将全部硬盘划分成一个主分区,建立一个/dev/hdb1分区。  
#fdisk /dev/hdd  
同样,将全部硬盘划分成一个主分区,建立一个/dev/hdd1分区。  
(3)之后:  
#/sbin/mdcreate raid0 -c4k /dev/md0 /dev/hdb1 /dev/hdd1  
为了提高访问速度,你可以将硬盘进行比较细致的划分,尽可能将分区合理分布在不同的硬盘上。然后,再用Mdcreate将它们组合成一个mdx(x:1,2,3)。  
2.使用RAID0盘  
(1)启动新建立的RAID盘:  
#/sbin/mdadd -ar  
(2)查看/proc/mdstats文件的内容,以检查RAID0的状态。  
#cat /proc/mdstats  
系统显示:  
personalities : [1 linear] [2 raid0]  
read-ahead not 8092 sectors  
md0 : active raid0 hdb1 hdd1 xxxx  
blocks 8k chunks  
md1 : inactive  
md2 : inactive  
md3 : inactive  
这表示,新建的RAID0已经可以正常运行了。  
为了使用新RAID盘,还应在新盘上建立新的文件系统,建立过程如下:  
#mke2fs /dev/md0 ##注:在新的存储设备上建立Ext2文件系统  
建立了新的文件系统,再将它Mount到根目录下的某个目录上,就可以正式使用了。安装方法如下:  
#mount  /dev/md0  /opt ##注:/opt为笔者在根分区建的一个Mount点  
若有必要,也可以用Raidtools建立RAID5,以提高数据的可靠性。  
3.自动执行RAID0的设置  
将RAID0的加载及文件系统的加挂全加入到Init.sysinit文件中,这样,只要系统一启动,首先就执行RAID,用户就不必再手工安装了。  
用户应将以下两个命令加入到Init.sysinit文件中。  
/sbin/mdrun -ar  
mount /dev/md0 /opt  
当然,如果你不觉得麻烦,也可以手工运行以上命令,以手动方式启动软RAID盘。  
二、较近的Linux版本  
如果你安装的Linux版本较新,其中已经带有Raidtools工具,那么,就不必再下载软件并自己编译了。使用时可以这样处理:  
1.建立一个文件/etc/raidtab(以制作RAID0为例),文件内容如下:  
raiddev /dev/md0  
raid-level   0  
nr-raid-disks 2  
persistent-superblock 1  
chunk-size   4  
device     /dev/hdb1  
raid-disk    0  
device     /dev/hdd1  
raid-disk    1  
2.运行以下命令:  
#mkraid /dev/md0  
这样就可以生成一个新的设备:  
/dev/md0。  
启用软RAID方法:  
#raidstart /dev/md0  
其余操作同上。  
如果你正在使用的Linux系统版本很新,可能以上两种情况都不适合你,那么,你可以采用第三种方法使用软RAID。  
三、Red Hat Linux 6.1  
自行编译Raidtools0.42、0.50beta2时,先是找不到所要的头文件,将所需头文件复制后,编译仍然通不过。原来,由于新的版本采用了一系列新的函数,情况稍有一点不同。不过,新的版本中,提供了Raidtools,在/sbin目录中,有Raidtools的一系列工具,其中有Mkraid、Raid0run、Raidstop、Raidstart等一组工具。如果你想自己编译,可以从中国自由软件库中查找到最新版为0.9的Raidtools,自行编译0.9版的Raidtools,编译正常通过。  
新版的Raidtools稍有一点不同,笔者使用系统自带的Raidtools,制作软RAID方法如下:  
1.建立文件/etc/raidtab,文件内容如下:  
raiddev /dev/md0  
raid-level       0  
nr-raid-disks     2  
persistent-superblock  0  
chunk-size      8  
device        /dev/hdb1  
raid-disk       0  
device       /dev/hdd1  
raid-disk       1  
2.生成软RAID设备,运行以下命令:  
# mkraid -c /etc/raidtab /dev/md0  
之后,运行以下命令,以查看目前RAID的运行状态:  
[root@rh61 /proc]# cat mdstat  
如果系统显示如下:  
Personalities : [raid0]  
read-ahead 1024 sectors  
md0 : active raid0 hdd1[1] hdb1[0] 2202416 blocks 8k chunks  
unused devices: <none>  
表示你的RAID0已正常运行了。  
3.建立新的文件系统  
现在,为了使用新生成的设备,我们应在新的RAID盘上建立Ext2文件系统,建立新的文件系统的命令如下:  
[root@rh61 /sbin]# mkfs.ext2 /dev/md0  
经过大约两三分钟,新的文件系统正确生成。现在就可以开始使用它了。使用方法如下:  
[root@rh61 /sbin]# mount -t ext2 /dev/md0 /opt  
将/dev/md0设备加挂(mount)到/opt安装点上。  
如果你是linux新手,轻易不要尝试,以免你的数据丢失,难免你又得重装系统!)  

Linear Mode  
线性模式  
线性模式联合一个或多个硬盘如同一个大的磁盘设备工作.在线性模式中没有冗余,硬盘简单的按它们出现排列(e.g., disk 1, disk 2,如此等等).当多个用户访问不同硬盘上的数据时仅仅能获得线性模式的性能.  

考试可能选任何级别的RAID,包括一个集成不同的级别到一个方案中.(*注:如RAID0+1等)  


IRQ Settings  
中断设置  

一个中断请求(IRQ)是周边设备(NIC, Video, Mouse, Modem, Serial Port,或者别的)发送给CPU的要求一些处理时间的信号.你联接到计算机的每个设备可能需要它自己的IRQ值.这个值是独一无二的对每个设备(可能除了PCI设备;以后再解释)以免混淆计算机.在英特尔平台上限制了仅16个IRQ值(0-15),在一个裸露的系统中通常用的IRQs是 5, 7, 9, 10, 11,12.典型的声卡用5,打印机用7,显示卡,总线鼠,和网卡每个需要用到剩余的一个值.(或许!)  

Planning the IRQ Layout-Standard IRQs  
IRQ的计划和标准布局的IRQs  
主板保留了一些IRQs设置如磁盘控制器和系统时钟设备.不要使用这些中断,因为这会造成冲突!在linux里你可以检查  
/proc/interrupts来看哪些中断在使用.一个新的设备应该使用任何一个没有使用的中断.下面是一个标准的IRQ布局(如图Table 2-2).  

IRQ Assigned to  
0 Nonmaskable interrupt (NMI)-detects parity errors不可屏蔽的中断-发现奇偶校验错误  
1 System timer系统时钟  
2 Cascade for controller 2  
3 Serial port 2, 4  
4 Serial port 1, 3  
5 Parallel port 2并行串口2  
6 Floppy diskette controller软驱控制器  
7 Parallel port 1并行串口1  
8 Real-time clock 实时钟  
9 Redirected to IRQ2  
10 Not assigned (usually used for a network card)没有使用(通常用在网卡上)  
11 Not assigned 没有使用的  
12 PS/2 mouse, if installed如果安装的话是鼠标  
13 Coprocessor处理器  
14 Hard disk controller 1硬盘控制器1  
15 Hard disk controller 2硬盘控制器2  
Table 2: Standard IRQ Layout for PCs  

IRQs and the PCI Architecture  
IRQs和PCI结构  

今天PC的一个普遍的问题是没有多的中断来使用设备.围绕着这个困境PCI可以通过共享IRQ来使用PCI总线.PCI总线是不受处理器约束的,所以PCI设备可以有它们自己的内部中断来决定那个设备向处理器发送中断请求.然而,你的BIOS必须支持PCI总线.如果支持,你因该能通过CMOS来调试.大部分1998年以后的现代计算机都支持PCI总线.  

Plug-and-Play  
即插即用  

有了即插即用设备,用户不用告诉计算机设备在那里.操作系统因该能识别并自动安装设备.在苹果的Macintosh机器上即插即用已经是通用的了,已经整和到Microsoft's Windows操作系统中了.linux在这项技术上有点落后了,尽管它可以同时配置好ISA PnP设备(isapnp实用工具)和PCI PnP(即插即用).kudzu工具在启动是寻找任何硬件改动并允许你配置它们.大多数的PnP技术运用在非UNIX系统上(Microsoft Windows and MacOS),linux也开始要同它们一样.  

Plug-and-Play Support in Linux  
即插即用在linux里  

不幸的事实是linux操作即插即用不是很好.主要的问题来自于ISA总线上的即插即用设备.ISA是来自IBM机器上的老的技术,创建的时候不支持即插即用,所以要支持它十分复杂.红帽子包含一些工具有助于操作ISA即插即用设备.这些工具(e.g., isapnp and pnpdump)保存在一个软件包名为isapnptools.在你的红帽子安装中你应该能发现以rpm形式的这个软件包.  
PCI是新的快速的总线技术.当linux装载时,设备驱动可以轻易的发现它们的设备如果它们是PCI.这使得运用在PCI总线上的硬件即插即用十分容易,然而,它们也可能和ISA总线有冲突.随着即插即用技术的不断改进,它的前景光明.保持小心,比起PCI,你可能会有更多的麻烦在ISA设备上.  

Handling Jumperless Cards  
处理板卡的跳线  

有些板卡没有跳线;替换,关于端口信息,IRQ,I/Q地址,这些都存在板卡上的只读存储芯片里(ROM).这种板卡允许你改变这些设置.Alas,它是一个Microsoft世界,这些工具通常需要运行在DOS下.如果你有一个类似这样工作的板卡,那你需要一个DOS启动盘或分区来配置它们.  
如果你没有得到许可使用MS-DOS或Windows,还有一些选择.FreeDOS项目(http://freedos.org)是努力创建一个与MS-DOS可兼容的磁盘操作系统的自由版本.在linux里,有一个 MS Windows Emulator,称为WINE,可以成功的运行一些windows程序.  

总的来说,一种较好的解决方案就是不使用用这种方法来配置的硬件.  

IRQs and Standard Serial Ports  
IRQs和标准串型端口  

在linux里的标准串型端口是/dev/ttyS0, /dev/ttyS1, /dev/ttyS2,和/dev/ttyS3 (COM1到COM4各个端口).在你的BIOS设置里,串型端口通常设置为ttyS0和ttyS2给IRQ4,ttyS1和ttyS3用IRQ3.在linux核心2.2或更高版本,可以分配这些中断,版本低于2.2的,你需要指定独一无二的IRQa给你要用的每个串型端口.这可以在启动是使用服务设置工具或修改/etc/rc.d/rc.serial文件类似的如下(assuming, of course, that all these interrupts are available):  
/sbin/setserial /dev/ttyS0 irq 3 # dumb terminal  
/sbin/setserial /dev/ttyS1 irq 4 # serial mouse  
/sbin/setserial /dev/ttyS2 irq 5 # first modem  
/sbin/setserial /dev/ttyS3 irq 9 # second modem  

Serial and Other Interface Mice  
其它接口的鼠标  

For your mouse to work, you will need to know what interface and protocol it uses. Serial mice interface to a serial port, while PS/2 mice have a port and IRQ set aside. There is also another type of interface called a busmouse. Linux supports three standard busmouse-oriented protocols: Inport (Microsoft), Logitech, and ATI-XL. In order for a PS/2 mouse to work, support has to be compiled into the Linux kernel or compiled as a module.  
对于你使用的鼠标,你需要知道它使用的接口和协议.串型鼠标对应的串型端口,PS/2鼠标有一个端口和IRQ.还有另一种接口类型的叫总线鼠.linux支持三种标准类型的总线鼠:Inport (Microsoft), Logitech, and ATI-XL.为了使用PS/2鼠标,已经在内核中编译支持或做成模块了.  

Serial Mice  
串口鼠标  

使用串口鼠标,你或许需要指定一IRQ如果你使用了超过三个以上的串口设备.另外就是给它选择正确的协议使用了.  
Common协议是Microsoft,对应Microsoft鼠标,Logitech对应Logitech鼠标.一个串口鼠标需要一个矩形有9或25针的接口.设备文件是一个从/dev/mouse链接到使用端口(e.g., /dev/ttyS0).  

PS/2鼠标  

一个PS/2鼠标(用在新的机器上和大多数的膝上型)有它自己的端口和使用IRQ12.它使用6针的小型DIN连接器,通讯使用PS/2协议.设备文件是/dev/psaux.  

总线鼠  

你可以\通过它的9针连接口来识别总线鼠.这种鼠标通常连接在一块板卡上,或许可以跳线设置或软件(对于DOS)设置IRQs和基本I/O地址.当前大多数总线鼠使用总线鼠协议,一些老的鼠标使用别的协议,如MouseSystems或Logitech.  
对应Inport, Logitech和ATI-XL 总线鼠的设备文件是/dev/inportbm, /dev/logibm,和/dev/atibm.  

红帽子安装程序的过程将询问你关于鼠标的信息.知道你有那种类型的鼠标!最后你可以在控制台模式下通过XF86Setup工具x11或mouseconfig来修改鼠标设置,  

Exercise 2-3 Your Computer's CMOS Settings  

Look through your computer's CMOS settings. To get into the CMOS settings, you normally have to press a key soon after you power on your computer. This key is commonly the delete or f1 key on your keyboard. Browse through the menus and try to locate the areas where the following information is kept:  
* Your hard drive information: Take note of the "translation mode" your hard drive is using (e.g., CHS, Large, or LBA).  
* Locate the IRQ settings that your motherboard assigns to your serial and parallel ports, real-time clock, and hard disk controllers. Can you change any of these settings? (Be careful that you don't save your changes!)  
* Find out if your CMOS supports PCI sharing (for IRQs). If it does, is it turned on or off on your computer?  
习题2-3 你的计算机的CMOS设置  
看完你计算机的CMOS设置.通常在你开电源后按键盘上的特殊键如Del或者F1进入CMOS设置,通过浏览菜单来获得如下硬件的信息:  
*你的硬盘信息:注意translation mode,你的硬盘使用(e.g., CHS, Large, or LBA).  
*你主板的IRQ设置,串型端口和并行端口,实时钟,和硬盘控制器.你能改变它们的设置么?(小心不要保存你的改变!)  
*找到你的CMOS是否支持PCI总线,如果是,它在你的机器里是打开还是关闭  


PC Card (PCMCIA)  

linux有专门的软件包来处理PC卡,称为"Card Services.".这个软件包包括所有你将需要的用来管理PCMCIA的核心模块和具体型号的驱动程序.也包括一个支持操作大多数卡的hot-swapping进程.  
当Card Services软件包正在发展时,对于新的技术经常有一段时间没有支持,由于这个原因,选择市场上最新的笔记本电脑来安装linux并不是个好主意.linux支持大多数的名牌笔记本电脑,事实上一些品牌电脑和个人电脑制造商出于一种配置也提供预装linux.

Supported Chip Sets 支持的芯片组  
这张列表经常更新,你可以从LDP's PCMCIA-HOWTO得到最新的资料.  

Supported Cards 支持的卡  
你可以从LDP's PCMCIA-HOWTO或红帽子兼容列表得到最新的资料.  
在你做为计算机专业人员的时候,有时候你被要求研究具体产品或者时代的先进技术.找个好主意,这到底多难或多容易.找  
一个本地或国际的计算机经销商,询问它们最新的笔记本电脑是否支持linux,你会得到什么样的回答?问问他们较早的型号,得到什么回答?查看公司的网页,它们是否提供英特网上的产品的信息?做这些有助于你的成功性.  

现在,对你计算机的设置你该有个好主意了,这些是一些你该考虑的:  
SCENARIOS and Solutions剧本和解决方案  
你用linux和阿帕奇做一个小型办公室网络的WEB服务器,办公室的雇员负责更新网站的各个部分.然而,所以这些人都是windows用户,并不是富有经验的shell使用者.什么软件你能给这些雇员安装以使能访问服务器上的文件?  

一个简单直接的办法就是安装一个ftp程序,但是对于windows的连通性, Samba软件将使雇员的工作更容易和更清晰.  
用户不用知道如何使用shell(或vi之类的编译器)或者ftp客户端.包含他们需要的文件的目录可以直接安装在他们的  
windows桌面上或者单独的硬盘上.  

你已经超出了/home目录的空间!你该用什么步骤把数据移动或安装到新的硬盘上?  

首先,你的准备新的硬盘来容纳新的文件系统/home.用fdisk为你目录/home创建一个足够大的分区,.用mke2fs来创建文件系统,接着把分区安装到临时目录(e.g., /mnt/tmp).从/home拷贝你所以的数据到新的分区(e.g., cp -a /home/* /mnt/tmp).  

取消安装(unmount)的所有文件系统,接着把/home重新安装(mount)到新的分区.编辑/etc/fstab映射新的/home位置.  


Certification Summary证明总结  

规划你的linux安装,使程序简单.你能想象到开始安装时会遇到的挫折,找到错误:例如,一个硬件不被支持,或你把LILO装  
在了错误的位置以致linux不能启动.对这些做好准备可以帮助你减少烦恼.  

你现在应该知道的足够多以决定那种硬件适合你的需要.你能找到丰富的资料帮你建立哪些硬件可以工作在linux下.经验表明有组织是成功的密匙.它会让你看上去很棒.  

Lab Question实验问题  

You are interested in further researching RAID on your new Linux server, but you cannot find any help in the man pages. You need to load up the Documentation CD-ROM and then find the HOWTO on RAID, as well as the RAID information in the Linux Reference Guide.  
你对你的新的linux服务器上的RAID有更多进一步的研究兴趣,但是你在帮助文档中找不到任何资料.你需要安装上文档光盘,找到RAID的HOWTO,还有linux参考指南上RAID信息.  

Lab Answer实验回答  

更多的帮助你需要文档光盘,如下:  
# man raid  
no manual entry for raid  
(stick the Documentation CD into the drive, then)  
# mount /dev/hdd /mnt/cdrom # assuming hdd is your CD Drive  
# cd /mnt/cdrom/HOWTOs/  
# ls *RAID*  
Software-RAID-HOWTO  
Root-RAID-HOWTO  
# less Software-RAID-Howto  
# xpdf /mnt/cdrom/docs/pdf-en/rhl71rg*.pdf  
# xpdf /mnt/cdrom/docs/pdf-en/rhl71ig*.pdf  

(*注:第一'二章着重讲的都是基础知识,但是原文罗列的也就是这些知识,这是不够的,希望你能自己补充不够详细的地方,有不明白的知识点上网上多查查,举一反三,否则,你很难从中学到什么.  
计划:在未来的一个星期里完成第三章的初翻译和第二章的第三版
 楼主| 发表于 2003-1-10 08:52:50 | 显示全部楼层

原文资料

原文资料
Chapter 2  

Installation Preparation  

Certification Objectives  

2.01 Planning the Installation  

2.02 Intel CPU Hardware Selection and Configuration  



Packages to Be Installed. 1  

Partitioning the Drive. 1  

Hardware Compatibility. 4  

RAM Sizing and Cache Issues. 5  

Disk Subsystems (IDE, EIDE, and SCSI) 5  

IRQ Settings. 8  

IRQs and Standard Serial Ports. 11  

Serial and Other Interface Mice. 11  

PC Card (PCMCIA) 12  



One of the strong points of Red Hat Linux is its easy installation. There are several different methods of installation, and each of them is automated to a considerable degree. However, before the actual installation, some preparation is necessary.  

CERTIFICATION OBJECTIVE 2.01  


Planning the Installation  

Before any software can be installed, the computer has to be able to recognize the hardware it will be using. The installation process will ask you about your hardware, so have this data ready before you start.  


You should know the make and model number for each of the following pieces of hardware, if you have them:  


SCSI controllers  


Network interface cards (NIC)  


Video cards  


Sound cards  


You might also need other information, such as the base I/O address and interrupt that each piece of hardware uses. Later in this chapter, we'll discuss hardware compatibility for Linux.  

Packages to Be Installed  

Red Hat Linux comes conveniently bundled with an array of pre-configured software packages. Most likely, you will not need to install all of these packages, and for security reasons (or office policy) it is a good idea not to. Your boss might not appreciate the office network being used to serve personal Web pages from each employee's installation of an Apache Web server. Also, every computer on your network doesn't need to run the innd network news service.  


Limit the packages you install to only the ones you need. If other packages are required later, they can be installed easily enough with the rpm tool.  

Partitioning the Drive  

It is recommended that you make several partitions when preparing your hard drive to install Linux. This is a good idea for various reasons. First, Red Hat Linux runs two filesystems: a Linux native filesystem, and a Linux swap space. Second, if you want to install Red Hat Linux and another operating system on the same computer, you will have to create separate partitions for each.  


The following section discusses more advantages of making partitions.  


Stability and Security  

The Linux native filesystem is usually divided among many hard drive partitions. The recommended configuration is a separate partition for each of these directories: /, /usr, /tmp, /var, and /home as well as separate partitions for corporate data, database services, and even the Web and FTP sites if they are expected to be large.  


Partitioning the hard drive in this manner keeps system, application, and user files isolated from each other. This aids in protecting the file space that the Linux kernel and the rest of your applications use. Files cannot grow across partitions. Therefore, an application that uses huge amounts of disk space, such as a newsgroup server, will not be able to use up all of the disk space needed by the Linux kernel. Another advantage is that if a bad spot develops on the hard drive, it will be easier to restore a single partition than the entire system. Stability is improved.  


Security, also, is improved. Multiple partitions give you the ability to mount some filesystems as read-only. For example, if there is no reason for any user (even root) to write to the /usr directory, mounting that partition as read-only will help protect those files from being tampered with.  


While there are many incentives to partitioning your disk space, it might not be desirable for you. For single-user systems, or where disk space is scarce, a simpler filesystem layout would be called for. For example, if the /var directory is on its own partition of 300MB, only 100MB might be used. That makes 200MB of wasted disk space. As of RH 7.x, both the web and ftp document roots have been added to /var. These may add additional disk space requirements for /var.  


Currently, there is no easy way to resize Linux partitions. Therefore, a lot of careful consideration should be put into whether you want to partition your disk space, and how to do it.  


How Much Space Is Required?  

You should size your Linux partitions according to your needs and the function of the computer. For example, a mail server will require more space for the /var directory because the mail spool resides in /var/spool/mail. You may even want to create a separate partition just to accommodate /var/spool/mail. As of RH 7.x, both the web and ftp document roots have been added to /var. These may add additional disk space requirements for /var. Generally, the root partition is a relatively modest size, and the rest is split up depending on system use.  


Example: File Server  

If the Linux system you are installing is to be a file server, then your filesystem could look something like Table 2-1.  


Filesystem  
Size (MB)  
Mounted on  

/dev/sda1  
400  
/  

/dev/sda5  
2000  
/var  

/dev/sda6  
300  
/usr  

/dev/sda7  
60  
Swap space  

/dev/sda8  
1000  
/home  

/dev/sda9  
3000  
/home/shared  


Table 1: Example Disk Partition Scheme for a Linux File Server  


The /usr filesystem is large enough to have Samba installed, as well as X11, if that is desired. Most of the disk space has been allocated to /var, for the log files, FTP and HTTPD services, to /home, for users' own files, and to /home/shared, for common files. Of course, this is only an example. The amount of disk space you allocate for file sharing will depend on factors such as the number of users and the type of files they work on.  


Linux Swap Space  

Normally, Linux can use a maximum 4GB of swap space. This 4GB can be spread over a maximum of eight partitions. Note that each swap partition is restricted to a maximum of 2GB.  


There is no authoritative formula for deciding how much swap space should be made, but you can make an estimate based on the typical UNIX rule of thumb, swap space should be two to three times the amount of RAM. Disk space is very cheap compared to RAM.  


The maximum amount of memory your system will use is the sum of all of the memory requirements of every program that you will ever run at once. You probably have no idea how much memory you absolutely need. You should buy as much memory as you can afford. The price of memory is CHEAP compared to your time in the long run trying to tune an underpowered system. Linux will comfortably run in 32MB of RAM; 64MB is better, while 128MB of RAM and above are magical!  


Linux was able to address 1GB of RAM for systems running with Pentium 1 and below CPUs. Linux kernel 2.2 was able to address 4GB of RAM (using the Enterprise kernel) with newer Pentium II and higher systems. With the new 2.4 kernel in Red Hat 7.1, Linux has extended its memory capabilities on Pentium II and higher systems to 64GB of RAM.  


The total amount of addressable space for any one program to use is the sum of available RAM and swap space. In general, Linux utilities are usually small but for something like a database service, which can load huge tables into memory and might possibly use all the available memory while doing so. The same goes for video productions, high-end graphics applications that create cartoons and GIS systems to name a few.  


You must have some swap space, as suggested earlier; two to three times the amount of RAM is common. Linux actively uses swap as additional RAM space for programs-and not just when physical memory is full. Pages of memory that haven't been used for a significant amount of time will be swapped out in an attempt to utilize as much physical memory as possible.  


Essentially, you do NOT want your system to be using swap consistently. You should add more RAM if swapping is being used heavily. Swap space is on disk, which runs five to six orders of magnitude slower than RAM, so it is a significant performance hit. That said, you still must have swap space for those unexpected events when the system needs more memory space. Keep in mind, too, the installation will attempt to put the swap partition close to the front of the disk for whatever speed improvement it can get.  


Another way to speed up swapping is to place swap partitions strategically. You aren't limited to having one swap partition in one place. This is especially useful if you are using more than one hard disk on more than one controller. You could put some swap space on a hard disk on each controller. If one controller is busy, then another can be used for swapping. Also, where you put the swap space on the hard disk can affect performance. If the data being used most often is at the beginning of the disk, but your swap space exists at the end, the drive has to work harder to move between the data and swap space. Keeping your swap space close to your "busy" data will result in more efficient use of your hard drive.  


BIOS Limits  

Be aware that some computers, built before 1998, may have a BIOS (Basic Input/Output System) that, at bootup (under DOS), limits access to hard disks beyond their 1024 cylinder. A common effect of this problem is your computer's inability to see any partitions past the first 512MB of disk space at boot time. If this limitation affects your computer, do not place any bootable partitions after this barrier or the BIOS will not be able to access them and your Linux operating system will not be able to load.  


Partitioning Utilities  

There are many disk-partitioning utilities for Linux-even utilities that do not run under Linux. Two of the main utilities that come packaged with Red Hat 7.x are fdisk/cfdisk and (during the installation steps only) Disk Druid. (Note: cfdisk is similar to fdisk, but with a full screen interface). They all work towards the same end, but Red Hat recommends you use Disk Druid during the installation. It is safer to use than fdisk, and it has a graphical interface that makes its use easier. Both fdisk and cfdisk are available once Linux is installed.  


Partitioning Naming Conventions  

UNIX is notorious for creating weird file names for hardware, and no one standard has been used by all the UNIX versions. Linux, meanwhile, has been using a simple standard for disk drives: disk device names have three letters, then a number. The first letter identifies the controller type (h is for IDE/EIDE, s is for SCSI). The second letter is d for disk, the third letter is for the sequential disk controller starting with "a." This means the first IDE drive would be hda, the next would be hdb, then hdc and hdd. The partitions are numbered starting from 1, but due to the DOS world, they may not be sequential, depending on how they were created. Under this rule, the partitions would be /dev/hda1, /dev/hda2, /dev/hda3, .../dev/hda16 for the first IDE drive, then /dev/hdb1.../dev/hda16 for the second drive, and so one  


For SCSI drives, the name is sda for the first disk on the first controller. The partitions are /dev/sda1, /dev/sda2... /dev/sda15 (only 15 maximum partitions with SCSI, whereas IDE can have 16). The second disk on the same SCSI controller would be sdaa{1,2,..15}, and so on. The second controller would have sdb{1-15} for the first disk, then sdba{1-15} for the second disk on the second controller, and so on. In RH 7.x, there are 2048 configured SCSI devices. The number of disks and partitions already configured depends on the version and distribution of Linux.  




Exercise 2-1  
Partitioning Exercise  


Although you probably have never had to do this on a basic MS Windows-oriented computer, for a real server system, one that's Windows- or UNIX-oriented, you should pre-plan your disk usage and partitions very carefully.  


On a piece of paper, draw a rectangle to represent each hard drive on your computer.  


Label them in order just as Linux would (e.g., Hard Drive 1: /dev/hda, Hard Drive 2: /dev/sda, Hard Drive 3: /dev/sdb).  


Use this diagram to plan your Linux partitions visually.  


Using this method, you can organize your data, keeping system or users' files together, as well as strategically plan where to place your swap partition(s).  

CERTIFICATION OBJECTIVE 2.02  


Intel CPU Hardware Selection and Configuration  

You have to be very careful not to choose any hardware that Linux does not yet support. Unfortunately for Linux, hardware manufacturers are still targeting the Microsoft Windows market. In order for hardware drivers to come available for Linux, either the manufacturers have to recognize the Linux market and produce drivers, or a third party has to do it. The latter brings up one of Linux's strong points. There is a vast community of Linux users, many of whom produce drivers for Linux and distribute them freely on the Internet. If a certain piece of hardware is popular, you can be certain that Linux support for that piece of hardware will pop up somewhere on the Internet and will be incorporated into Linux distributions, such as Red Hat Linux.  


Be careful when purchasing a new computer to use with Linux. Though Linux has come a long way the last few years, and you should have little problem installing it on most modern PCs,. you shouldn't assume Linux will run on any PC, especially if it is a laptop or some new state-of-the-art machine. The latest and greatest existing technology may not be supported under Linux (not yet, anyway). The hardware may also be targeted for specific operating systems and configurations. Winmodems and Winprinters are examples of hardware that will not work with Linux because they are targeted for MS Windows. Integrated hardware (e.g., video chips that share system RAM) and parallel port devices (other than printers) are other pieces of hardware you should be wary of. While there may be ways to make these types of hardware work, the process of actually making them work may cause more frustration than they're worth. Last years' model is an ideal choice; it is cheap and more likely to be supported. When it comes to laptops, your chances are best with brand names.  


Unless it has been proven that Linux will run on a newer machine, choosing an older model might be a better choice. Linux will run very well on lower-end computers. This is one of Linux's strong points over other operating systems, such as Microsoft's Windows NT. Linux runs fine on 32MB of RAM, although more is always better, especially if you want to run any applications.  

Hardware Compatibility  

You are not left without help or resources when choosing the right hardware for Linux. There are many places you can turn to for help, including mailing lists and newsgroups. Perhaps the best places to look are the LDP (Linux Documentation Project) or the Red Hat Hardware List. The LDP is a global effort to produce reliable documentation for all aspects of the Linux operating system, including hardware compatibility. Within the LDP, you can find the Linux Hardware HOWTO.  


Linux Hardware HOWTO  

The Linux Hardware HOWTO is a document listing most of the hardware components supported by Linux. It's updated irregularly with added hardware support, so it is a relatively up-to-date source of information. The latest version of the Linux Hardware HOWTO is supplied on the 3rd CD-ROM of RH 7.x in PDF format and in various languages. The location is /HOWTO/Hardware-HOWTO. A more current listing can be found on the Red Hat Web site under "Support --> Hardware." It may also be found at http://users.bart.nl/~patrickr/hard...are-HOWTO.html, within the LDP, which can be found at Sun Microsystems' Sunsite at http://metalab.unc.edu/LDP/HOWTO/Hardware-HOWTO.html or any mirror sites of Sunsite.  


The Red Hat Hardware List  

The Red Hat Hardware List specifies name brand hardware that has been tested with Red Hat Linux. Red Hat will provide installation support for any hardware listed as "supported." There is also an "unsupported" list. This list does not necessarily mean the specified hardware will not run Linux; it simply means Red Hat will not provide installation support for that hardware. There is a list for Intel, Alpha, and Sparc architectures.  


Like the LDP, the Red Hat Hardware List is kept up-to-date by volunteers. If you want to check if any of the "latest" hardware (such as USB) will run on your Linux system, it's probably best to consult the Red Hat support site first, then maybe LDP's Linux Hardware HOWTO. However, if you want the option of being able to contact Red Hat for support, you should stay within the "supported" list of the Red Hat Hardware List.  




Exercise 2-2  
Hardware Compatibility  


On the Web, visit http:// www.ibiblio.org/Linux. Once there, find the Linux Hardware Compatibility HOWTO. Take note of its date (it should be posted near the top). How current is it?  


Research the topology of the network you are on and try to find a mirror of the Linux Documentation Project closest to you on the Internet.  

RAM Sizing and Cache Issues  

Accessing a disk is relatively slow when compared to accessing memory. To optimize the use of memory, the Linux kernel keeps track of files that have already been loaded. Should a request for one of these loaded files be received, the operating system will use the cached copy rather than going to the disk. For example, when a command such as ls is executed, the binary image for that command is copied into memory. If ls is called again, then the binary is retrieved from memory instead of performing another "slow" disk read.  


Write-Through versus Write-Back Buffer Cache  

There are two types of buffer caches. One type is write-through. With write-through buffer cache, any changes to blocks of data in the cache are written to disk at once. Early MS-DOS OS versions used this immediate writing of data to disk style of memory management. The second type is write-back buffer cache and is used by most multiuser operating systems such as Linux, UNIX, NT, and VMS to name a few. This second type is also referred to as "lazy write." The system maintains the file changes in memory and when there are some free CPU cycles, writes all file changes to the disk. The actual writes to the disk are done at a later time, usually in the background, so as not to slow down other programs. While write-through cache is less efficient in terms of CPU cycles, write-back cache is more susceptible to errors. If the operating system is trashed, or power is suddenly cut, and any changes to the write-back buffer cache have not been written back to disk, the data changes stored in this buffer cache are lost. Whenever this happens, Linux automatically performs a file system check during bootup. As long as a proper shutdown procedure is followed to allow Linux to sync buffer cache to disk, Linux takes care of the cache automatically.  


Buffer Cache Size and Available Memory  

Linux automatically uses all free memory as cache and dynamically resizes the buffer cache as processes are started or stopped in memory. The system daemon bdflush is used to flush any dirty buffers (buffers where data has changed) back to disk. At any time, you can force all unwritten data to be written to disk by using the sync command (usually invoked at least three times to ensure buffers are clean. Typically this is done during rescue mode when a minimal Linux is in memory and you want to ensure any file changes you have made are absolutely written to disk; hence the "three times" rule.) When Linux boots, a daemon named update is started in the background. Update runs bdflush and performs a sync command every 30 seconds.  

Disk Subsystems (IDE, EIDE, and SCSI)  

These systems are set up and initialized before the operating system is loaded. After Linux has loaded, the settings for the disk subsystems can be modified or dealt with through software. However, in order for Linux to be loaded in the first place, the computer's BIOS has to be able to recognize the hardware that makes up these subsystems.  


IDE and EIDE  

IDE stands for Integrated Drive Electronics. It is on the IBM PC ISA 16-bit bus standard, and was adopted as a standard by ANSI in 1990 as an Advanced Technology Attachment (ATA). A setback to IDE was that it could only access 504MB of disk space. To work around this, Enhanced IDE (EIDE) was created. As well as being able to support hard disks larger that 504MB, EIDE also improved access speeds to hard drives. Support was added for additional hard disks, Direct Memory Access (DMA), and ATA Packet Interface devices (ATAPI), such as CD-ROMs and tape drives. ANSI adopted EIDE as a standard in 1994 as Advanced Technology Attachment-2 (ATA-2 or Fast ATA).  


Another issue with Intel systems is that BIOS reports only 1024 cylinders on a disk no matter how many actual cylinders there are, which can affect both IDE or SCSI. This is a limitation inherent in older BIOS systems. In this case, you must put your /boot file system within the first 1024 cylinders, or the boot loader will be unable to boot your system because BIOS will not be able to supply the correct cylinder count. Most modern PCs manufactured after 1995 have a built-in fix called Logical Block Addressing, or LBA. A system that can report LBA, will adjust the cylinder, head, and sector numbers such that the entire disk is available using these logical addresses. In general, only on relatively old machines would this ever occur.  


Problems due to hardware limitations are common and difficult to troubleshoot if you don't know about them. Familiarize yourself with as many hardware limitations as you can, including the 1024 cylinder limit inherent in some older PC models.  


SCSI  

The Small Computer System Interface (SCSI), developed by Apple Computer, allows your computer to interface to disk drives, CD-ROMs, tape drives, printers, and scanners. SCSI is faster and more flexible than EIDE, with support for 7, 15 or even 32 devices, depending on the SCSI bus width. Data transfer speeds for SCSI range from 5 to 160 or 320 MB per second. SCSI controllers are not common on most modern-day desktop PCs as SCSI disks are usually more expensive. The major PC vendors, however, will almost always provide SCSI disks and controllers for their high-end server products as the larger number of devices and faster bus speeds make them a better choice.  


Disk or Partition?  

A disk drive requires a partition table. The partition is a logical sequence of cylinders on the disk, while a cylinder represents all the sectors that can be read by all heads with one movement of the arm that contains all these heads. You can create one partition with all the cylinders, or you can create up to 16 total partitions on an IDE drive where only 15 are usable, making for a total of 15 partitions for SCSI with all 15 usable. The extended partition on an IDE-type drive cannot be used as a regular partition because it maintains the list of logical partitions within it only.  


Only 15 of the 16 IDE partitions are usable; all 15 being SCSI.  


Primary, Extended, and Logical Partitions  

You are limited to making only four primary partitions on each hard disk. To work around this, the extended partition was developed. Within an extended partition, logical partitions can be created. IDE disks can have up to 16 total partitions (3 primary and 1 extended, containing up to 12 logical partitions), whereas SCSI disks are limited to 15. Unfortunately, with the Intel PC, partition-naming conventions are neither simple nor straightforward. All logical partitions created within the extended partition have device names that range from 5 to 16 (or 15 for SCSI) no matter how many primary partitions are configured. If, for instance, you have one IDE disk and you create a single primary partition, it would be device hda1. If you then created an extended partition, technically it would be hda2 and unusable as a file system. Within this extended partition, hda2, you must create at least one logical partition, the name of which would be hda5. Names are not sequential for these devices.  


Even worse is when you create a primary partition, then create an extended partition into which you generate one logical partition. If you then created a second primary partition from some free space, the IDE drive would renumber the partitions and your bootup process would fail entirely as it would be pointed to the wrong partition due to the internal name change.  


You should know the names of the devices, as well as the starting name and number of any logical partitions created on any basic disk drive. Also be aware of the idiosyncrasies when creating partitions on IDE type drives.  


Cylinder/Head/Sector Geometry and Remapping  

The size of a hard drive is determined by its geometry. The geometry includes the number of cylinders, heads, and sectors available on the hard disk. Together, these numbers make up an address on the hard disk. Normally, the geometry your BIOS will support is limited to 1024 cylinders, 256 heads, and 63 sectors. All modern-day disk drives use 512 bytes per sector. So 1024 cylinders times 256 heads times 63 sectors times 512 bytes equals about 8GB (gigabytes) or 8000MB. If your hard disk is larger than 504MB, and you have an old BIOS that reports this disk has just 1024 cylinders, your computer will not be able to address the entire hard disk. Most modern-day PCs bypass this problem by using Logical Block Addressing (LBA) for your hard disks.  


Since SCSI devices have their own BIOS, this limitation does not affect SCSI hard disks.  


Logical Block Addressing (LBA)  

If your computer was manufactured after 1994, then you will likely be able to select LBA mode for your hard disks in your computer's CMOS. LBA involves a special way of addressing sectors. Instead of referring to a cylinder, head, and sector for a location on the hard disk, each sector is assigned a unique number from 0 to N-1, where N is the number of sectors on the disk. LBA mode allows geometry translation, which means that the BIOS can be fooled into believing the hard disk's geometry is acceptable.  


Example  

A hard disk with 2048 cylinders, 16 heads, and 63 sectors is installed in a machine. Without using LBA, the 1024 cylinder limit has been exceeded, so the DOS-based boot loader will not be able to address any cylinders past 1024 on this hard disk. By using LBA mode, the BIOS reports to DOS that the hard disk has 32 heads instead of 16. This changes the geometry to 1024 cylinders, 32 heads, and 63 sectors-within the BIOS limits. The new geometry has the same storage capacity as before, and it can be accessed entirely through LBA mode translation.  


Multiple Controllers  

It is possible and desirable to use more than one disk controller interface card at the same time on the same PC. This is a common method to increase throughput on your system by reducing your read/write bottlenecks to the only disk.  


You can use both SCSI and EIDE controllers in the same machine, but there are a few snags you should be aware of. The BIOS can only access the first two EIDE hard drives at boot time. Also, SCSI disks may not be accessible if EIDE drives are installed. The BIOS might have a setting to allow you to boot from SCSI hard disks. Make sure you understand which drives the BIOS will be able to access at boot time, because if you install the boot sector to a drive that cannot be accessed, Linux will not be able to boot.  


When your computer boots, the BIOS assigns a number to each drive letter it sees. The order in which the BIOS assigns them might not be the same order that Linux does. This can confuse LILO and cause it to fail.  


Example  

Your computer is set up to boot Linux from a SCSI disk, and the BIOS assigns the number 0x80 to /dev/sda (the SCSI disk) and 0x81 to /dev/hda (the first EIDE drive). Linux, however, assigns 0x80 to /dev/hda, 0x81 to /dev/hdb (the second EIDE disk), and 0x82 to the SCSI disk. There is a disagreement between the BIOS and LILO. LILO will not find the boot sector on /dev/sda and, therefore, will not be able to boot Linux. When you run /sbin/lilo in Linux, you will get the message "BIOS-Drive 0x82 may not be accessible." (See the section on configuring LILO in Chapter 4, "Basic Configuration and Administration," for more information. Look up the bios= option for /etc/lilo.conf.)  


RAID and MD Systems  

RAID (Redundant Array of Independent (or Inexpensive) Disks) can be set up in Linux using either hardware or software. The tradeoffs between them are performance versus price. Hardware implementations are more expensive than software implementations, but typically provide higher performance.  


The hardware implementation of RAID uses a RAID controller connected to an array of several hard disks. A driver must be installed to be able to use the controller. Linux, meanwhile, offers a software solution to RAID with the md kernel patch. You should use Linux kernel 2.0.36 or a recent 2.2.x version. Once RAID is configured on your system, Linux can use it just as it would any other block device.  


RAID can be set up with many different configurations, called levels. The following are a few basic RAID levels that RAID patches for Linux support:  


RAID0  

Reads and writes to the hard disks are done in parallel, increasing performance, but filling up all hard drives equally. Since there is no redundancy at this level, a failure of any one of the drives will result in total data loss. This level is used for speed increases. The limit to the speed of a RAID0 system is the bus speed that connects to the disks.  


RAID0 is also called "Striping without parity," providing access to 100 percent of all disks used, while offering better performance with no recovery.  


RAID1  

This level mirrors information to two or more other disks. If one disk is damaged/removed, all data will still be intact and accessible from the other disk(s) available. Also, if any spare disks exist in the system, they can be used as another mirror to replace a missing or damaged drive. While performance may actually be decreased in this level (writes), reliability is greatly increased. RAID level 1 provides the least usable space, as all disks participating in the mirror contain a complete copy of the data. However, recovery is very good as is read performance.  


RAID4  

This level requires three or more disks. Like RAID0, data reads and writes are done in parallel to all disks. One of the disks in the set maintains only parity information on all the data. If one drive fails, then the parity information can be used to reconstruct the data. Reliability is improved, but since parity information is updated with every write operation, the parity disk can be a bottleneck on the system.  


RAID5  

RAID5 works on three or more disks, with optional spare disks. With this level, several disks can be combined with both performance and reliability increases. Unlike RAID4, parity information is striped across all the disks. Instead of dedicating one disk to store the parity information, it is distributed evenly across all disks. If one disk fails, the data can be reconstructed onto a spare disk or from the parity information. In either case, there is no stoppage of the RAID system, all data is still available even with one disk failed. RAID level 5 is the preferred choice in most cases: the performance is good, the recovery is high, and the cost is second best. You lose one disk out of the set essentially to parity, so with 5 disks in RAID level 5, you get 80 percent utilization for data, and 20 percent for parity (recovery) information. With 32 disks, you get 31 of 32 disks for about 96 percent utilization.  


The RAID system should be designed as "hot-swappable." This means that if a disk were to fail, the local administrator could just pull that bad disk out of the drive enclosure while everything is still running, replace it with a new drive, and the system would automatically rebuild the data onto the new disk. This is a very powerful, but relatively expensive, capability.  


Linear Mode  

Linear mode is combining one or more disks to work as one larger device. There is no redundancy in linear mode-the disks are simply filled up in the order they appear (e.g., disk 1, disk 2, and so on). The only performance gain linear mode will experience is when several users access data residing on different disks.  


The exam may use examples from any level of RAID, including a combination of several different levels into one solution.  

IRQ Settings  

An interrupt request (IRQ) is a signal that is sent by a peripheral device (NIC, Video, Mouse, Modem, Serial Port, or other) to the CPU to request some processing time. Each device you attach to a computer may need its own IRQ value. This value is unique to each device (except for possibly PCI devices; to be explained later) so as not to confuse the computer. The Intel architecture is limited to using only 16 IRQs (0-15) of which usually IRQs 5, 7, 9, 10, 11, and 12 are available with a bare bones system. Typically sound cards use 5; a printer uses 7; video cards, bus mouses, and network cards each need 1-leaving a total of 1. (Maybe!)  


Planning the IRQ Layout-Standard IRQs  

Some IRQs are reserved by the motherboard to control devices such as the hard disk controller and real-time clock. Do not use these interrupts, or there will be conflicts! In Linux, you can check /proc/interrupts to see which interrupts are being used. Any interrupt that is not assigned is a valid candidate for a new device to use. However, there is a standard IRQ layout you can follow (shown in Table 2-2).  


IRQ  
Assigned to  

0  
Nonmaskable interrupt (NMI)-detects parity errors  

1  
System timer  

2  
Cascade for controller 2  

3  
Serial port 2, 4  

4  
Serial port 1, 3  

5  
Parallel port 2  

6  
Floppy diskette controller  

7  
Parallel port 1  

8  
Real-time clock  

9  
Redirected to IRQ2  

10  
Not assigned (usually used for a network card)  

11  
Not assigned  

12  
PS/2 mouse, if installed  

13  
Coprocessor  

14  
Hard disk controller 1  

15  
Hard disk controller 2  


Table 2: Standard IRQ Layout for PCs  


IRQs and the PCI Architecture  

A common problem with PCs today is having more devices than available interrupts. PCI devices can get around this predicament by sharing an IRQ, accomplished using the PCI bus. The PCI bus is independent of the processor, so PCI devices can have their own internal interrupts that determine which device will send an IRQ to the processor. However, your BIOS must support PCI sharing for it to work. If it does, you should be able to turn it on through your computer's CMOS. Most modern PCs manufactured after 1998 contain PCI buses.  


Plug-and-Play  

With Plug-and-Play devices, computer users do not have to tell the computer the device is there. The operating system should be able to recognize the device and set it up automatically. Plug-and-Play has been available for Macintosh computers for quite some time, and has been incorporated into Microsoft's Windows operating systems. Linux is a little behind on this technology, though it is able to configure both ISA PnP devices (isapnp utility) as well as PCI PnP (Plug-and-Play). The kudzu utility looks for any hardware changes at bootup and allows you to configure them. Most PnP technology is driven by non-UNIX operating systems (Microsoft Windows and MacOS) and Linux is starting to play along with them.  


Plug-and-Play Support in Linux  

The unfortunate truth is that Linux doesn't handle Plug-and-Play very well. The main problem lies with Plug-and-Play support for devices that run on an ISA bus. ISA is an old technology from older IBM PCs, created without Plug-and-Play in mind, so support for it is very complicated. Red Hat includes some utilities to help handle ISA Plug-and-Play devices. These utilities (e.g., isapnp and pnpdump) are kept in a package named isapnptools. You should be able to find this package in rpm format with your Red Hat installation.  


The newer, faster bus technology, PCI, is a different story. As Linux loads, device drivers can easily find their devices if they are PCI. This makes Plug-and-Play much easier for hardware that runs on a PCI bus. However, there still may be conflicts with the ISA bus. Support for PnP devices is improving, so the outlook is hopeful. Just keep in mind that you will probably have more trouble configuring an ISA device than a PCI.  


Handling Jumperless Cards  

Some cards have no jumpers; instead, information regarding which port, IRQ, and I/O address it uses is stored in a ROM chip on the card. With these cards is usually shipped a program that will allow you to change the settings. Alas, it is a Microsoft world, and these utilities usually need DOS to run. If you have a card that works like this, you'll need a DOS boot disk or partition to be able to configure them.  


If you are not licensed to use MS-DOS or Windows, there are some possible alternatives. The FreeDOS Project (http://freedos.org) is an effort to create a free version of DOS that is compatible with MS-DOS. Within Linux, there is an MS Windows Emulator called WINE that is capable of running some Windows programs with varying degrees of success.  


All in all, a better solution is to try to use hardware that does not need to be configured this way.  

IRQs and Standard Serial Ports  

The standard serial ports in Linux are /dev/ttyS0, /dev/ttyS1, /dev/ttyS2, and /dev/ttyS3 (COM1 through COM4, respectively). In your BIOS settings, the serial ports are normally set as ttyS0 and ttyS2 to IRQ 4, and ttyS1 and ttyS3 at IRQ 3. With Linux kernel 2.2 and above, there is the ability to share these interrupts. For kernel versions earlier than 2.2, you will need to assign unique IRQs to each serial port you use. This can be done at boot time by using the setserial utility and modifying the /etc/rc.d/rc.serial file similar to the following (assuming, of course, that all these interrupts are available):  


/sbin/setserial /dev/ttyS0 irq 3 # dumb terminal  
/sbin/setserial /dev/ttyS1 irq 4 # serial mouse  
/sbin/setserial /dev/ttyS2 irq 5 # first modem  
/sbin/setserial /dev/ttyS3 irq 9 # second modem  

Serial and Other Interface Mice  

For your mouse to work, you will need to know what interface and protocol it uses. Serial mice interface to a serial port, while PS/2 mice have a port and IRQ set aside. There is also another type of interface called a busmouse. Linux supports three standard busmouse-oriented protocols: Inport (Microsoft), Logitech, and ATI-XL. In order for a PS/2 mouse to work, support has to be compiled into the Linux kernel or compiled as a module.  


Serial Mice  

To use a serial mouse, you might need to assign it an IRQ if you are using more than three serial devices. Otherwise, it's just a matter of selecting the correct protocol for the mouse to use. Common protocols are Microsoft, for Microsoft mice; and Logitech, for Logitech mice. The connector for a serial mouse is rectangular with 9 or 25 pins, and plugs into a serial post. The device file for serial mice is a linked file from /dev/mouse to whatever serial port it is using (e.g., /dev/ttyS0).  


PS/2 Mice  

A PS/2 mouse (used on newer PCs and most laptops) has its own port and uses IRQ 12. A PS/2 mouse uses a 6-pin mini DIN connector and communicates using the PS/2 protocol. The device file for PS/2 mice is /dev/psaux.  


Busmouse  

You can usually identify a busmouse from its round 9-pin connector. The mice usually plug into a card, which might have jumper settings or software (for DOS) to set IRQs and base I/O addresses. While most busmice use the BusMouse protocol, some older mice use other protocols, such as MouseSystems or Logitech. The device files for Inport, Logitech, and ATI-XL busmice are /dev/inportbm, /dev/logibm, and /dev/atibm, respectively.  


The Red Hat installation process will ask you for information about your mouse. Know what kind of mouse you have! Later, you can modify your mouse settings by using the XF86Setup tool for X11, or the mouseconfig tool for using the mouse in console mode.  




Exercise 2-3  
Your Computer's CMOS Settings  


Look through your computer's CMOS settings. To get into the CMOS settings, you normally have to press a key soon after you power on your computer. This key is commonly the delete or f1 key on your keyboard. Browse through the menus and try to locate the areas where the following information is kept:  


* Your hard drive information: Take note of the "translation mode" your hard drive is using (e.g., CHS, Large, or LBA).  


* Locate the IRQ settings that your motherboard assigns to your serial and parallel ports, real-time clock, and hard disk controllers. Can you change any of these settings? (Be careful that you don't save your changes!)  


* Find out if your CMOS supports PCI sharing (for IRQs). If it does, is it turned on or off on your computer?  




PC Card (PCMCIA)  

Linux has one package that deals exclusively with PC cards called "Card Services." This package includes all the kernel modules you'll need to manage PCMCIA cards and a set of drivers for specific cards. The package also includes a daemon that handles the hot-swapping of most card types.  


While development of the Card Services package is ongoing, there is often a period where there is no support for new technologies. For this reason, the latest laptop on the market is often not a good choice for a Linux installation. Support for Linux on most name brand laptops is now common. In fact, several name brand PC manufacturers offer some distribution of Linux as an optional configuration.  


Supported Chip Sets  

This list is frequently updated. A current list of supported chip sets can be obtained from the LDP's PCMCIA-HOWTO.  


Supported Cards  

The Card Services package comes bundled with a file named SUPPORTED.CARDS. Also, you can check the LDP's PCMCIA-HOWTO or the Red Hat Hardware Compatibility List for supported cards.  


During your career as a computer professional, there will be times you'll be asked to research a specific product or technology. To get an idea of how hard or easy this can be, call a local or international computer reseller or manufacturer and inquire about their latest laptop. Ask them if it supports Linux. What kind of answer do you get? Ask them if they have any earlier models that will. Do you believe the answers you receive are reliable? Check out the company's Web page, if you can, and find out if they provide any information about the product on the Internet. Doing this kind of research can be very trying, with or without success. Before deciding what kind of hardware you want to install Linux on, you should have a good understanding of what will and will not work. Start early and build a good base of reliable references you can use to find out new computer information. There are Web sites, such as Sunsite's Metalab (and mirrors), as well as magazines like Sys Admin Magazine and PC Magazine, to help you stay informed.  


Now that you have a better idea of your computer's settings, here are a few scenarios to ponder:  


SCENARIOS and Solutions  


You are using Linux and Apache to run a Web server on a LAN for a small office. Several of the employees who work in that office are responsible for updating various parts of the Web site. However, all of these people are Windows users, and are not experienced in using shell accounts. What package could you install to give these employees the easiest access to the files they need on the Web server?  
One possibility is to install an ftp daemon, but for Windows connectivity, the Samba package would make the employees' work easier and more transparent. Users do not have to know how to use a shell account (and an editor such as emacs or vi) or an ftp client. The directories that contain the files they need could be mounted directly to their Windows desktop or separate drive letter.  


You have run out of disk space for your /home directory! What are the steps you should take to move this data to the new hard drive you just installed?  
First, you will have to prepare the new drive to accommodate the new /home filesystem. Use fdisk to create a partition with enough space for your /home directory. Use mke2fs to create the filesystem and then mount the partition somewhere temporarily (e.g., /mnt/tmp). Copy all your data from /home to the new partition (e.g., cp -a /home/* /mnt/tmp).  

Unmount both filesystems, then remount /home to the new partition. Edit /etc/fstab to reflect the new /home location as well.  






Certification Summary  

Planning your Linux installation makes the process an easier one. You can imagine how frustrating it would be to begin the installation, and then discover something wrong; for example, a piece of hardware isn't supported, or you installed LILO in the wrong place and now Linux will not boot. Being prepared for this will help lessen your grief.  


You should now know enough to be able to decide which hardware will fit your needs. Moreover, you should be able to find resources that help you make well-informed decisions about what hardware will work with Linux. Organization is the key to experiencing success with Linux. And it makes you look good.  


Lab Question  

You are interested in further researching RAID on your new Linux server, but you cannot find any help in the man pages. You need to load up the Documentation CD-ROM and then find the HOWTO on RAID, as well as the RAID information in the Linux Reference Guide.  


Lab Answer  

Most of the help you need will be on the Documentation CD as follows:  


# man raid  
no manual entry for raid  
(stick the Documentation CD into the drive, then)  
# mount /dev/hdd /mnt/cdrom # assuming hdd is your CD Drive  
# cd /mnt/cdrom/HOWTOs/  
# ls *RAID*  
Software-RAID-HOWTO  
Root-RAID-HOWTO  
# less Software-RAID-Howto  
# xpdf /mnt/cdrom/docs/pdf-en/rhl71rg*.pdf  
# xpdf /mnt/cdrom/docs/pdf-en/rhl71ig*.pdf

学习要点

3. Installation


3.1 Installation Types/Classes  


Server  
Space Requirements  
Minimum (no GUI) -- 1 GB
Everything (no GUI) -- 1.3 GB
Everything, including GUI (KDE & GNOME) -- 2 GB

File System Setup  
/ = 384 MB
/boot = 50 MB (Intel arch only)
/dos = 16 MB (Alpha arch only)
/var = 256 MB
/home = 512 MB minimum
/usr = 1400 MB minimum
swap = 1 - 2x RAM depending on available disk space

Removes all existing partitions/OSes

Workstation  
Space Requirements  
KDE or GNOME -- 1.5 GB
KDE & GNOME -- 1.8 GB

File System Setup  
/ = 1100 MB minimum
/boot = 50 MB (Intel arch only)
/dos = 16 MB (Alpha arch only)
swap = 1 - 2x RAM depending on available disk space

xinetd no longer installed by default. Increases security.
Previously installed OSes are left intact
Deletes all existing ext2 and ext3 partitions
Will be configured to dual boot if another OS is present

Laptop  
Space Requirements -- Same as Workstation
File System Setup -- Same as Workstation
xinetd no longer installed by default. Increases security.
Previously installed OSes are left intact.
Deletes all existing ext2 and ext3 partitions
Will be configured to dual boot if another OS is present.
Installs laptop related packages (card services, etc.)

Custom  
Space Requirements  
Minimum -- 350 MB
Everything -- 3.4 GB

File System Layout  

With automatic partitioning:  

/ = 700 MB
/boot = 50 MB (Intel arch only)
/dos = 16 MB (Alpha arch only)
swap = 1 - 2x RAM depending on available disk space

If automatic partitioning is not chosen, then the user configures the layout.  


Most flexible installation method.

Upgrade  
Existing installation must be at least RH 3.0.3.
Existing data is not lost.
Upgrades the kernel and all currently installed software packages.


3.2 Installation Sources  


CD-ROM  
Most convenient method.
Can boot directly from CD-ROM, or create a boot floppy from boot.img/pcmcia.img.

NFS  
Create network boot floppy from bootnet.img (or pcmcia.img for laptops).
Allows for simultaneous installations on multiple machines.

FTP  
Create network boot floppy from bootnet.img (or pcmcia.img for laptops).
Allows for simultaneous installations on multiple machines.
Handles more simultaneous installations than NFS.

HTTP  
Create network boot floppy from bootnet.img (or pcmcia.img for laptops).
Allows for simultaneous installations on multiple machines.

Samba  
Create network boot floppy from bootnet.img (or pcmcia.img for laptops).
Allows for simultaneous installations on multiple machines.

Local hard drive  
Create boot floppy from boot.img.


3.3 Installation Method  


GUI  
Most user friendly.
Only available for NFS or CD-ROM installations.

Text Mode  
Used for http, samba, and ftp installs.
Can be used for other installs if chosen.
Type "linux text" at boot prompt to enter text mode.

Expert Mode  
Permits manual setup of hardware devices.
Type "linux expert" at boot prompt to enter expert mode.

Kickstart  
Automated installation.
Must create a Kickstart configuration file(ks.cfg) describing the install.
ks.cfg can be located locally, or on the network.  
Local - floppy, cd-rom, or hard drive.
Network - Must be located on an NFS server. Requires DHCP to be configured and used.

Installation source can be CD-ROM, http, ftp, or nfs.


3.4 Partition-less Installs  


Partitionless installs allow the user to install on an existing FAT partition. In this case FAT refers to a regular FAT or a FAT32 partition. This installation method is not recommended!  


Requirements  
Enough space on FAT partition for install.
A boot disk is necessary since LILO will not be installed.
FAT partition must be formatted prior to installation.

Setup  

During the install, choose an existing FAT partition and assign your / partition to it.  


Limitations  
System will be slower.
Cannot have multiple partitions dedicated to Linux.
Requires boot disk.


3.5 Creating Disk Images  


The boot images are stored on the CD under /images. Images can be created from DOS or in Linux.  

From DOS -- use RAWRITE.COM and follow the prompts.
From Linux -- dd if=image of=/dev/fd0 bs=1k
Available images:  
bootnet.img - Used for network based install.
boot.img - Used for CD-ROM and hard drive based install.
pcmcia.img - Used for installing on laptop machines.
pcmciadd.img - PCMCIA Driver disk.
drvblock.img - Additional block drivers.
drvnet.img - Additional network drivers.
oldcdrom.img - Additional CD-ROM drivers.


3.6 Starting the installation from DOS.  


Execute the following on the CD-ROM: E:\DOSUTILS\AUTOBOOT.BAT  



3.7 Partitioning  


Manual  
Allows user to customize partitions.
Can use either FDISK or Disk Druid:  
Disk Druid  
Easier to use.
Only available at install time.
Allows easy configuration for RAID devices.

FDISK  
Always available.
Greater learning curve than Disk Druid.
Offers more features than Disk Druid.

Automatic  

Partitions are automatically configured according to installation type as described above.  


Partition Types  
Linux Native = 83
Linux Swap = 82



3.8 Rescue Mode  


RH 6.x - Requires boot.img and rescue.img
RH 7.x - Must be booted from CD-ROM
Existing filesystem will be mounted under /mnt/sysimage (7.x only)


3.9 Boot Disks  


Use mkbootdisk to create a boot floppy. You must specify a device and a kernel to use.  

mkbootdisk --device /dev/fd0 `uname -r`
mkbootdisk `uname -r`                     # Same as above.  Default device is /dev/fd0

(Note: `uname -r` returns the kernel version.)  


3.10 Package Selection  


Custom installations allow you to choose which package groups and/or packages you wish to install. Package groups are defined in /RedHat/base/comps. You can modify existing groups and define your own package groups.
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表