【原創翻譯,版權所有,合作網站如欲轉載,請注明原創翻譯作者“劉琳倩”,及文章出處(賽迪網)。謝絕非合作網站轉載,違者,賽迪網將保留追究其法律責任的權利!】
本文將通過下面的九個步驟,為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 action e extended p primary partition (1-4) p Partition number (1-4) : 1 First cylinder (1-8924, default 1): Using default value 1 Last cylinder or +size or +sizeM or +sizeK (1-8924, default 8924) : 900 Command (m for help): |
d.輸入n來創建另一個分區(操作系統分區)如下列列表2所示:
列表2:創建操作系統分區
Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4) : 2 First cylinder (901-8924, default 901): Using default value 901 Last cylinder or +size or +sizeM or +sizeK (1-8924, default 8924) : Using default value 8924 Command (m for help): |
但是在這個分區上不要存儲任何數據;在SUSE安裝過程中這個分區將被格式化。
e.輸入a來在第一個分區(安裝分區)切換啟動標記,如下列列表3所示。選中使分區1可啟動。
列表3:使安裝分區可啟動
Command (m for help): aPartition number (1-4) : 1 |
f.輸入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到新的文件夾。
(未完待續……)