Start Linux (WinXP) test by hard disk mirror
1. Test purposes
1. After familiarity with the hard disk image by DD, the LINUX starts after deploying
2. Familiar with the principle and production of ramdisk
3. Solve problems with different operating systems on nodes
2. Test environment
Waves the NF180 server, configured as follows: Linux operating system is
2.4.20-8smp,
Waves the NF260 server, configured as follows: Linux operating system is
2.4.20-15SMP,
A twisted pair.
NF180 is a server (DHCP) server (SERVER in the text),
Nf260 as a start-up client (CLIENT)
3. Test principle
Please refer to PXE, NFS principle
4. Experimental procedure
1). Configure the DHCP service of the Server end
DHCP server IP is 10.151.11.149
PXE launched client MAC address is 00:
0C: 76: AD: 94: 3B
PXE started client IP 10.151.11.176
Configure the /etc/dhcpd.conf file, configure the following (red logo is a key modification section):
#################################################
Deny UNKNOWN-Clients;
Option Subnet-Mask 255.255.0.0;
Option Broadcast-Address 10.151.255.255;
Option Domain-name "langchao";
Option routers 10.151.11.149;
DDNS-UPDATE-STYLE NONE NONE NONE
Subnet 10.151.0.0 Netmask 255.255.0.0 {
GROUP {
Host node {
Hardware ethernet 00:
0C: 76: AD: 94: 3B;
Fixed-Address 10.151.11.176;
FileName "Pxelinux.0";
}
}
}
#################################################
After the configuration is complete, start the DHCPD service using Service DHCPD Start.
2). Configure the TFTP service of the Server end
The Linux kernel comes with TFTP-Server
Use TFTP service with xinetd, my /etc/xinetd.conf file is as follows
#################################################
Service TFTP
{
Disable = no
Socket_type = DGRAM
Proctocol = UDP
Wait = yes
User = root
Server = /usr/sbin/in.tftpd
Server_args = -s / tftpboot
PER_SOURCE = 11
CPS = 100 2
Flags = IPv4
}
#################################################
After the configuration is completed, use the Service Xinetd Start to start the TFTP service.
3). Configure the file required when the Client starts on the server.
Create a directory / tftpboot on the Server, will /usr/bin/syslinux/pxelinux.0 (if you do not have syslinux, you need to install the RPM package first) to copy to / tftpboot /, pxelinux.0 is the startup file, and new construction under / tftpboot A pxelinux.cfg directory, the client starts in this directory to find the configuration file corresponding to its IP, the name of the file is the 16-encycloped output of the IP address (such as the client through DHCP 10: 151) : 11: 176, start the configuration file name
0A970BB0), the file format is
################################
DEFAULT Linux
PROMPT 0
Label Linux
Kernel VMLinuz
append initrd = initrd rw root = / dev / ram0 init = / linuxrc
######################################################################################################################################################################################################################################################################################################## ##
4). Making ramdisk (Initrd Image)
RAM: Memory, Disk: Disk, RamDisk means using your partial memory space to simulate a hard disk partition, actually draw a part from memory as a partition, in other words, it is to use the memory as a hard drive, you You can save files.
Copy the Client End Original / Boot / Initrd-
2.4.21-15.Elsmp.img as a start-up IMG (behind image)
##############################################################################
CD / boot
cp -a initrd-
2.4.21-15.elsmp.img /TFTPBOOT/INITRD.IMG
MV Initrd.img Initrd.gz
gzip -d initrd.gz
Mount -o loop Initrd / TMP
CD / TMP
######################################################################
Add a command in Image
Copy the command under / bin or / sbin or / usr / sbin to / TMP / BIN (enable the Initrd to include these commands)
Points by level:
Bash, chroot, init is a command that must be in startup;
FDISK, INSMOD, LSMOD, RMMOD, GUNZIP, GZIP, BUSYBOX, LS are started
The command that can be used after the Client end Linux, can be deleted as needed, and other commands can be loaded;
Under these commands to / tmp / bin, you need to copy these commands corresponding to the module files to ensure proper use, first use LDD to find the current command you need, then copy it to / TMP / LIB
The final module file in this test is, where the document starting at LIB (LD) is later joined.
-rwxr - r - 1 0 0 214188
2004-09-02 AIC79xx.o
-rwxr - r - 1 0 0 5076 2004-09-02 Diskdumplib.o
-rwxr - r - 1 0 0 115000 2004-09-02 EXT3.O
-rwxr - r - 1 0 0 72380 2004-09-02 JBD.O-RWXR-XR-x 1 0 0 103840 March 28 06:42 LD-Linux.so.2
-RWXR-XR-X 1 0 0 19248 March 30 01:41 Libacl.so.1
-RWXR-XR-X 1 0 0 7148 March 30 01:41 Libattr.so.1
-RWXR-XR-x 1 0 0 1567768 March 28 06:41 Libc.so.6
-RWXR-XR-x 1 0 0 14868 March 28 06:41 Libdl.so.2
-rwxr-xr-x 1 0 0 11784 March 28 06:41 Libtermcap.so.2
-rwxr - r - 1 0 0 142340 2004-09-02 SCSI_MOD.O
-rwxr - r - 1 0 0 19800 2004-09-02 SD_MOD.O
c) Add a driver
Add a new folder DRV to / TMP, add a client network card and NFS driver (such as image acquisition is not passing to the server through NFS, etc., if you need to load other drivers, for example, if you have the hard disk image, there is a SAN, add The driver of the HCA card), which only needs to add NFS and NIC drivers.
CD / LIB / MODULES /
2.4.20-8smp /
Find the modules.Dep file (module that records each driver module)
######################################################################
.............................................
/ lib / modules /
2.4.20-8smp / kernel / fs / nfs / nfs.o: /lib/modules/2.4.20-8smp/kernel/fs/lockd/lockd.o /
/ lib / modules /
2.4.20-8smp / kernel / net / sunrpc / sunrpc.o
.............................................
Indicates NFS.O to rely on Sunrpc.o, followed by Lockd.o, then load NFS.O
Similarly, the driver of the network card is usually driven by the network card.
/ lib / modules /
2.4.20-8SMP / KERNEL / Drivers / Net / E100 / E100.O:
/ lib / modules /
2.4.20-8smp / kernel / drivers / net / e1000 / e1000.o:
In this test, the Client end network card is a Gigabit NIC, so the last DRV directory structure is:
DRWXR-XR-X 2 0 0 1024 March 28 07:39 Net
DRWXR-XR-X 2 0 0 1024 March 28 07:39 NFS
NFS directory (driver required by NFS)
-rwxr - r - 1 0 0 75764 March 28 07:36 Lockd.o
-rwxr - r - 1 0 0 0 125108 March 28 07:35 NFS.O
-rwxr - r - 1 0 0 107856 March 28 07:39 Sunrpc.o:
NET directory (drive required by the network card)
-rwxr - r - 1 0 0 0 89684 March 30 01:38 E1000.OD) Modify / TMP / etc / inittab file
Modify the ETC / InitTab file in InitD, then the modification is as follows:
######################################################################
ID: 5: INitDefault:
# System initialization.
Si :: sysinit: / bin / bash
# 10: 0: Wait: /etc/rc.d/rc 0
# 11: 1: Wait: /etc/rc.d/rc 1
# l2: 2: Wait: /etc/rc.d/rc 2
# l3: 3: Wait: /etc/rc.d/rc 3
# l4: 4: Wait: /etc/rc.d/rc 4
# l5: 5: Wait: /etc/rc.d/rc 5
# l6: 6: Wait: /etc/rc.d/rc 6
# Trap ctrl-alt-delete
#ca :: ctrlatdel: / sbin / shutdown -t3 -r Now
#Hen Our Ups Tells US Power Has Failed, Assume We Have A Few Minutes
# of power ing. Schedule a shutdown for 2 minutes from now.
# This does, of course, assume you have powerd installed and your y
# UPS Connected and Working Correctly.
#pf :: PowerFail: / sbin / shutdown -f -h 2 "Power Failure; System Shutting Down"
# Ration................
#pr: 12345: PowerokWait: / sbin / shutdown -c "power rest)
# Run GetTys in Standard Runlevels
# 1: 2345: Respawn: / sbin / mingetty TTY1
# 2: 2345: Respawn: / sbin / mingetty TTY2
# 3: 2345: Respawn: / sbin / mingetty TTY3
# 4: 2345: Respawn: / sbin / mingetty TTY4
# 5: 2345: Respawn: / sbin / mingetty tty5
# 6: 2345: Respawn: / sbin / mingetty TTY6
# Run XDM in Runlevel 5
#x: 5: Respawn: / etc / x11 / prefdm -nodaemon
######################################################################
e) Modify LinuxRC
You can write the drive under / TMP / DRV in LinuxRC, so when the Client starts, load the driver; (I use the Client to start, the effect is the same)
The modified LinuxRC file is
######################################################################
#! / bin / nash
Echo "Loading SCSI_MOD.O MODULE"
INSMOD /LIB/SCSI_MOD.O MAX_SCSI_LUNS = 128
Echo "Loading SD_MOD.O MODULE"
INSMOD /LIB/SD_MOD.O
echo "Loading Diskdumplib.o Module" Insmod /Lib/diskdumplib.o
Echo "Loading AIC79xx.o Module"
Insmod /lib/aic79xx.o
Echo "Loading JBD.O Module"
Insmod /lib/jbd.o
echo "Loading Ext3.o Module"
Insmod /LIB/ext3.o
Echo mounting / proc filesystem
Mount -T Proc / Proc / Proc
Echo CREANG BLOCK DEVICES
MkDevices / dev
Echo Creating Root Device
Mkrootdev / dev / root
Echo 0x0100> / proc / sys / kernel / real-root-dev
Echo mounting root filesystem
#mount -o defaults - RO -T EXT3 / DEV / ROOT / SYSROOT
#pivot_root / sysroot / sysroot / initrd
#umount / initrd / proc
Exec / bin / chroot. / sbin / init
######################################################################
5). Making VMLinuz
This is the kernel that client starts, indicating in the configuration file launched in the client.
The production process is as follows:
CD / root
cp -a vmlinuz-
2.4.20-8smp / TMP / VMLinuz
6). Configuring NFS services
Modify the Server / ETC / EXPORTS file to provide NFS services
After the modification, the file content is:
/ MNT / SDB * (RW, Async, All_Squash)
Service NFS Start launches NFS service
7). Start Client
Configuring a client from the NIC
After the start is successful, configure the NFS directory of the Client side, the NFS directory of the Server end on mount
Busybox ifconfig eth0 10.151.11.176 Netmask 255.255.0.0
Busybox mount -o nolock 10.151.11.149:/mnt/sdb / drv
8). Making a client hard disk image
CD / DRV
Busybox DD if = / dev / sda bs = 1024k | gzip -v9> fs.gz
(………long wait………)
9). Distribute client hard disk images
Step 7 of the experimental process
BusyBox DD if = fs.gz | gzip -v> / dev / sda
10). Start Client
Modify the startup order, start from the hard disk, OK!
11). Change client operating system
Win2003Server is installed in the Client, repeat the process of hard disk mapping after loading
Restart the client through the network card, success.
5. Test summary
During the test, the following issues occurred:
1. Sometimes the Client is started when the IP is not the IP configured by the server, causing the start-up configuration file (file obtained according to IP rules)
Analysis: Since there are other DHCP servers in this network segment, this type of problem is resolved: two-stranded lines are used to connect two machines, or disconnect the external network, so that only Server is only server as DHCP in the LAN
2 Client After the PXE is started, execute to Creating Block Devices (LINUXRC file in Initrd can know, execute the MkDevices / dev process), the system is not going down;
Analysis: Some drivers may be missing;
Solve: In the process of the first test, it is the initrd.img, and the corresponding driver copy from the Server-side, found that there are few drivers, considering the difference between Server and Client hardware, during the second test process. When I re-use initrd.img, INITRD.IMG from the client side as Ramdisk,
It was found that there was more AIC79xx.o in this initrd. After restarting the client, it was found to be resolved.
3 After the client starts in PXE, I found that MOUNT is not NFS.
Analysis: Permissions are not set correctly;
Solve: Re-modify the / mnt / sdb, problem solving