Everything Penguin, Inc.

Helping to support the open source community.
Search this Site:

Local Sources
  • /pub

  • Linux OS
  • /pub/OS/Linux

  • Networking
  • /pub/Networking

  • Network Services
  • /pub/NetworkServices

  • Clustering
  • HA
  • DRM

  • Encryption
  • Keytool/OpenSSL
  • Java Samples

  • Development
  • Design
  • C/C++
  • Java
  • Perl
  • Shell
  • Web / J2EE

  • Storage
  • Filesystems
  • HPC
  • /pub/Storage

  • Not Linux ?
  • BSD
  • HP-UX
  • Solaris
  • VM
  • Windows
  • /pub/OS

  • Security
  • /pub/Security
  •  Parent Directory

    Linux Rescue over PXE
    Brett Lee
    =============================
    
    
    References:
    =======================
    http://wiki.centos.org/HowTos/PXE/Rescue_PXE
    http://www.hps.com/~tpg/notebook/pxe.php
    http://www.linuxjournal.com/article/9963
    http://www.linuxquestions.org/questions/red-hat-31/rhel4-ident-info-from-nfs-ks.cfg-at-boot-prompt-480531/
    
    
    
    
    =======================
    Here goes:
    =======================
    
    
    1.  You've got your TFTP server setup in /tftpboot (or /var/lib/tftpboot or ...)
    ----------------------------------------------------------------------------------
    
    
    2.  You've got PXE boot up and working
    ------------------------------------------
    
    [root@linux tftpboot]# ll pxelinux.0 pxelinux.cfg/default
    -rw-r--r--    1 root     root        13148 Nov 14  2008 pxelinux.0
    -rw-r--r--    1 root     root          244 Sep 20 13:06 pxelinux.cfg/default
    [root@linux tftpboot]#
    
    [root@linux tftpboot]# cat pxelinux.cfg/default
    DEFAULT 1
    PROMPT 1
    TIMEOUT 300
    DISPLAY boot/centos5.3.msg
    
    # Memtest
    LABEL 1
      KERNEL boot/memtest
    
    # Rescue Disk
    LABEL 2
      KERNEL boot/vmlinuz-centos5.3
      APPEND initrd=boot/initrd-centos5.3.img ramdisk_size=100000 text rescue ks=http://install.home.local/centos/5.3/rescue.cfg
    
    # Kickstart
    LABEL 3
      KERNEL boot/vmlinuz-centos5.3
      APPEND text ks=http://install.home.local/centos/5.3/centos5.3-ks.cfg ro root=/dev/sda1 initrd=boot/initrd-centos5.3.img
    [root@linux tftpboot]#
    
    [root@linux tftpboot]# ll boot/centos5.3.msg boot/memtest boot/vmlinuz-centos5.3 boot/initrd-centos5.3.img
    -rw-r--r--    1 root     root          279 Sep 20 16:21 boot/centos5.3.msg
    -rw-r--r--    1 root     root      6302756 Sep 20 15:08 boot/initrd-centos5.3.img
    -r--r--r--    1 root     root        94600 Sep 20 16:24 boot/memtest
    -rw-r--r--    1 root     root      1826484 Sep 20 15:09 boot/vmlinuz-centos5.3
    [root@linux tftpboot]# cat boot/centos5.3.msg
    
    ================= Boot Options ===================
    
    1. Memtest x86+
    2. CentOS 5.3 Rescue
    3. CentOS 5.3 Kickstart
    
    ==================================================
    
    
    Select 1, 2 or 3.
    Default image will boot in 30 seconds...
    ==================================================
    [root@linux tftpboot]#
    
    
    
    3.  You've got Apache serving up files:
    -----------------------------------------
    
    <VirtualHost *:80>
    ServerName install.home.local
    DocumentRoot              /var/www/html/install
    CustomLog                 logs/install.log combined
    ErrorLog                  logs/install.log
    ErrorDocument 401         /missing.html
    </VirtualHost>
    
    <VirtualHost *:80>
    ServerName 192.168.0.254
    DocumentRoot              /var/www/html/install
    CustomLog                 logs/install.log combined
    ErrorLog                  logs/install.log
    ErrorDocument 401         /missing.html
    </VirtualHost>
    
    
    
    4.  You've got /var/www/html/install as a SYMLINK to your install files
    -------------------------------------------------------------------------
    
    [root@linux tftpboot]# ll /var/www/html/install
    lrwxrwxrwx    1 root     root            9 Sep 20 12:30 /var/www/html/install -> /data/pxe
    [root@linux tftpboot]#
    
    
    [root@linux tftpboot]# ll /data/pxe/centos/
    total 12
    drwxr-xr-x    3 root     root        4096 Sep 20 15:12 5.1
    drwxr-xr-x    3 root     root        4096 Sep 20 15:12 5.2
    drwxr-xr-x    3 root     root        4096 Sep 20 16:45 5.3
    [root@linux tftpboot]#
    
    
    [root@linux tftpboot]# ll /data/pxe/centos/5.3
    total 3889706
    -rw-rw-r--    1 root     root    3971014656 Sep 20 13:47 CentOS-5.3-i386-bin-DVD.iso
    -rw-r--r--    1 root     root      6302756 Mar 20  2009 initrd.img
    -rw-r--r--    1 root     root         1770 Sep 20 15:50 ks.cfg
    drwxr-xr-x    7 root     root         6144 Mar 20  2009 mnt
    -rw-r--r--    1 root     root          508 Sep 20 16:45 rescue.cfg
    -rw-r--r--    1 root     root      1826484 Mar 20  2009 vmlinuz
    [root@linux tftpboot]#
    
    
    [root@linux tftpboot]# tail -3 /etc/rc.d/rc.local
    if [ -r /data/pxe/centos/5.3/CentOS-5.3-i386-bin-DVD.iso ]; then
      mount -t iso9660 -o loop /data/pxe/centos/5.3/CentOS-5.3-i386-bin-DVD.iso /data/pxe/centos/5.3/mnt
    fi
    [root@linux tftpboot]#
    
    
    
    5.  You've got your rescue.cfg file ready to go
    --------------------------------------------------
    
    [root@linux tftpboot]# cat /data/pxe/centos/5.3/rescue.cfg
    # Kickstart configuration file CentOS 5.3 Rescue Mode
    #
    #System  language
    #
    lang en_US.UTF-8
    #
    #Language modules to install
    #
    langsupport --default=en_US.UTF-8 en_US.UTF-8
    #
    #System keyboard
    #
    keyboard us
    #
    #System mouse
    #
    mouse none
    #
    #Retrieve rescue system from NFS
    #
    # nfs --server=$yournfsserverip
    # --dir=/directory/that/contains/disc1/CentOS/RPMS
    #
    #Retrieve rescue system from http
    #
    url --url http://install.home.local/centos/5.3/mnt
    #
    #Network information
    #
    network --device eth0 --bootproto=dhcp
    
    [root@linux tftpboot]#
    
    
    
    6.  You've got your ks.cfg file ready to go
    --------------------------------------------------
    
    [root@linux tftpboot]# cat /data/pxe/centos/5.3/ks.cfg  | more
    # Kickstart file automatically generated by anaconda.
    
    install
    #url --url http://mirror.centos.org/centos/5.3/os/i386
    url --url http://install.home.local/centos/5.3/mnt
    lang en_US.UTF-8
    keyboard us
    network --device eth0 --bootproto dhcp
    rootpw --iscrypted $1$tCFOQlPz$D97gDNp0/mfv2bCGDfPnx0
    firewall --enabled --port=22:tcp
    authconfig --enableshadow --enablemd5
    selinux --enforcing
    timezone --utc America/Denver
    bootloader --location=mbr --driveorder=hda --append="rhgb quiet"
    # The following is the partition information you requested
    # Note that any partitions you deleted are not expressed
    # here so unless you clear all partitions first, this is
    # not guaranteed to work
    clearpart --all --drives=hda
    part /boot --fstype ext3 --size=100 --ondisk=hda
    part / --fstype ext3 --size=25000 --asprimary
    part swap --size=2048 --asprimary
    
    %packages
    @cluster-storage
    @office
    @engineering-and-scientific
    @mysql
    @development-libs
    @editors
    @system-tools
    @gnome-software-development
    @text-internet
    @x-software-development
    @virtualization
    @legacy-network-server
    @dns-server
    @gnome-desktop
    @dialup
    @core
    @authoring-and-publishing
    @base
    @ftp-server
    @network-server
    @games
    @legacy-software-development
    @clustering
    @java
    @java-development
    @openfabrics-enterprise-distribution
    @emacs
    @legacy-software-support
    @base-x
    @graphics
    @web-server
    @ruby
    @smb-server
    @printing
    @kde-software-development
    @kde-desktop
    @mail-server
    @server-cfg
    @sound-and-video
    @admin-tools
    @news-server
    @development-tools
    @graphical-internet
    kmod-gnbd-xen
    kmod-gfs-xen
    kdepim
    perl-XML-SAX
    perl-XML-NamespaceSupport
    emacs
    festival
    audit
    mesa-libGLU-devel
    kexec-tools
    bridge-utils
    device-mapper-multipath
    vnc-server
    xorg-x11-server-Xnest
    xorg-x11-server-Xvfb
    kdegraphics
    libsane-hpaio
    kdemultimedia
    imake
    -sysreport
    [root@linux tftpboot]#
    
    
    
    6.  Finally, you might want to backup/restore a partition
    -----------------------------------------------------------
    
    # GET THE IMAGE
    1.  PXE boot your Linux and get a Rescue Shell
    2.  copy off a filesystem to image using:
        # dd if=/dev/sda1 | ssh nfs.home.local 'dd of=/data/Linux-sda1.img' bs=2048
    
    # RESTORE THE IMAGE
    1.  Install new disk and repeat step 1 (above)
    2.  Reverse step 2 (above) using:
        # ssh nfs.home.local 'dd if=/data/Linux-sda1.img' | dd of=/dev/sda1 bs=2048
    
    
    
    Happy Rescuing !
    
    

    Other Sites

    RFC's
  • FAQ's
  • IETF
  • RFC Sourcebook

  • Linux
  • Linux- Intro
  • Bash - Intro
  • Bash - Advanced
  • Command Line
  • System Administration
  • Network Administration
  • Man Pages (& more)
  • More Guides
  • Red Hat Manuals
  • HOWTO's

  • Reference/Tutorials
  • C++ @ cppreference
  • C++ @ cplusplus
  • CSS @ echoecho
  • DNS @ Zytrax
  • HTML @ W3 Schools
  • Java @ Sun
  • LDAP @ Zytrax
  • Linux @ YoLinux
  • MySQL
  • NetFilter
  • Network Protocols
  • OpenLDAP
  • Quagga
  • Samba
  • Unix Programming


  • Sponsors:
  • BrettLee.com
  • TheFrontOffice.BIZ
  • ScubaNavigator.com
  • Nitrox.net

  • [ Statistics by AWStats ]

    [ Powered by Red Hat Linux ] [ Powered by Apache Server] [ Powered by MySQL ]

    In an effort to provide a service of value to the open source community, I've put together this website that containing many of my notes and references.

    This website is not authoritative and it is certainly not without errors; it is a work in progress.

    In addition to my contributions you will also find the work of others. Where the work is not mine, I have tried to indicate that, and to reference the source of the work: by citing the original author, retaining the authors' name and license wherever present, or by placing the work in a suitably named URL containg /external/ in the path. If you find any work here that should not be publically available, please send me a note and it will be removed.

    As for my contributions, you are free to use any of *MY* notes or code from this website unless specifically instructed otherwise.

    Brett Lee, Ph.D., President & CEO
    Everything Penguin, Inc.