Linux NFS Root and PXE-Boot

November 6, 2006

Home· Linux

Linux kernel hacking and test running on the same machine becomes a major pain. This tutorial explains how to separate the two easily for a quick code-and-test loop. This tutorial explains how to setup a Linux thin client that boots using PXE by pulling a remote Linux kernel image and mounting a remote root file system over NFS. This is only possible if your client machine has a network card that supports this (do you remember seeing some type of option like press N to boot from network just after posting?). I am using Fedora Core 5 as my server, so some of the details may be specific to FC.
Most of the details of setting up the PXE boot server were found at Setting up a PXE-Boot Server.
1) yum install tftp-server dhcp
Make sure you have an NFS server.
2) create /etc/dhcpd.conf

allow bootp;
allow booting;   ddns-update-style interim;
subnet 192.168.0.0 netmask 255.255.255.0 {
range 192.168.0.10 192.168.0.254;
default-lease-time 3600;
max-lease-time 4800;
option routers 192.168.0.1;
option domain-name-servers 192.168.0.1;
option subnet-mask 255.255.255.0;
option domain-name "llama.net";
option time-offset -8;
}   host llama0 {
hardware ethernet 04:4B:80:80:80:03;
fixed-address 192.168.0.254;
option host-name "llama0";
filename "pxelinux.0";
}

Change MAC address to match that of the client machine.

3) Create the directory and add the following line to /etc/exports for the nfs share.

/nfsroot *(rw,no_all_squash,no_root_squash)

4) cp -a /bin /dev /etc /home /lib /mnt /sbin /tmp /usr /var /nfsroot

from a good Fedora Core install. You'll have to cleanup and change some of these files for your client at some point.

5) Activate tftp within xinetd by changing disable=yes to disable=no in /etc/xinetd.d/tftp. Restart xinetd. The tftp root is at /tftpboot.

6) Compile your kernel with the following options and move bzImage to /tftpboot/:

- NFS filesystem support (CONFIG_NFS_FS).

- Root file system on NFS (CONFIG_ROOT_NFS).

- Ethernet (10 or 100Mbit) (CONFIG_NET_ETHERNET).

- The ethernet driver for the clent's network card.

- IP: kernel level autoconfiguration (CONFIG_IP_PNP)

- BOOTP support (CONFIG_IP_PNP_BOOTP)

7) Configure pxelinux. First create the directory /tftpboot/pxelinux.cfg (and make it world readable). Inside that directory you need to create a number of zero size files (use touch):

01-04-4B-80-80-80-03

C

C0

C0A

C0A8

C0A80

C0A800

C0A800F

C0A800FE

01-04-4B-80-80-80-03

The first 8 are the hex representation of the 192.168.0.254 IP address that your PXE boot client will be assigned. The permutations allow a broader IP subnet to be searched first for matches. The last entry is the MAC address of your PXE boot client's NIC (with dashes substituted for the colons), with '01' pre-pended. The "01" at the front represents a hardware type of Ethernet, so pxelinux.0 see's the configuration string as an IP address.

Copy /usr/lib/syslinux/pxelinux.0 from your Fedora install to /tftpboot/

8) Now create the default pxelinux configuration inside the new file

/tftpboot/pxelinux.cfg/default:

prompt 1
default linux
timeout 100   label linux
kernel bzImage
append init=/sbin/init root=/dev/nfs rw nfsroot=192.168.0.1:/nfsroot ip=192.168.0.254:192.168.0.1:192.168.0.1:255.255.255.0:llama0::off noapic acpi=off

The last line is where you can stick any kernel parameters needed. You'll notice this menu is somewhat similar to a grub config file.

Check out the following articles for more information:

PXELINUX - SYSLINUX for network boot

NFS-Root-Client Mini-HOWTO

NFS-Root mini-HOWTO

NFS-Root

http://www.tldp.org/HOWTO/Diskless-root-NFS-other-HOWTO-4.html

