這部份是利用 AoE 分享的硬碟來開機的報告
需要利用到 gPXE 以提供網路的 bootloader, 像 PXE 一樣只是有了更多種通訊協定
測試過程是將 這邊做出來的硬碟 etch.img 用 AoE Server 分享出去,讓 client 直接可以網路硬碟開機。
Server 要做的事情有
下載與編譯 gPXE
$ mkdir gpxe-git $ cd gpxe-git $ git clone git://git.etherboot.org/scm/gpxe.git $ cd gpxe/src $ make $ cp bin/undionly.kpxe /
安裝與設定DHCP Server
$ apt-get install dhcp-server... $ vi /etc/dhcpd/dhcpd.conf host pxe-client { hardware ethernet 08:aa:bb:cc:dd:ee:ff; //這邊要輸入client的 mac address if substring (option vendor-class-identifier, 0, 9) != "Etherboot" { filename "/undionly.kpxe } else { option root-path "aoe:e0.0"; } next-server 192.168.3.1; } $ /etc/init.d/dhcpd restart
調整 Client 要用的系統
先 chroot 到系統 etch.img
$ mount -o loop,offset=$((63*512)) etch.img /mnt $ chroot /mnt (chroot)$ uname -r //確定kernel版本大於 1.6.18-5
確認 BUSYBOX=y
(chroot)$ grep BUSYBOX /etc/initramfs-tools/initramfs.conf //確認 BUSYBOX=y
修改 fstab 與 menu.lst
(chroot)$ vi /etc/fstab /dev/etherd/e0.0p1 / reiserfs notail 0 1 (chroot)$ vi /boot/grub/menu.lst kernel /boot/vmlinuz..... root=/dev/etherd/e0.0p1 ro
新增 aoetools 到 initrd
新增 /etc/initramfs-tools/hooks/aoetools
#!/bin/sh set -e PREREQ="" prereqs() { echo "$PREREQ" } case $1 in prereqs) prereqs exit 0 ;; esac . /usr/share/initramfs-tools/hook-functions [ -x /sbin/aoe-discover ] && copy_exec /sbin/aoe-discover /sbin manual_add_modules aoe
新增 /etc/initramfs-tools/scripts/local-top/aoetools
#!/bin/sh set -e PREREQ="" prereqs() { echo "$PREREQ" } case $1 in prereqs) prereqs exit 0 ;; esac case $ROOT in /dev/etherd/e*) INTERFACES=`awk -F: '/eth[0-9]*:/ { print $1 }' < /proc/net/dev` for i in $INTERFACES; do echo Bringing up interface $i for AoE ifconfig $i up done sleep 5 modprobe aoe aoe-discover ;; esac
更新 initrd
(chroot)$ update-initramfs -u -k all (chroot)$exit $ cd $ umount /mnt $ losetup -d /dev/loop0
調整完成開始測試
Server 分享硬碟
$ apt-get install vblade $ vblade 0 0 eth1 etch.img
用 gPXE 開機
因為我的網卡沒有 gPXE 的 rom 所以改以光碟代替。
從 Server 的 gpxe-git 找到 gpxe.iso 檔燒成光碟,讓 client 用光碟開機即可!
當然如果有支援 gPXE 的網卡,就可以直接用網路開機測試了!
測試結果開機很正常
但是關機不正常,因為網路先斷掉所造成的
應該改一下順序即可? not sure….
表示未來應該可以嘗試 FreeBSD, MAC OS, windows 直接網路開機….
只要有支援 AoE 的驅動程式。

The 用 gPXE 開 AoE 提供的硬碟 by 擁抱自由,使用 linux !, unless otherwise expressly stated, is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 2.5 Taiwan License.


一直有用AOE,最近才有研究gpxe,准备用他来替换现有的syslinux系统,没想到你已经N年前就做到了,佩服!
syslinux 也支援 gpxe,這樣的搭配也是不錯的 DRBL 就是這樣用
Add A Comment