LinuxSir.cn,穿越时空的Linuxsir!

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

灌水文章 --- --- Grub, Software RAID, LVM 的學習與?踐

[复制链接]
发表于 2003-12-16 06:38:49 | 显示全部楼层 |阅读模式
以下文章曾於一年前在 LinuxFAB 發表, 見證 Slackware 的成長及穩定, 因文章中使用的電腦仍然二十四小時運行中。


=========================================
由一部?睦褭z回?淼拿齐娔X說起 ... ...
        --- --- Grub, Software RAID, LVM 的學習與?踐,
        (DIY of Installation of Linux Distribution in a Software RAID and LVM enabled platform)

緣起:
        在一個傍晚時份, 帶著疲倦的身軀回家之際, 忽然興起一個奇怪的念頭, 促使我繞道而行. 當行經一個垃圾房之際, 看見不遠的舊傢俱收集處旁有一個鐵箱, 好像向我招手.  細看之下, 原?硎且惶 Desktop Computer. 而且更是名牌電腦, 但所有的佩件己被取走, 只剩下一個保養得不錯的鐵箱, 底板及一片 Modem.  本著自己一向的信念 -- Linux 可以延長電腦的功效, 以及環保的意念, 雖然己是疲倦不堪,但還是將它抬回家, 看可不可以起死回生, 拾回這部電腦的功用.

電腦的佩備 (Configuration):
        以下便是那部檢回?淼碾娔X的佩置備:
                IBM Aptiva Model:2176x65
                Pentinum 166
                RAM 4x8MB EDO RAM modules
                ATI Mach64 3D RAGE Video Controller with 2MB RAM
                IBM Mwave Modem/Audio Adapter (Dolphin Mwave DAP Ddapter)
替它接回 Keyboard, Mouse (PS2), ATAPI CDROM, Harddisk 及 8139too Network Card 便可進行測試

測試
        初步的結果是: 不能? CDROM Boot up (雖然 BIOS Config 可選擇由 CDROM 起動) 原因不明(因為我其中之一真藏, Knoppix 3.1 CDRW 竟然可以起動, 但其餘的卻都不可以).

Distributions 的選擇
        其中一個很好的硬體測試便是 Compile GCC 與 KDE from source ?碓囼 CPU 與 RAM 的性能與系統的散熱能力.  於是便選取了 Gentoo Distribution 1.2. 另一個原因是它可以 Boot from Network.
