Вы находитесь на странице: 1из 20

Root over nfs clients & server Howto.

Hans de Goede hans@highrise.nl


v1.0 30 1999
server clients
/ ' .
______________________________________________________________________
Table of Contents
1.
1.1
1.2
2.

2.1
2.1.1 ws ( )
2.1.2 ' /home
2.1.3 ws ip , server;
2.1.4 ws
2.1.5
3. server
3.1 .
3.2 /tftpboot, symlinks /tmp, .
3.2.1
3.2.2
3.3 export file systems bootp
3.3.1 export file systems
3.3.2 bootp
4. workstations
4.1 EPROM
4.1.1
4.1.2 EPROM
4.2 ws dir
4.3 /etc/bootptab /etc/hosts
4.4 ws
4.5 ws .
5. : cd-rom
5.1
5.1.1
5.2 .
5.3 cd
5.3.1 boot image
5.3.2 iso image
5.3.3 iso image
5.3.4 CD
5.4 Boot CD
6.

7.

______________________________________________________________________
1.
howto <http://xmame.retrogames.com/hans>.
"nfs over root". howto's
"root over nfs" :
1. server client,
.
"root over nfs" , . ,
( ) "root over
nfs". , .
2. , root
server (workstations ws), mini-root ws.
:
.
server
client, . !
clients.
/ .
' / RedHat
5.2 . , SysAdmin
Linux. ,
.
1.1.
howto's :
'
, , :
copyright,

, .
,
.
,
,
.
,
,

, .
, :
.
, , ,
, .
1.2.

v0.1, 20 1999 :
HHS, .
v1.0, 30 1999 :
, ISM.
2.
, clients root-fs
server. , , clients :
.
2.1.
, .
, ' .
2.1.1. . ws (
)
, Linux
:
1. /dev
2. /var
3. /tmp
3 ' ,
/dev :
1. ramdisk untarring tarball,
(template) .
:
a. , .tmp
logs. , ' ,
server.
b. server,
. ramdisk
server , .
:

a. .
b. logs .
logging clients, syslog
logging server.
2. dir ws server,
rw nfs.
& :
a. dirs server, -
.
3. kernel 2.2, devfs /dev .
virtual filesystem, /proc /dev.

a. :
b. devfs , ramdisk /
server, .
/dev 1.5 MB,
( device) 1k,
1200 devices. ,
"" /dev, ,
. 1.5 MB
ramdisk, server.
c. devfs
, .
:
a. /dev , symlinks
cd-rom. To devfs script, rc.devfs,
. scripts, '
howto, symlinks,
rc.devfs . /dev
, rc.devfs, ,
:
/etc/rc.d/rc.devfs save /etc/sysconfig
, .
howto,
:
/dev , devfs.
/var /tmp ,
(shared) ramdisk MB. ( shared,
.)
/tmp ' symlink /var/tmp ,
.

ramdisk tarballs,
(template) dirs. directories
, .
2.1.2. ' /home
, client/server
*nix /home rw server. ',
! ;)
2.1.3. ws ip ,
server;
, ,
Linux ip :
1. RARP
2. Bootp
rarp , bootp .
bootroms (ROMs )
bootp, .
2.1.4. ws
Redat,
/, /etc/sysconfig .
, symlinks.
, /etc/sysconfig ws.
, distribution :
distributions, directory
,
, symlinks. , /etc/rc.d/rc3.d (
distributions)
server, ' , workstations.
ws services runlevel 3,
runlevels 3 workstations
server :
1. /etc/rc.d/rc3.ws /etc/rc.d/rc3.server
2. /etc/rc.d/rc3.d symlink /etc/sysconfig/rc3.d
3. /etc/sysconfig/rc3.d symlink
/etc/rc.d/rc3.xxx
4. S99local rc3.ws ' link
/etc/sysconfig/rc.local , ws rc.local
2.1.5.
:
1. /etc/rc.d/rc.sysinit /var, /var
/etc/rc.d/rc.sysinit .

