灌溉梦想,记录脚步
« »
2009年6月20日技术合集

linux通过ISCSI无盘启动

一、环境

server: HP Athlon 64bit 3500+ | (running ietd,ISC dhcp,pxelinux,tftp-hpa)

client: DELL Latitude | D610 | (running iSCSI initiator Core)

kernel ver 2.6.14.5 , both server & client machines

二、Server Tasks:

  Setup ISC DHCP
  Setup Syslinux (for PXELinux) & TFTP-HPA
  Setup TFTP-HPA
  Setup iSCSI Target (ietd enterprise target)
  • ) Update! you can skip the dhcp,syslinux,tftp steps by running this auto-configurator!
 wget http://linux-iscsi.org/iscsiboot/server-scripts/pxeserver-setup.sh

三、Client Tasks:

  Setup iSCSI initiator (iSCSI initiator Core)
  Boot time

四、Setup ISC DHCP http://ftp.isc.org/isc/dhcp/dhcp-3.0.3.tar.gz

edit /etc/dhcp/dhcpd.conf

 allow booting;
 allow bootp;
 option routers 192.168.1.6;
 option subnet-mask 255.255.255.0;
 ddns-update-style ad-hoc;
 subnet 192.168.1.0 netmask 255.255.255.0 {
    range 192.168.1.111 192.168.1.115;
 }
 group {
    next-server 192.168.1.6;
    filename "pxelinux.0";
    host laptop-eth0 {
        hardware ethernet 00:00:00:00:00:00; (replace with your mac-address)
 }

五、Setup PXELinux http://kernel.org/pub/linux/utils/boot/syslinux/syslinux-3.11.tar.gz

1) untar syslinux, make && make install

2) untar tftp-hpa, make && make install

  mkdir -p /tftproot/pxelinux.cfg
  cp pxelinux.0 /tftproot
  • ) build a kernel for your client and cp to /tftproot/
  • ) make an initrd and cp to /tftproot

edit /tftproot/pxelinux.cfg/default

  TIMEOUT 50
  PROMPT 1
  LABEL iscsiboot
  KERNEL vmlinuzLaptop
  APPEND root=/dev/ram initrd=bblinux25M
  IPAPPEND 1
  LABEL disk
  LOCALBOOT 0

六、Setup TFTP-HPA http://www.kernel.org/pub/software/network/tftp/tftp-hpa-0.41.tar.gz

  tar zxvf tftp-hpa-0.41.tar.gz
  cd tftp-hpa-0.41
  ./configure
  make
  make install
  • ) Start tftpd: /sbin/in.tftpd -l -v -s /tftproot

Setup iSCSI Target

1) download ietd

  svn export svn://svn.berlios.de/iscsitarget/trunk
  cd trunk && make KERNELSRC=/usr/src/linux && make KERNELSRC=/usr/src/linux install

2) make some test disk.

  ie: dd if=/dev/zero of=/iscsi-diska bs=4096k count=1024

3) configure your new LUN in /etc/ietd.conf

  Target laptop:diska
  Lun 0 Path=/iscsi-diska,Type=fileio
  Alias dell
  DataPDUInOrder Yes
  DataSequenceInOrder Yes

4) start ietd

  /etc/init.d/iscsi-target start

(client side installation notes)

七、Setup iSCSI initiator Core

1) download core-iscsi-tools

http://kernel.org/pub/linux/utils/storage/iscsi/core-iscsi-tools-v3.3.tar.bz2

2) download core-iscsi

http://kernel.org/pub/linux/kernel/people/nab/iscsi-initiator-core/core-iscsi-v1.6.2.5.tar.bz2

3) compile core-iscsi

  make initiator KERNEL_DIR=/usr/src/linux && make install

4) compile core-iscsi-tools

  make install

iSCSI core stack is then loadable via iscsi_initiator_mod.ko,

core tools rely upon /etc/sysconfig/initiator

  CHANNEL="0 2 eth0 192.168.55.6 3260 0"

and /etc/sysconfig/iscsi_device_maps

  DEVICE="0 0 1 diska"

八、Boot time

1) Change bios on client to pxeboot before HD

2) at the pxelinux prompt, type iscsiboot (referring to label in pxelinux.cfg/default)

after successfully booting, do something like this:

  /bin/mount / -o rw,remount
  /bin/mount -t proc none /proc
  /bin/mount -o sysfs /sys
  /sbin/ifconfig eth0 192.168.1.92 255.255.255.0
  cd /dev && /bin/mknod sdb1 b 8 17
  NAME=$(/sbin/initiator-iname)
  echo "InitiatorName=$NAME" > /etc/initiatorname.iscsi
  /etc/rc.d/init.d/initiator start
  • ) If this is a new installation, partition and create a file system, then copy minimal files to your new disk
  /bin/fdisk /dev/sdb # (create partition)
  /bin/mke2fs /dev/sdb1
  /bin/mount /dev/sdb1 /laptop:diska
  cp -dpRav /bin /sbin /dev /etc /var /lib /usr /tmp /laptop:diska
  • ) And, lastly:
  /bin/chroot /laptop:diska /bin/bash

日志信息 »

该日志于2009-06-20 17:42由 admin 发表在技术合集分类下, 你可以发表评论。除了可以将这个日志以保留源地址及作者的情况下引用到你的网站或博客,还可以通过RSS 2.0订阅这个日志的所有评论。

发表回复