方法如下: (Ref: http://www.gentoo.org/doc/en/altinstall.xml)

Using GRUB

To use GRUB for network booting purposes, you must first have GRUB compiled with support for your network card. It doesn't matter if you install to floppy, or to the hard drive of the computer you wish to install Gentoo on. GRUB can be downloaded from ftp://alpha.gnu.org/gnu/grub/  .

使用 GRUB

為了使用 GRUB 作為由網絡起動的目的, 首先要?脑创a匯編中包含你所使用的網絡卡(NIC). GRUB 可以安裝在任何起動的裝備包括軟,硬磁盤.  GRUB 可以?囊韵戮W址下載: ftp://alpha.gnu.org/gnu/grub/ .


A configure example for enabling tulip support:

# ./configure --enable-tulip** --prefix=/usr
# make && make install

[** --enable-rtl8139]

將 GRUB 安裝在軟磁盤上的方法如下:

Using the GRUB shell:

# mkfs.ext2 /dev/fd0
# mount /dev/fd0 /mnt/floppy/
# mkdir -p /mnt/floppy/boot/grub/
# cp -v /usr/share/grub/i386-pc/* /mnt/floppy/boot/grub/
# grub
grub# root (fd0)
grub# setup (fd0)
grub# quit
# umount /mnt/floppy/

Now that we have a bootable GRUB floppy, we need to set up the host tftp server (I suggest netkit's tftp server) for loading our kernel and initrd.

現在 GRUB 啟動軟磁盤己製作完成, 用?砑虞d kernel 與 initrd 的 tftp 伺服器亦需裝置 (建議使用 netkit 的 tftp 伺服器)   [可以?囊韵戮W址下載: ftp://ftp.uk.linux.org/pub/linux ... it-tftp-0.17.tar.gz]

匯編與安裝如下:
# ./configure
# make && make install

inetd.conf 的裝佩
/etc/inetd.conf
tftp        dgram        udp        wait        nobody        /usr/sbin/tcpd        in.tftpd

由 Gentoo 1.2 的 ISO 鏡像文件抽取 kernel 與 initrd 如下:
# mkdir /tftpboot
# mount -o loop /path/to/gentoo-ix86-1.1a.iso /mnt/cdrom/
# cp /mnt/cdrom/isolinux/kernel /mnt/cdrom/isolinux/rescue.gz /tftpboot
# chmod 644 /tftpboot/*
# umount /mnt/cdrom/

Boot the machine you want to install to with your incredibly useful grub floppy. Once booted you need to specify a way for the machine to get its IP address, specify where to get a kernel and it's options, and where to get it's initrd.

萬事俱備, 利用準備好的 GRUB 啟動軟磁盤放入電腦?砥饎, 輸入以下的句子:

grub# ifconfig --address=192.168.0.10 --server=192.168.0.2
grub# root (nd)
grub# kernel /tftpboot/kernel devfs=nomount vga=normal load_ramdisk=1
      prompt_ramdisk=0 ramdisk_size=24000 root=/dev/ram0 rw (all on one line)
grub# initrd /tftpboot/rescue.gz
grub# boot

其中 --address= 是起動電腦的 IP 地址, --server= 是 tftp 伺服器的 IP 地址,
root(nd) 代表起源是網絡磁盤(Network Drive)
kernel ..., initrd ... 可以參考 CDROM 內 /isolinux/isolinux.cfg 該 CDROM 的起動參數

(Remark: 可將上面的句子寫入 /boot/grub/grub.conf 內, 如下:
/boot/grub/grub.conf

default 0
timeout 30
splashimage=(fd0)/boot/grub/splash.xpm.gz

title=Test My Computer
ifconfig --address=192.168.0.10 --server=192.168.0.2
root (nd)
kernel /tftpboot/kernel devfs=nomount vga=normal load_ramdisk=1
      prompt_ramdisk=0 ramdisk_size=24000 root=/dev/ram0 rw (all on one line)
initrd /tftpboot/rescue.gz

title=My example Gentoo Linux
root (hd0,0)
kernel /boot/bzImage root=/dev/hda3

# Below is for setup using hardware RAID
title=My Gentoo Linux on RAID
root (hd0,0)
kernel /boot/bzImage root=/dev/ataraid/discX/partY

# Below needed only for people who dual-boot
title=Windows NT Workstation
root (hd0,5)
chainloader +1

啟動後?倪x單選擇用那一個?韱 )

經過一星期的反?蜏y試和安裝, 結果是 ... ...

Software RAID, LVM 與 EVMS 的衝動
        由於只得 4 x 8M RAM, 不能安裝 Gentoo 1.2 (Gentoo 1.4 卻可以), 便把自己珍藏的兩條 32MB EDO RAM Modules 取代原有的兩條 8MB EDO RAM Modules. 以便安裝 Gentoo 1.2. 經過一星期的反?蜏y試和安裝, 結果是 ... ...
一. 接近安裝完成時 (Stage 3), 珍藏的兩條 32MB EDO RAM Modules 其中之一或二壞掉了 (巿價$200-$400)
二. 這部電腦不適合安裝 LinuxFromScratch, Gentoo 這? Compile from Source 的 Distribution.  (需時甚久, 要七十二小時之久才安裝完基本起動狀態, 如耍加上 XWindow 與 KDE 等需要一個月以上) (但測試用途則甚佳)
三, 測試期間被 Gentoo Distribution 的 Software RAID (Redundant Array of Inexpensive Disks), LVM (Logical Volume Management) 與 EVMS (Enterprise Volume Management System)* 等文章的吸引, 嘗試利用這部檢回?淼碾娔X, 加上兩個 15GB ATA-66 HardDisks ?戆惭b這套系統:
"Boot and Root on Software RAID 1, others on LVM with Software RAID 0"


* EVMS - harddisk configuration tools, which combine fdisk, software RAID tools, LVM tools and format different file system, journal file system tools.

RAM 容量的制肘
        由測試一部過時的電腦系統, 再為它選擇一個 Linux Distribution 作為它的合作伙伴, 真是一個不簡單的過程. 先後試了三個 Distributions, 包括 Gentoo 1.4RC-1, Mandrake 9.0 與及最後的主角 -- Slackware 8.1

        起先使用 Gentoo 1.4, 它使用了 EVMS, 一個取代了 LVM 的工具.  由於它是一個非常新?及龐大的工具, 對初學者?碚f, 基本概念也未能掌握, 是不適合作為入門的. 但它可以自動辨認出己建立的 Software RAID 與 LVM, 使用起?, 十分方便.

        Mandrak 對我?碚f是一個聞名巳久, 但一直未有機會試用的 Distribution. 今次機緣巧合, 適逄有新的版本面世, 便試一試它支不支援我這個方案?  果然名不虛傳, 它那圖形介面簡單易用, 比美 EVMS, 使用 Mouse 的 Click and Drag, 加上選單的佩合, 不需設置任何文件與輸入指令, 便可以完全安裝在我構思的系統上. 真 ... 真奇妙啊.
        可是, RAM ?在太少了, 添加 RAM Modules 又不附合經?瓌t (加多一倍半價錢, 便有一套全新, 性能高它百倍的系統), 便只好放棄這麼可?鄣 Distribution 了.

未完, 代續 .....
 楼主| 发表于 2003-12-16 06:40:35 | 显示全部楼层
Slackware 8.1 安裝在 Software RAID 與 LVM (Logical Volumne Management) 的安裝技巧

        相對而言, Slackware 在眾多 Distribution 中是比較不為人認識 (被人遺忘) 的一個. 它沒有華?的安裝晝面, 硬盤設置工具也是簡陋的可以.  但當你激情過後, 想進一步認識 Linux, 不想被人拉著鼻子走, 想有一定的自主權, Slackware 這個 Distribution 一定不會令你失望. ?倪@個 Distribution 中, 你可以很容易接近管理階層, 認識其中的噢妙, 學習管理的技巧. 當你經過了這一階段, 回頭再使用其他的 Distribution, 當會有更深一層的體會(領悟).  而且 Slackware 仍然定位于低檔次 ( 386 cpu ) 和 低容量 (16m ram) 電腦系統.  (當然您很容易調整到高檔次的系統).  所以我為這檢回?淼碾娔X系統選擇了 Slackware 這個 Linux Distribution.

        好了, 閒話少說, 要進入正題了.

如有細心留意, Slackware 8.1 基本上己支援 vfsd, software RAID 與 LVM.  但在安裝的皆段卻未有支援 , 所以需要 DIY.  首先說明裝置 Software RAID 與 LVM 的概念.

1. 佩置 Software RAID 與 LVM 需要的工具是, fdisk, software RAID tools 與 LVM tools.

安裝的系統如下: 兩個 Harddisks , 佩置成 hda 與 hdc (即兩個 Master Harddisk 分別接上 IDE0 與 IDE1 Bus 上),  利用 fdisk 將兩個 Harddisks 設置成以下:
hda1        primary        size: 100MB        type: fd (software RAID)
hda2        primary        size: 512MB        type: 82 (swap)
hda3        primary        size: 2048MB        type: fd (software RAID)
hda4        primary        size: remain        type: fd (software RAID)

hdc1        primary        size: 100MB        type: fd (software RAID)
hdc2        primary        size: 512MB        type: 82 (swap)
hdc3        primary        size: 2048MB        type: fd (software RAID)
hdc4        primary        size: remain        type: fd (software RAID)

2. 建立以下文件,
/etc/raidtab

# /etc/raidtab
raiddev /dev/md0
        raid-level                1
        nr-raid-disks                2
        persistent-superblock        1
        chunk-size                32
        device                /dev/hda1
        raid-disk                0
        device                /dev/hdc1
        raid-disk                1               
raiddev /dev/md1
        raid-level                1
        nr-raid-disks                2
        persistent-superblock        1
        chunk-size                32
        device                /dev/hda3
        raid-disk                0
        device                /dev/hdc3
        raid-disk                1
raiddev /dev/md2
        raid-level                0
        nr-raid-disks                2
        persistent-superblock        1
        chunk-size                32
        device                /dev/hda4
        raid-disk                0
        device                /dev/hdc4
        raid-disk                1
# end of /etc/raid

跟據以上的佩置文件, 建設成二個 Level 1 的 Software RAID md0, md1 與一個 Level 0 的 Software RAID md2.

# mkraid /dev/md0
# mkraid /dev/md1
# mkraid /dev/md2

3. 再將 /dev/md2 佩置成 Logical Group "Mydata"
# vgscan (enable LVM)
# pvcreate /dev/md2 (佩置 Physical Volume /dev/md2 成 Logical Volume)
# vgcreate Mydata /dev/md2 (分佩 /dev/md2 成為 [Logical] Volume Group "MyData")
如 [Logical] Volume Group "MyData" 己預先建成, 只是未 activated.  可用以下 Command ? activated:

# vgchange -ay /dev/md2  (vgchange -an /dev/md2 [-- deactivated])

4. 建立三個 Logical Volume 用? mount 成 分別是 /usr, /var 和 /home

Syntax: lvcreate -L"size" -n"Name" "Logical Group"

# lvcreate -L4G -nlv_usr Mydata
# lvcreate -L1G -nlv_var Mydata
# lvcreate -L5G -nlv_home Mydata

(如需修改, 可用以下 Commands
# vgremove /dev/Mydata [需要 deactivated]
# lvremove /dev/Mydata/lv_usr [需要 activated]
# lvremove /dev/Mydata/lv_var [需要 activated]
# lvremove /dev/Mydata/lv_home [需要 activated]
)

5. 建立檔案系統 (XFS -- 可使用 acl)

Syntax: mkfs.xfs /dev/xxx

# mke2fs -j /dev/md0
# mkfs.xfs /dev/md1
# mkfs.xfs /dev/Mydata/lv_usr
# mkfs.xfs /dev/Mydata/lv_var
# mkfs.xfs /dev/Mydata/lv_home

6. 將己建立檔案系統的 partitions 掛上 Linux 系統

# mount /dev/md1 /mnt
# mkdir /mnt/boot
# mkdir /mnt/usr
# mkdir /mnt/var
# mkdir /mnt/home
# mount /dev/md0 /mnt/boot
# mount /dev/Mydata/lv_usr /mnt/usr
# mount /dev/Mydata/lv_var /mnt/var
# mount /dev/Mydata/lv_home /mnt/home

明白以上的概念後, 要休息一喇 (羅馬也不是一天便能建成的啊 !! )
不過... ..., 可不是我休息. 只是想說另一個話題 (Boot from CD ROM Problem).作為援衝吧!

上面提過, 不知是甚麼原因, 那部電腦不能由 CDROM 起動.  需要利用 GRUB 這個工具作為網絡起動 (Network Boot).  對初學者比較麻煩.  及後又發現另一工具, 頗為有功用, 籍得一提和推介.

"Smart BootManager (Ref:- http://btmgr.gnuchina.org/ , http://btmgr.sourceforge.net/) (簡體中文介面的啊)

Smart Boot Manager (SBM) is an OS independent and full-featured boot manager with an easy-to-use user interface.

The main goals of SBM are to be absolutely OS independent, flexible and full-featured. It has all of the features needed to boot a variety of OSes from several kinds of media, while keeping its size no more than 30K bytes. In another words, SBM does NOT touch any of your partitions, it totally fits into the first track (the hidden track) of your hard disk!

SBM now supports booting from floppy, hard disk and CD-ROM. There are plans to support ZIP and LS-120 in the near future.

Smart BootManager is totally FREE!

好了, 休息過後, 馬上進入正題
當由 CDROM 起動後至 boot, 輸入
xfs.i
用 root 登入後, 放入一片軟磁碟片, 鍵入
# mke2fs /dev/fd0u1440
# mkdir /floppy
# mount /dev/fd0u1440 /floppy
# mkdir /floppy/etc
# vi /floppy/etc/raidtab
# vi /floppy/etc/fstab
# vi /floppy/etc/lilo.conf

?韮Υ嫒齻佩置檔案, raidtab, fstab 和 lilo.conf

raidtab 己在前面提過, 是用?斫 Software RAID 的.
fstab 與 lilo.conf 這兩個檔案如下:

fstab:

# /etc/fstab: static file system information.
#
# noatime turns of atimes for increased performance (atimes normally aren't
# needed; notail increases performance of ReiserFS (at the expense of storage
# efficiency).  It's safe to drop the noatime options if you want and to
# switch between notail and tail freely.

# <fs#           <mountpoint#   <type#   <opts#          <dump/pass>

# NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.

/dev/md0                 /boot                ext3        noauto,noatime        1 2
/dev/md1                /                xfs        noatime                0 1
#/dev/Mydata/lv_usr        /usr                xfs        noatime                0 1
#/dev/Mydata/lv_var        /var                xfs        noatime                0 1
#/dev/Mydata/lv_home        /home                xfs        noatime                0 1
/dev/hda2                swap                swap        default,pri=1        0 0
/dev/hdc2                swap                swap        default,pri=1        0 0
/dev/cdroms/cdrom0        /mnt/cdrom        iso9660        noauto,ro                0 0
proc                        /proc                proc        defaults                0 0
# end of /etc/fstab


lilo.conf

## /etc/lilo.conf
# LILO configuration file
# generated by 'liloconfig'
#
# Start LILO global section
lba32 # Allow booting past 1024th cylinder with a recent BIOS
boot = /dev/hda
message = /boot/boot_message.txt
prompt
timeout = 1200
# Override dangerous defaults that rewrite the partition table:
change-rules
reset
# Normal VGA console
vga = normal
# VESA framebuffer console @ 1024x768x64k
# vga=791
# VESA framebuffer console @ 1024x768x32k
# vga=790
# VESA framebuffer console @ 1024x768x256
# vga=773
# VESA framebuffer console @ 800x600x64k
# vga=788
# VESA framebuffer console @ 800x600x32k
# vga=787
# VESA framebuffer console @ 800x600x256
# vga=771
# VESA framebuffer console @ 640x480x64k
# vga=785
# VESA framebuffer console @ 640x480x32k
# vga=784
# VESA framebuffer console @ 640x480x256
# vga=769
# End LILO global section
# Linux bootable partition config begins
image = /boot/vmlinuz
  root = /dev/md1
  label = Slackware
  read-only
# Linux bootable partition config ends

## end of /etc/lilo.conf

fstab 與 lilo.conf 這兩個檔案需要自己建立是因為 Slackware 未能正確建立

跟著需要佩置硬磁盒,
# fdisk /dev/hda
# fdisk /dev/hdc

規?好 Harddisk 後,

cp /floppy/etc/raidtab /etc/raidtab

建設成 Software RAIDs: /dev/md0, /dev/md1 與 /dev/md2.
建立檔案系統

# mke2fs -j /dev/md0
# mkfs.xfs /dev/md1

# mount /dev/md1 /mnt
# mkdir /mnt/boot
# mount /dev/md0 /mnt/boot

跟著便可一切如常, 鍵入
# setup

忽略 no target 的警告 (Alert)
... ... ... ...
一定耍選擇套件 lvm-1.04-i386-1.tgz, 在 ap Group
... ... ... ...
忽略 lilo 的警告 (Alert)
... ... ... ...

到通知?男缕饎訛橹

STOP!! STOP!! STOP!!

千萬不要按照指示按 CTRL-ALT-DEL.

跟著鍵入

# cp /floppy/etc/fstab /mnt/etc/fstab
# cp /floppy/etc/lilo.conf /mnt/etc/lilo.conf
# lilo -C /mnt/etc/lilo.conf -v -v -v
# sync; sync; sync
# umount /floppy
# umount /mnt/boot
# umount /mnt
#
# reboot

跟著便?男缕饎.

完 ... ...

慢著, LVM 在何處呢?

由于 Slackware 的 initrd 內未包含有 LVM 套件, 所以... ...
安裝後重新以 root 登入

下集大結局:
鍵入以下指令:

# cd /
# vgscan
# pvcreate /dev/md2
# vgcreate Mydata /dev/md2
# lvcreate -L4G -nlv_usr Mydata
# lvcreate -L1G -nlv_var Mydata
# lvcreate -L5G -nlv_home Mydata
# mkfs.xfs /dev/Mydata/lv_usr
# mkfs.xfs /dev/Mydata/lv_var
# mkfs.xfs /dev/Mydata/lv_home
# mount /dev/Mydata/lv_usr /mnt/hd
# cp -a /usr/* /mnt/hd
# umount /mnt/hd
# mount /dev/Mydata/lv_var /mnt/hd
# cp -a /var/* /mnt/hd
# umount /mnt/hd
# mount /dev/Mydata/lv_home /mnt/hd
# cp -a /home/* /mnt/hd
# umount /mnt/hd
# vi /etc/fstab (clear the remarks for /usr, /var and /home)
# sync; sync; sync
# reboot

重新啟動後, 便真正完成了!


收拾手尾, 釋放 root 的 空間
原先安裝在 /usr, /var 與 /home 內的檔案雖然已安全抄到 /dev/Mydata/lv_usr, /dev/Mydata/lv_var 與  /dev/Mydata/lv_home 內, 但所?子玫目臻g?K未釋放.
所以, 需要重新以 CDROM 啟動, 以 root 登入
# mount /dev/md1 /mnt
# cd /mnt/usr
# rm * -rf
# cd /mnt/var
# rm * -rf
# cd /mnt/home
# rm * -rf
# cd /
# sync; sync; sync
# umount /mnt
# reboot

大功告成

進階編
在上一回所說的辨法雖然可行, 但未能一氣呵成, 總覺不是味兒, 問題的徵結是安裝程式套件內?K沒有包含 LVM Tools 套件 (雖然 kernel 已經支援).  要把套件預先準備于軟磁碟片中, 到需要時才掛上使用也是辦法.

[ 即是預先將套件放入軟磁碟片中
# mount /mnt/floppy
# mount /mnt/cdrom
# cd /mnt/floppy
# tar zxvf /mnt/cdrom/slackware/ap/lvm-1.04-i386-1.tgz
# cat /mnt/cdrom/install/doinst.sh
( cd lib ; rm -rf liblvm-10.so )
( cd lib ; ln -sf liblvm-10.so.1.0 liblvm-10.so )
( cd lib ; rm -rf liblvm-10.so.1 )
( cd lib ; ln -sf liblvm-10.so.1.0 liblvm-10.so.1 )

在安裝的時候, 將軟磁碟片放入,
# mount /dev/fd0u1440 /floppy
# cd /lib
# cp /floppy/lib/liblvm-10.so.1.0 ./
# ln -sf liblvm-10.so.1.0 liblvm-10.so
# ln -sf liblvm-10.so.1.0 liblvm-10.so.1

執行 LVM 的 commands 要加上 path, 即
/floppy/sbin/vgscan     ]

但是, Slackware 的 initrd 設計沒有預留太多空間, 加上 LVM's library 後便沒有足夠空間留給安裝程式用, 最終安裝會失敗的.

如要按此思路進行, 要解決的是重建 initrd.img 這個檔案, 即再不能? CDROM 起動, 因修改後的檔案不能寫入 CDROM 內.

修改這個 initrd.img 檔案比教高深, 需要 kernel 支援 loopback device. 現在用 tftp 伺服器仍為製作平台作為講解.

# cd /root
# mount /mnt/cdrom (啟動 CDROM)
# cp /mnt/cdrom/isolinux/initrd.img ./initrd.img.gz
# gzip -d initrd.img.gz (initrd.img.gz -> initrd.img)
# mount /mnt/floppy (己放置 LVM Tools 的軟磁碟片)
# mkdir /mnt/newinitrd
# mkdir /mnt/originitrd
# dd if=/dev/zero of=newinitrd.img bs=1k count=7168 [ about 7M size ]
# mke2fs -m5 -F -v newinitrd.img
# mount newinitrd.img /mnt/newinitrd -t ext2 -o loop
# mount initrd.img /mnt/originitrd -t ext2 -o loop
# cp -a /mnt/originitrd/* /mnt/newinitrd/
# cp /mnt/floppy/lib/liblvm-10.so.1.0 /mnt/newinitrd/lib
# cp /mnt/floppy/sbin/* /mnt/newinitrd/sbin
# ln -sf liblvm-10.so.1.0 /mnt/newinitrd/lib/liblvm-10.0.so.1
# ln -sf liblvm-10.so.1.0 /mnt/newinitrd/lib/liblvm-10.0.so
# umount /mnt/cdrom
# umount /mnt/floppy
# umount /mnt/originitrd
# umount /mnt/newinitrd
# cp /tftpboot/initrd.img /tftpboot/initrd.img.org
# gzip -c -9 newinitrd.img > /tftpboot/initrd.img

修改網絡起動磁碟片內, /boot/grub/grub.conf, 的 "ram_size=" 參數如下

title=Slackware Setup
ifconfig --address=192.168.0.10 --server=192.168.0.2
root (nd)
kernel /tftpboot/bzImage load_ramdisk=1 prompt_ramdisk=0 ramdisk_size=6464 rw root=/dev/ram SLACK_KERNEL=xfs.i
initrd /tftpboot/initrd.img

到此萬事俱備, 由網絡起動, 以 root 登入

掛上 (mount) floppy
cp /floppy/etc/raidtab /etc
佩置硬磁盤
裝設 software RAID
裝設 LVM
建立檔案系統
掛上檔案系統

安裝系統

完成前還需改動一檔案 (非常重要, 正所謂一子錯, ?M盤皆落索), /etc/rc.d/rc.S (第 124 行 至 136 行)
vi /etc/rc.d/rc.S
remark 兩行: (重新啟動後便還原)


# Initialize the Logical Volume Manager.
# This won't start unless /etc/lvmtab is found, which is created by /sbin/vgscan.
# Therefore, to use LVM you must run /sbin/vgscan yourself the first time.
#if [ -r /etc/lvmtab ]; then     <-------------------------------------------- **********
  # Mount /proc early (it's needed for vgscan):
  /sbin/mount -a -t proc
  # Scan for new volume groups:
  /sbin/vgscan
  if [ $? = 0 ]; then
    # Make volume groups available to the kernel:
    /sbin/vgchange -ay
  fi
#fi     <----------------------------------------------------------------------- **********


至此, 進階編也大功告成!!
後會有期

溫慶祥
二零零二年十二月二十七日
香港特別行政區
发表于 2003-12-17 21:34:44 | 显示全部楼层
好文!
发表于 2003-12-18 00:22:13 | 显示全部楼层
极好,雪中送炭。
发表于 2003-12-18 09:19:12 | 显示全部楼层
插句闲话,文中提到的smart boot manager是苏哲(james_su)的大作,我现在在用,很是方便。
发表于 2003-12-18 12:36:53 | 显示全部楼层
我能检回垃圾电脑就好了...
灌水...
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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