, ws /etc/sysconfig
initscripts.
script ws, -
/etc/rc.d/rc.sysinit . script
() server , script
,
server.
2. /etc/mtab :
! link
/proc/mounts , mounts /proc
, fsck mount
initscripts, /proc . :
smb(u)mount link mtab,
. , smb(u)mount,
wrapper scripts, symlink.
3. server
server
diskless clients.
3.1. .
,
"root over nfs".
:
1. Redat 5.2 2.2,
RedHat 5.2 2.2 .
RedHat HowTo ' .
2. , server
ws's, ' modules (module
conflicts), server ws's /lib/modules .
,
,
- makefile .
conflicts.
3. , :
ext2 compiled ( server,
client).
nfs root-over-nfs compiled (
client, server), nfs over root 2.2
ip-autoconfig . ,
bootp.
ws's compiled (
client, server).
devfs compiled ( client,
server).
, , . modules
device server, /

ws's, .
4. source , '
"root-over-nfs" mount
/tftpboot/<ip>/root , /tftpboot/<ip>.
"" directories /tftpboot ,
dir ws, root ws ( link
root server), directory,
ws..
2.0 : "define" :
"include/linux/nfs_fs.h" , "NFS_ROOT" .
2.2, "define" :
"fs/nfs/nfsroot.c" .
5. compile ( "Kernel
owo").
6. /dev/nfsroot , :
mknod /dev/nfsroot b 0 255.
7. compile , root nfsroot,
:
rdev <path-to-zImage>/zImage /dev/nfsroot
8. boot devfs,
/etc/conf.modules : conf.modules
devfs ' .
9.
ip's, ip
server. , , , server
ip's. ' timeouts, :
append="ip=off" /etc/lilo.conf Linux.
10.
lilo .
11.
devfs, symlinks
server. RedHat, /dev/mouse
/dev/cdrom. . ,
ownerships, chown /dev.
, /dev ( /etc/sysconfig,
ws's) :
rc.devfs devfs source
, /etc/rc.d/rc.devfs .
, :
/etc/rc.d/rc.devfs save /etc/sysconfig
3.2. /tmp, . /tftpboot,

symlinks
/tftpboot
3.2.1.
script,
' howto
. ,
script , ! ;)
script "" , nuk /tmp,
kill syslog, umount /proc. ,
() /
, () X-Windows.
login
, ' runlevels.
: script ,
server , .
. HowTo
Linux SysAdmins. , script
, .
, nuk : /etc/fstab, /etc/X11/XF86Config, /etc/X11/X
/etc/conf.modules.
, , cut/paste script,
, ,
! ;)

