This is my approach on a diskless frontend with KnoppMyth!
I know this was written about many other times... But I simply thought the other ones was unnessessary complex, with terminal services and DHCP/BOOTP and such things.....
This is based on, what I think, is the most common setup.... Static IP (not necessarily static, but atleast always the same IP on each reboot) frontends/backends. Rhis was written almost completely from my head, so please post comments and corrections where I missed out...
Now to the HOWTO:
It basically works like this:
Use a USB-stick to boot a well prepared linux kernel, mounting the original drive via NFS from the backend.
(Specifically based on VIA EPIA 10000N Nano-ITX, but should be useable on other boards if hardware specific steps (Network card only) are changed)
Prereq: Harddrive connected to frontend, with knoppmyth installed
(not necessarily fully configured, you can do that later if you wish).
One empty, clean, USB stick with atleast 8Mb of memory.
Atleast 512Mb RAM memory
(can be done with less, but we skip swap. If swap is needed, please search the net for swap over NFS)
---------------------------------------
Part 1. Preparing the USB:
1. Creating a new kernel, to use on the USB stick.
Code:
cd /usr/src/linux/
make menuconfig
In the configuration menu, go into
"Device Drivers ---> Network device support ---> Ethernet (10 or 100 MBit) ---> VIA Rhine support"
And make sure that VIA Rhine support is marked <*> (use space to toggle until starred)
(Ofcourse, change this step if you have another ethernet chipset)
Build in support for the BOOTP protocol (Networking options ---> IP: kernel level autoconfiguration ---> IP: BOOTP support).
Now go back to main menu again and go into
"File systems ---> Network File Systems ---> NFS file system support" make sure it has <*>
Also make sure that "Provide NFSv3 client support", "Provide NFSv4 client support"
and "Allow direct I/O on NFS files" are all marked [*]
Scroll down a bit and also make sure that "Root file system on NFS" is marked [*]
Go back again and go into
"Device Drivers ---> Block devices ---> Loopback device support" and make sure it is <*>
Now, time to build and prepare kernel.
Code:
make
mknod /dev/boot255 c 0 255
rdev /usr/src/linux/arch/i386/boot/bzImage /dev/boot255
2. Prepare USB stick to use the new kernel.
Insert the USB stick and note the drive assigned (in my case "sda", and probably yours too)
Do:
Code:
syslinux /dev/sda1
mkdir /mnt/sda
mount /dev/sda1 /mnt/sda
cd /mnt/sda
nano syslinux.cfg
Add these lines: (change the data marked with <> with your settings)
Code:
DEFAULT linux
PROMPT 1
TIMEOUT 20
APPEND init=/sbin/init root=/dev/nfs ip=<frontend_ip>:<backend_ip>:<gateway_ip>:255.255.255.0:::'off' nfsroot=<backend_ip:/frontend/root,rsize=2048,wsize=2048
Do:
Code:
cp /usr/src/linux/arch/i386/boot/bzImage /mnt/sda/linux
cd /
umount /dev/sda1
---------------------------------------
Part two: Preparing the frontend.
3. Modifying startup scripts.
Code:
cd /etc/init.d
mv checkfs.sh checkfs.sh.disabled
mv checkroot.sh checkroot.sh.disabled
nano rcS
Add these lines in rcS just after the header comments:
Code:
mount -o remount,rw /
mount -t proc proc /proc
Remove calls to checkfs.sh and checkroot.sh:
Code:
nano knoppix-autoconfig
Search for checkfs.sh by pressing ctrl-w and type checkfs.sh. Place # first on both rows (checkfs.sh and checkroot.sh)
After this, you haveto remove the configuration entries for the network interface in /etc/network/interfaces... the cleaned interfaces should look something like:
Code:
# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)
# The loopback interface
# automatically added when upgrading
auto lo
iface lo inet loopback
4. edit fstab.
Code:
nano /etc/fstab
Comment the lines that begin with "/dev/hda1", "/dev/hda2" and "/dev/hda3"
Add this somewhere after the headercomments:
Code:
proc /proc proc defaults 0 0
sysfs /sys sysfs defaults 0 0
192.168.0.123:/frontend/myth /myth nfs nfsvers=3,wsize=2048,tcp 0 0
---------------------------------------
Part three. Preparing the backend. (Performed on the backend, with the frontend's drive attached)
5. prepare NFS.
Add the mountpoints in exports.
Run:
Code:
nano /etc/exports
And make sure it looks somewhat like: (change 192.168.0.124 to your frontends ip)
Code:
# /etc/exports: the access control list for filesystems which may be exported
# to NFS clients. See exports(5).
/frontend/root 192.168.0.124(rw,no_root_squash)
/frontend/myth 192.168.0.124(rw,no_root_squash)
6. Prepare the backends fstab.
Create the exported dirs and edit fstab:
Code:
cd /
mkdir /frontend
mkdir /frontend/root
mkdir /frontend/myth
nano /etc/fstab
Add the frontend's partitions to the table.
Change "hde" to the device the frontend drive got on bootup
(IDE0 master == hda, IDE0 slave == hdb, IDE1 master == hdc, IDE1 slave hdd.. and so on..)
Make sure fstab look something like (add last in file):
Code:
# diskless frontend...
/dev/hde1 /frontend/root ext3 defaults 0 0
/dev/hde3 /frontend/myth ext3 defaults 0 0
Run:
Code:
mount -a
ls /frontend/root
The listing should contain alot.. (the frontend's root folders)
7. Make sure that nfs is started on the backend on boot.
Add the following somewhere in the startup (or run it on each reboot of the backend):
Code:
/etc/init.d/nfs-kernel-server start
8. (The fun part) Try it!
Make sure that the USB stick is in the frontend. Make sure NFS is running on backenbd. Reboot frontend!
DONE!
This was written out of my head, so no gaurantees. Please post
suggestions/changes/problems/questions here if you like.
It will probably not work on your first try, but hopefully it does!
Regards // OwL