Linux NFS Root and PXE-Boot的更多相关文章

  1. Linux NFS 服务部署

    系统环境:Oracle Linux 5.7 服务端:192.168.1.111 客户端:192.168.1.171 一.服务端配置 二.客户端配置 一.服务端配置 1.依次启动portmap和nfs服 ...

  2. Linux NFS存储服务部署

    什么是NFS 中文意思是网络文件系统,主要功能是通过网络(一般是局域网)让不同主机之间可以共享文件或目录 NFS属于本地文件存储服务 缺点1: 1 2 3 4 5 6 7 windows上无法使用   ...

  3. Redhat Linux NFS配置

    Linux下,All deviceis file,所有的设备都是文件.当我们需要把某些文件夹就或者文件共享给其他用户,就可以使用网络文件系统. 本文介绍Redhat Linux下的NFS配置. 在使用 ...

  4. linux nfs

    linux(十四)之linux NFS服务管理 学到这里差不多就结束了linux的基础学习了,其实linux的内容并不难,我们要经常的反复的去操作它,多多和它去联络感情才能很好的掌握这个linux. ...

  5. Linux破解root密码

    实验环境                 虚拟机软件:VMware Workstation                 操作系统:Read Hat Enteprise 6.3      1.破解r ...

  6. Linux NFS 说明,配置及故障分析

    一.NFS服务简介 NFS 是Network File System的缩写,即网络文件系统.一种使用于分散式文件系统的协定,由Sun公司开发,于1984年向外公布.功能是通过网络让不同的机器.不同的操 ...

  7. linux nfs文件夹、文件共享

    ◆一.概念 NFS是网络文件系统(Network File System)的简称,是分布式计算机系统的一个组成部分,可实现在异构网络上共享和装配远程文件系统. NFS由SUN公司开发,目前已成为文件服 ...

  8. Linux nfs下载安装与简单配置

    1.什么是NFS? 全称 network file system 网络文件系统 通过网络存储和组织文件的一种方法或机制. 2.为什么要用共享存储? 前端所有的应用服务器接收到用户上传的图片.文件.视频 ...

  9. linux nfs服务配置挂载以及oracle使用nfs存储挂载注意事项

    服务端共享目录 /home/XXX/nfs_shared 172.16.22.0/24(rw,no_root_squash) service nfs restart 常用命令: 查看所有nfs共享目录 ...

随机推荐

  1. SVProgressHUD在viewDidLoad里无法显示的bug

    两年前已经开始讨论,至今没有解决方案.https://github.com/samvermette/SVProgressHUD/issues/54 [SVProgressHUD show] 的逻辑要放 ...

  2. Apache Spark 2.3.0 正式发布

    本章内容: 待整理 参考文献: Spark Release 2.3.0

  3. 揭开Redis的神秘面纱

    本篇博文将为你解开Redis的神秘面纱,通过阅读本篇博文你将了解到以下内容: 什么是Redis? 为什么选择 Redis? 什么场景下用Redis? Redis 支持哪些语言? Redis下载 Red ...

  4. 【转】ubuntu16.04设置python3为默认及一些库的安装

    原文:https://www.cnblogs.com/jokie/p/6933546.html Ubuntu默认Python为2.7,所以安装Python包时安装的为py2的包. 利用alternat ...

  5. LeetCode: Subsets 解题报告

    Subsets Given a set of distinct integers, S, return all possible subsets. Note: Elements in a subset ...

  6. 使用echo $? 查看命令是否执行成功

    shell中的特殊变量:变量名含义$0shell或shell脚本的名字$*以一对双引号给出参数列表$@将各个参数分别加双引号返回$#参数的个数$_代表上一个命令的最后一个参数$$代表所在命令的PID$ ...

  7. hadoop 在centos中的搭建

    总体思路,准备主从服务器,配置主服务器可以无密码SSH登录从服务器,解压安装JDK,解压安装Hadoop,配置hdfs.mapreduce等主从关系. 1.环境,3台CentOS7,64位,Hadoo ...

  8. CLOS网络

    CLOS网络是指为了降低多级交换网络的成本,长期以来人们一直在寻找一种交叉点数随入.出现数增长较慢的交换网络,其基本思想都是采用多个较小规模的交换单元按照某种连接方式连接起来形成多级交换网络.

  9. linux 斜杠/

    inux OS: 使用”/“   例子:/home/user/XXX 特例:路径中某目录名包含空格,在命令行中使用cd等命令书写路径时,则要在空格前加”\“ 例子: 主目录(/home/student ...

  10. Tensorflow读写TFRecords文件

    在使用slim之类的tensorflow自带框架的时候一般默认的数据格式就是TFRecords,在训练的时候使用TFRecords中数据的流程如下:使用input pipeline读取tfrecord ...