______________________________________________________________________
#!/bin/sh
SERVER_NAME=`hostname -s`
###
echo ftiaxnoume to /etc/rc.d/rc.ws
#auto edw apla kanei echo s' olo to script ;)
echo "# gia to root on nfs
SERVER=$SERVER_NAME
#xreiazomaste to proc gia to mtab, route klp
mount -t proc /proc /proc
IP=\`ifconfig eth0|grep inet|cut --field 2 -d ':'|cut --field 1 -d ' '\`
#an apotuxei to prwto mount, pi8anotata o server, h toulaxiston kati allo

#den pane kala, ara kanoume monaxa ta upoloipa, an to prwto mount petuxei
mount \$SERVER:/tftpboot/\$IP/sysconfig /etc/sysconfig -o nolock &&
{
#other mounts
mount \$SERVER:/home /home -o nolock
mount \$SERVER:/ /\$SERVER -o ro,nolock
#/var
echo Ftiaxnoume to /var ...
mke2fs -q -i 1024 /dev/ram1 1024
mount /dev/ram1 /var -o defaults,rw
cp -a /tftpboot/var /
#network stuff
. /etc/sysconfig/network
HOSTNAME=\`cat /etc/hosts|grep \$IP|cut --field 2\`
route add default gw \$GATEWAY
ifup lo
}
#restore devfs settings
/etc/rc.d/rc.devfs restore /etc/sysconfig
umount /proc" > /etc/rc.d/rc.ws
###
echo xwrizoume to runlevel 3 gia ton client kai gia ton server
mv /etc/rc.d/rc3.d /etc/rc.d/rc3.server
cp -a /etc/rc.d/rc3.server /etc/rc.d/rc3.ws
rm /etc/rc.d/rc3.ws/*network
rm /etc/rc.d/rc3.ws/*nfs
rm /etc/rc.d/rc3.ws/*nfsfs
rm /etc/rc.d/rc3.ws/S99local
ln -s /etc/sysconfig/rc.local /etc/rc.d/rc3.ws/S99local
ln -s /etc/rc.d/rc3.server /etc/sysconfig/rc3.d
ln -s /etc/sysconfig/rc3.d /etc/rc.d/rc3.d
###
echo kanoume to tmp link gia to /var/tmp
rm -fR /tmp
ln -s var/tmp /tmp
###
echo metakinoume diafora arxeia kai ftiaxnoume symlinks gi auta
echo mtab
/etc/rc.d/init.d/syslog stop
umount /proc
touch /proc/mounts
mount /proc
/etc/rc.d/init.d/syslog start
rm /etc/mtab
ln -s /proc/mounts /etc/mtab
echo fstab
mv /etc/fstab /etc/sysconfig
ln -s sysconfig/fstab /etc/fstab
echo arxeia ry8misewn twn X
mkdir /etc/sysconfig/X11
mv /etc/X11/X /etc/sysconfig/X11
ln -s ../sysconfig/X11/X /etc/X11/X
mv /etc/X11/XF86Config /etc/sysconfig/X11

ln -s ../sysconfig/X11/XF86Config /etc/X11/XF86Config
echo conf.modules
mv /etc/conf.modules /etc/sysconfig
ln -s sysconfig/conf.modules /etc/conf.modules
echo isapnp.conf
mv /etc/isapnp.conf /etc/sysconfig
ln -s sysconfig/isapnp.conf /etc/isapnp.conf
###
echo ftiaxnoume ena protupo dir gia ta directories twn wss
echo /tftpboot/template
mkdir /home/tftpboot
ln -s home/tftpboot /tftpboot
mkdir /tftpboot/template
mkdir /$SERVER_NAME
echo root
ln -s / /tftpboot/template/root
echo sysconfig
cp -a /etc/sysconfig /tftpboot/template/sysconfig
rm -fR /tftpboot/template/sysconfig/network-scripts
ln -s /$SERVER_NAME/etc/sysconfig/network-scripts \
/tftpboot/template/sysconfig/network-scripts
echo NETWORKING=yes > /tftpboot/template/sysconfig/network
echo `grep "GATEWAY=" /etc/sysconfig/network` >> /tftpboot/template/sysconfig/
network
echo "/dev/nfsroot / nfs defaults 1 1" > /tftpboot/template/sysconfig/fstab
echo "none /proc proc defaults 0 0" >> /tftpboot/template/sysconfig/fstab
echo "#!/bin/sh" > /tftpboot/template/sysconfig/rc.local
chmod 755 /tftpboot/template/sysconfig/rc.local
rm /tftpboot/template/sysconfig/rc3.d
ln -s /etc/rc.d/rc3.ws /tftpboot/template/sysconfig/rc3.d
rm /tftpboot/template/sysconfig/isapnp.conf
echo var
cp -a /var /tftpboot/var
rm -fR /tftpboot/var/lib
ln -s /$SERVER_NAME/var/lib /tftpboot/var/lib
rm -fR /tftpboot/var/catman
ln -s /$SERVER_NAME/var/catman /tftpboot/var/catman
rm -fR /tftpboot/var/log/httpd
rm -f /tftpboot/var/log/samba/*
for i in `find /tftpboot/var/log -type f`; do cat /dev/null > $i; done
rm `find /tftpboot/var/lock -type f`
rm `find /tftpboot/var/run -type f`
echo /sbin/fsck.nfs
echo "#!/bin/sh
exit 0" > /sbin/fsck.nfs
chmod 755 /sbin/fsck.nfs
echo ola teleiwmena
______________________________________________________________________

3.2.2.
server :

1. To source script ws's


- rc.sysinit,
PATH :
___________________________________________________________________
#Gia root over nfs workstations.
/etc/rc.d/rc.ws
___________________________________________________________________

2. /etc/rc.d/rc3.ws .
: rc.local.ws ,
. nfs-fs .
script :

nfsfs
nfs
rc.local
3.3. export file systems bootp
, server export filesystems,
ip clients.
3.3.1. export file systems
export dir's ws's,

/etc/exports :
______________________________________________________________________
/ *.st.hhs.nl(ro,no_root_squash)
/home *.st.hhs.nl(rw,no_root_squash)
______________________________________________________________________

, domain ;)
nfs, :
/etc/rc.d/init.d/nfs restart
knfsd : knfsd
exports partition . ,
knfsd clients partitions. ,
client mount / , /usr
partition, /usr. , knfsd,
partition
/home . script server /tftpboot
/home , partition.

partitions, clients
, export ' ,
mount /etc/rc.d/rc.ws .
3.3.2. bootp
1. bootp , .
RedHat.
2. /etc/inetd.conf
bootps. EPROM ,
tftp.
3. inetd, :
/etc/rc.d/init.d/inetd restart
4. workstations
, server , '
ws's.
4.1. EPROM
,
ws.
4.1.1.
EPROM ,
.
, :
dd if=/<path-to-zImage>/zImage of=/dev/fd0
4.1.2. EPROM
free EPROM :
1. netboot, free
. drivers DOS,
.
mailing list ,
drivers pklite, ,
EPROM . netboot
, .
EPROM ,
ws ' . netboot :
<http://www.han.de/~gero/netboot/> .
2. etherboot, free
, dhcp,
drivers, driver
format. ,
. Etherboot :

<http://www.slug.org.au/etherboot/> .
EPROMs :
EPROMs 28 dip. EPROMs
64kB.
EPROMs 32kB netboot. drivers 16kB,
EPROMs . EPROMs
EPROM burner.
4.2. ws dir
dir, :
cd /tftpbootcp -a template <ip>
, ' dirs ws's
mouse, monitor,
5.4 .
4.3. /etc/bootptab /etc/hosts
/etc/bootptab ws
. , :
______________________________________________________________________
nfsroot1:hd=/tftpboot:vm=auto:ip=10.0.0.237:\
:ht=ethernet:ha=00201889EE78:\
:bf=bootImage:rp=/tftpboot/10.0.0.237/root
______________________________________________________________________

nfsroot1 host, ws.


10.0.0.237 ip ws (
2 ), 00201889EE78
( ) ws.
ws,
,
. bootp
, :
killall -HUP bootpd
, bootp
. , inetd,
.
4.4. ws
ws .
ws text mode,
server, ip-nr services
. EPROM ,
. ,

EPROM. ,
EPROMs .
4.5. ws .
, ws :
1. -, mouse,
mouseconfig.
, :
/etc/rc.d/init.d restart
2. Xconfigurator.
ok, !
symlink Xserver /etc/X11/X /etc/sysconfig/X11/X
Xconfigurator link. ,
Xconfigurator
, ,
/etc/sysconfig/X11 server. ,
Xconfigurator X.

link

3. , ' server
dir :
: ' isapnp.conf
conf.modules, ( script server)
links /etc/sysconfig .
cd-rom : link /dev, /etc/fstab? , .
rc.local : .
4. links /dev . :
/etc/rc.d/rc.devfs save /etc/sysconfig
5. .
5. : cd-rom
cd-rom.
- - cd-rom,
,
.
boot / cd-rom; cdrom ,
, kiosk (... : Kiosk HowTo),
, intenet cafe,
server, root over nfs.
5.1.
: root ' cd-rom.
: rockridge,

unix-like filesystem cd,


Eltorito, cd .
5.1.1.
, .
:
1. : /dev, /var & /tmp.
, root over nfs
( ) :
/dev , Devfs .
/var /tmp ,
(shared) ramdisk 1 MB. shared,
. /tmp
' symlink /var/tmp ,
.
ramdisk tarballs,
(template) directories. ,
dirs, .
2. /home.
/var home directories
, /var
.
3. /etc/mtab :
link /proc/mounts
mounts /proc, .
5.2. .
, ,
:
1. ' , / '
, cd
recorder.
2. Linux ' ,
partition 650 MB .
iso-image cd
cd's ,
. ,
bugs, boot
.
3. Linux partition 650
MB, cd.
.
4. partition.

5. compile , 3.1 .
,
devfs ! 3 3.1,
:
isofs compiled
devfs compiled
cdrom compiled
, , compiled ,
module.
6. :
, .
home directory /var.
, .
, .
,
login.
Linux, login .
, .
7. .
8. mount partition
650 MB directory /test .
9. ' , /test/etc/rc.d/rc.iso
. source rc.sysinit,
/var .
___________________________________________________________________
#/var
echo Ftiaxnoume to /var ...
mke2fs -q -i 1024 /dev/ram1 1024
mount /dev/ram1 /var -o defaults,rw
cp -a /lib/var /
#Epanaferoume tis ry8miseis tou devfs, xreiazomaste to proc
mount -t proc /proc /proc
/etc/rc.d/rc.devfs restore /etc/sysconfig
umount /proc
___________________________________________________________________

10.
/test/etc/rc.sysinit ,
root rw, 2

PATH :
___________________________________________________________________
#gia na bootaroume apo cdrom
. /etc/rc.d/rc.iso
___________________________________________________________________

11.
' script .
/var links
/tmp /etc/mtab.

___________________________________________________________________
#!/bin/sh
echo tmp
rm -fR /test/tmp
ln -s var/tmp /test/tmp
###
echo mtab
touch /test/proc/mounts
rm /test/etc/mtab
ln -s /proc/mounts /test/etc/mtab
###
echo var
mv /test/var/lib /test/lib/var-lib
mv /test/var /test/lib
mkdir /test/var
ln -s /lib/var-lib /test/lib/var/lib
rm -fR /test/lib/var/catman
rm -fR /test/lib/var/log/httpd
rm -f /test/lib/var/log/samba/*
for i in `find /test/lib/var/log -type f`; do cat /dev/null > $i; done
rm `find /test/lib/var/lock -type f`
rm `find /test/lib/var/run -type f`
___________________________________________________________________

12.
/etc/issue* /test/etc/rc.local,
.
13.
partition,
cd-rom. ,
partition, , , ... . ,
remount / rw partition,
,
partition . remount / rw , :
mount -o remount,rw /
5.3. cd
5.3.1. boot image
-, partition.
cd, image bootable .
dd ' zimage, loader
zimage ' ,
cd. , syslinux :
1. boot.img cd RedHat
2. mount boot.img loopback, :
mount boot.img kapou -o loop -t vfat
3. , boot.img , :
ldlinux.sys
syslinux.cfg
4. kernel image partition
boot.img .
5. syslinux.cfg ,
(, , zImage image) :
___________________________________________________________________
default linux
label linux
kernel zImage
append root=/dev/<balte edw to onoma tou cdrom sas>
___________________________________________________________________

6. Umount boot.img:

umount kapou
7. /etc/mtab link /proc/mounts , umount
' /dev/loop0 ,
:
losetup -d /dev/loop0
5.3.2. iso image
boot image
readonly mount, iso image
cd :
1. boot.img /test
2. cd directory, ' image.
partition
.
3. , image, :
mkisofs -R -b boot.img -c boot.catalog -o boot.iso /test
5.3.3. iso image
1. mount image loopback device, :
mount boot.iso kapou -o loop -t iso9660
2. .
3. umount boot.iso :
umount kapou
4. /etc/mtab link /proc/mounts , umount
' /dev/loop0 . ,
:
losetup -d /dev/loop0
5.3.4. CD
cdrecord
, :
cdrecord -v speed=<epi8umhth taxuthta eggrafhs> dev=<path
pros to generic scsi device tou eggrafea sas> boot.iso

5.4. Boot CD
, ! ;)
6.
HHS (Haagse Hoge School), ,
.
HowTo.
ISM, ,
project. project diskless /,
,
' HowTo.
,
.
;)
7.
, , .
Hans de Goede, : j.w.r.degoede@et.tudelft.nl