一 刀片服务器硬盘启动Linux独立安装

【原创翻译,版权所有,合作网站如欲转载,请注明原创翻译作者“刘琳倩”,及文章出处(赛迪网) 。谢绝非合作网站转载,违者,赛迪网将保留追究其法律责任的权利!】 本文将通过下面的九个步骤,为IBM BladeCenter?HS20刀片服务器去创建一个可启动的磁盘(驱动器),自安装硬盘驱动,运行SUSE Linux企业服务器10 。(这些步骤也可以适用于其它的刀片服务器) 。当系统第一次从这个驱动启动时,它将会自动地开始在磁盘上安装Linux庵植僮骺梢约跚岵僮飨低车脑ぜ痈汉刹⑶壹跚嵊没У墓ぷ髁俊?从两个系统开始: ·系统A用SLES10预加载,grub作为启动加载器 。它有两个SCSI磁盘接口,但是只有第一个被使用 。·系统B是一个只有一个磁盘驱动器的空系统,它没有操作系统的加载 。我们将用系统A给系统B准备自安装的硬盘驱动器 。首先是我们制作一个自安装的磁盘 。用两个分区格式化磁盘: ·第一个(小一些的)分区将包含SUSE安装介质;我们把它称作安装分区 。·第二个(大一些的)分区是为操作系统准备的;我们称之为操作系统分区 。第一步:正确的cabling 将两个系统的电源都关闭,从系统B拔掉磁盘(磁盘B),把磁盘B插入系统A的第二个SCSI磁盘接口 。然后从它自己的磁盘(磁盘A)启动系统,也就是第一个SCSI磁盘 。第二步:磁盘B分区 使用fdisk命令给磁盘B分区 。如果你使用SCSI磁盘,磁盘名为/dev/sdb(如果你使用另一种类型的磁盘,例如,一个IDE磁盘,因此需要调整名称 。)你可以使用fdisk –l命令来查看你磁盘设备的名称 。a.运行fdisk /dev/sdb b.输入d来删除已经存在的分区 。如果你的磁盘为空你也可以跳过这一步 。c.输入n来添加一个新的分区 。通过选择主分区和选择一号作为分区号,来创建安装分区作为主分区 。接下来,分配一个扇区从1到900(大概6.3GB是合适的,因为SUSE安装介质需要大概4.3GB)来展示列表1 。你可以根据需要来调整 。列表1:创建安装分区 blade8:~ # fdisk /dev/sdbThe number of cylinders for this disk is set to 8924.There is nothing wrong with that, but this is larger that 1024,and could in certain setups cause problems with:1) software that runs at boot time (e.g., old versions of LILO)2) booting and partitioning software from other OSs (e.g., DOS FDISK, OS/2 FDISK)Command (m for help): nCommand actioneextendedpprimary partition (1-4)pPartition number (1-4) : 1First cylinder (1-8924, default 1):Using default value 1Last cylinder orsize orsizeM orsizeK (1-8924, default 8924) : 900Command (m for help):d.输入n来创建另一个分区(操作系统分区)如下列列表2所示: 列表2:创建操作系统分区 Command (m for help): n Command actioneextendedpprimary partition (1-4)pPartition number (1-4) : 2First cylinder (901-8924, default 901):Using default value 901Last cylinder orsize orsizeM orsizeK (1-8924, default 8924) : Using default value 8924Command (m for help):但是在这个分区上不要存储任何数据;在SUSE安装过程中这个分区将被格式化 。e.输入a来在第一个分区(安装分区)切换启动标记,如下列列表3所示 。选中使分区1可启动 。列表3:使安装分区可启动 Command (m for help): aPartition number (1-4) : 1f.输入w来写入所有分区信息到表格并且退出分区,如列表4所示: 列表4:写入分区信息 Command (m for help): wThe partition table has been altered;Calling ioctl() to re-read partition table.Syncing disks.这一步将把变化提交到磁盘 。现在就已成功地将磁盘B分区 。第三步:格式化分区 用ext3文件系统来格式化磁盘B的第一个分区: 列表5:格式化第一个分区 blade8:~ # mkfs.ext3 /dev/sdb1mke2fs 1.38 (30-Jun-2005)Filesystem label=OS type: LinuxBlock size=4096 (log=2) Fragment size=4096 (log=2)904960 inodes, 1807304 blocks90365 blocks (5.00%) reserved for the super userFirst data block=056 block groups32768 blocks per group, 32768 fragments per group16160 inodes per groupSuperblock backups stored on blocks:32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632Writing inode tables: doneCreating journal (32768 blocks): doneWriting superblocks and filesystem accounting information: doneThe filesystem will be automatically checked every 37 mounts or 180 days, whichever comes first. Use tune2fs -c or -I to override.第四步:安装grub 启动程序 如下所示在磁盘B的第一个分区安装grub启动程序: a.挂载第一个分区到文件夹,例如/mnt/sdb. 运行 mount /dev/sdb1 /mnt/sdb. b. 从/boot/grub文件夹复制grub 启动文件到/mnt/sdb/boot/文件夹;包括grub进程文件和grub配置文件 。c.输入下面的命令来安装grub到磁盘B的第一个分区,如下列表六所示:grub-install --root-directory=/mnt/sdb /dev/sdb1 -recheck: 列表6:安装grub blade8:~ # grub-install -root-directory=/mnt/sdb /dev/sdb1 -recheckProbing devices to guess BIOS drives. This may take a long time.Installation finished. No error reported.This is the contents of the device map /mnt/sdb/boot/grub/device.map.Check if this is correct or not. If any of the line is incorrect,Fix it and re-run the script "grub-install".(fd0)/dev/fd0(hd0)/dev/sda(hd1)/dev/sdb你已经成功地制作了磁盘B的带grub的可启动的磁盘安装分区 。接下来,当磁盘启动时你需要使grub开始SUSE安装程序 。首先,你需要复制安装内核和initrd文件到安装分区,然后需要准备好grub配置文件 。第五步:为安装准备内核 通过从SUSE安装ISO文件来复制安装内核,从而为安装准备好内核 。创造一个/mnt/sdb/boot文件夹,然后从ISO文件/boot/i386/loader/复制linux文件和initrd到新的文件夹 。(未完待续……)

推荐阅读