{{category PCクラスタ}} *NFSROOTによるディスクレスブート環境の構築  Debian squeeze上にネットワーク経由のディスクレスブート用環境を構築する。 *master node側ファイル **/etc/hosts 127.0.0.1 localhost 127.0.1.1 hostname.hogehoge.com hostname 192.168.99.1 hostname.mycluster.home hostname 192.168.99.5 ssi5.mycluster.home ssi5 192.168.99.6 ssi6.mycluster.home ssi6 192.168.99.7 ssi7.mycluster.home ssi7 192.168.99.8 ssi8.mycluster.home ssi8 192.168.99.9 ssi5.mycluster.home ssi9 192.168.99.10 ssi6.mycluster.home ssi10 192.168.99.11 ssi7.mycluster.home ssi11 192.168.99.12 ssi8.mycluster.home ssi12 **/etc/fstab proc /proc proc defaults 0 0 UUID=hogehoge / ext4 errors=remount-ro 0 1 /boot /srv/tftp/boot none bind 0 0 LABEL=OCFS2 /work ocfs2 _netdev 0 0 /bin /NFSROOT/slave/bin none bind 0 0 /usr /NFSROOT/slave/usr none bind 0 0 /sbin /NFSROOT/slave/sbin none bind 0 0 /home /NFSROOT/slave/home none bind 0 0 /lib /NFSROOT/slave/lib none bind 0 0 /opt /NFSROOT/slave/opt none bind 0 0 /root /NFSROOT/slave/root none bind 0 0 **/etc/initramfs-tools/initramfs.conf MODULES=netboot BUSYBOX=y KEYMAP=n COMPRESS=gzip BOOT=nfs DEVICE= NFSROOT=auto **/srv/tftp/pxelinux.cfg/default DEFAULT wheezy LABEL wheezy kernel boot/vmlinuz-3.1.0-1-amd64 append initrd=boot/initrd.img-3.1.0-1-slave ip=dhcp root=/dev/nfs nfsroot=192.168.99.1:/NFSROOT/slave rw **/etc/default/atftpd USE_INETD=false OPTIONS="--daemon --port 69 --tftpd-timeout 300 --retry-timeout 5 --mcast-port 1758 --mcast-addr 192.168.99.0-255 --mcast-ttl 1 --maxthread 100 --verbose=5 /srv/tftp" **/etc/default/ntpdate NTPDATE_USE_NTP_CONF=yes NTPSERVERS="ntp1.jst.mfeed.ad.jp ntp2.jst.mfeed.ad.jp ntp3.jst.mfeed.ad.jp" NTPOPTIONS="" **/etc/default/isc-dhcp-server INTERFACES="bond0" **/etc/dhcp/dhcpd.conf option dhcp-max-message-size 2048; use-host-decl-names on; allow booting; allow bootp; ddns-update-style none; option domain-name "mycluster.home"; option domain-name-servers DNSサーバIP1, DNSサーバIP2; option ntp-servers ntp1.jst.mfeed.ad.jp, ntp2.jst.mfeed.ad.jp, ntp3.jst.mfeed.ad.jp; default-lease-time 600; max-lease-time 7200; log-facility local7; subnet 192.168.99.0 netmask 255.255.255.0 { option routers 192.168.99.1; option subnet-mask 255.255.255.0; option broadcast-address 192.168.99.255; range 192.168.99.5 192.168.99.254; send host-name = concat("ssi", binary-to-ascii(10, 8, ".", substring(leased-address, 3, 1))); filename "/srv/tftp/pxelinux.0"; option root-path "/NFSROOT/slave"; next-server 192.168.99.1; } group { filename "/srv/tftp/pxelinux.0"; server-name "192.168.99.1"; option root-path "/NFSROOT/slave"; next-server 192.168.99.1; } **/etc/exports /NFSROOT/slave 192.168.99.0/24(rw,sync,no_root_squash,no_subtree_check,fsid=0) *コマンド sudo apt-get install \ dhcp3-server atftpd nfs-kernel-server \ syslinux debootstrap ntp ntpdate sudo mkdir -p /NFSROOT sudo sudo debootstrap wheezy \ /NFSROOT/slave \ http://ftp.jp.debian.org/debian/ sudo rm -rf etc/hosts bin/* usr/* sbin/* home/* lib/* opt/* root/* sudo ne /etc/fstab sudo cp /usr/lib/syslinux/pxelinux.0 /srv/tftp/ cd /srv/tftp sudo mkdir boot sudo mount --bind /boot /srv/tftp/boot sudo ne /etc/initramfs-tools/initramfs.conf sudo mkinitramfs -o boot/initrd.img-3.1.0-1-slave sudo mkdir pxelinux.cfg sudo ne pxelinux.cfg/default sudo ne /etc/default/atftpd sudo /etc/init.d/atftpd start sudo ne /etc/default/ntpdate sudo ne /etc/default/isc-dhcp-server sudo ne /etc/dhcp/dhcpd.conf #変更点は以下 #option domain-name-servers 192.168.99.1; #option ntp-servers ntp1.jst.mfeed.ad.jp, ntp2.jst.mfeed.ad.jp, ntp3.jst.mfeed.ad.jp; #subnet 192.168.99.0 netmask 255.255.255.0 { # option routers 192.168.99.1; # option subnet-mask 255.255.255.0; # option broadcast-address 192.168.99.255; # range 192.168.99.5 192.168.99.254; # send host-name = concat("krgnode", binary-to-ascii(10, 8, ".", substring(leased-address, 3, 1))); #} #group { # filename "/srv/tftp/pxelinux.0"; # server-name "192.168.99.1"; # option root-path "/NFSROOT/kerrighed"; #} sudo ne /etc/exports #内容は以下 #/NFSROOT/kerrighed *(rw,sync,no_root_squash,no_subtree_check)