Section 53: How to setup small Fossil+Venti based Plan 9 network

Section 53: Fossil+Ventiベースのネットワーク構築

It's very straightforward to have a standalone Fossil+Venti machine at home. However, i'm afraid it's not so easy to have that network at home. So, this is my small attempt to offer an example of mine with the hope to help someone who wants to has Plan 9 home network.

Here, I assume you have standalone kfs based or Plan 9 network machine already where disk images of fossil and venti have been installed according to well described Plan 9 Wiki pages.

My Plan 9 network at home is very small, which has only three machine, called venus(Venti+Fossil+CPU server), surveyor(RedHat 9.0 or Plan 9 terminal) and mars(Win2000 or Plan 9 terminal), and the purpose of this document is to build venus. Mars and Surveyor will boot from floppy drive when I want to run 9term. Venus server has two disks, sdC0 and sdC1, and will boot from sdC0 using 9fat partition.

Regarding how to make venti/fossil file system, you can read the related documents on Plan 9 wiki page. I think it's worth to add a point here. Don't forgewt to fossil/flfmt /dev/sdC0/other before to make it run. You'll have active, snapshot and archive directory under the other filesystem, those are not neccessary, and you can remove them from fossilcons(8), and add some neccessary diectories there, such as lp/tmp, lp/log etc.

Now, let's go (may be long sorry).

Now, Japanese, be patient! ☺

例えば一台のノートブックにスタンドアローンのPlan 9を導入するのは、もし そのノートのハードウェアがサポートされたものだったら非常に容易なものです。 Bell-LabsのPlan 9のダウンロードのページからCDROMイメージを持って来て、 それをそのままノートに差してbootし、対話的にいくつかの質問に答えるとすれば、 直ちに可能でしょう。

しかし、ここから先が大変で、非常に多くの人がそこで挫折したものと推定されます。
これはもっともな事で、この種の仕事はケースバイケース、こうすればという一般的な方法を 提示する事は余り有用でないかも知れないからと、いやしくもPlan 9を触ろうと する様な人ならば、自分で解決出来るだろうと期待されているからです。
ですが、この期待は多くの場合完全に裏切られている様です。そこで私は恥をしのんで ここに自宅の例を載せて見る事にしました。

Fossil+Venti file serverはユーザプロセスとして動くので、standaloneの 9 terminalを kfsを使ってたちあげて、そこから起動できます。事実、普通は、この方法でFossilとVentiの ディスクシステムを作りますが、私の場合は現在動いているnetwork上でFossilとVentiの ディスクイメージを作りました。
いずれにしても、まずこの作業が必要です。
これについては、Plan 9のWiki pagesに優れた解説がありますので、そちらを 参考にして下さい。ここでは、この作業は既に終了しているものと仮定します。

ちなみに、ここで設定する独立のFossil+Ventiマシンは、CPU server(正確にはAUTH server)が ないと認証が行えませんので、それはPlan 9システムと呼ぶのは問題があります。どこかに このAUTH SERVERを持つ必要がありますが、それをFossil+Venti server上に持つ事も 可能になっています。これはFactotumが開発されたからに他ならず、この事情は上のkfsベース のスタンドアロンサーバの所で述べた事です。

別の言い方をすると、このAUTH server+Fosiil+Ventiが出来ますと、それ一台だけでも、 取り敢えずPlan 9のネットワークの構築は可能で、また、そのサーバマシン上でrio環境は可能で、 ここが以前のKen Thompsonのファイルサーバとの違いです。

更に、Fossilはlong nameを扱えますので、lnfs(4)が必要なくなります。でも、このマシンは CPU serverとして動きますので、一人しかloginできません。☺

では、成功を祈ります。

							岡本健二    Dec. 24, 2003

==========================
1) fdisk and prep sdC0 and sdC1
==========================
Mine is as follows:
sdC0

    --rw-r----- S 0 sys sys   104857600 Dec 23 15:39 /dev/sdC0/9fat
    --rw-r----- S 0 sys sys           0 Dec 23 15:39 /dev/sdC0/ctl
    --rw-r----- S 0 sys sys 20490559488 Dec 23 15:39 /dev/sdC0/data
    --rw-r----- S 0 sys sys  8821071872 Dec 23 15:39 /dev/sdC0/fossil
    --rw-r----- S 0 sys sys  4831787008 Dec 23 15:39 /dev/sdC0/isect
    --rw-r----- S 0 sys sys         512 Dec 23 15:39 /dev/sdC0/nvram
    --rw-r----- S 0 sys sys  6194552832 Dec 23 15:39 /dev/sdC0/other
    --rw-r----- S 0 sys sys 20489140224 Dec 23 15:39 /dev/sdC0/plan9
    -lrw------- S 0 sys sys           0 Dec 23 15:39 /dev/sdC0/raw
    --rw-r----- S 0 sys sys   536870400 Dec 23 15:39 /dev/sdC0/swap

All the partition of sdC1(80GB) is dedicated to Venti.

=========================
2) The contents of 9fat partition
=========================

    alrw-rw-rw- M 55 bill trog  181812 Dec  8 20:38 /n/9fat/9LOAD
    --rw-rw-rw- M 55 bill trog 2046150 Dec  8 20:38 /n/9fat/9PCDISK
    --rw-rw-rw- M 55 bill trog 2404282 Dec 24 00:42 /n/9fat/9pcvnsf
    --rw-rw-rw- M 55 bill trog  899193 Dec 24 00:42 /n/9fat/9pcvnsf.gz
    --rw-rw-rw- M 55 bill trog 2404273 Dec 19 05:17 /n/9fat/9pcvnsfJ
    --rw-rw-rw- M 55 bill trog  899175 Dec 19 05:17 /n/9fat/9pcvnsfJ.gz
    --rw-rw-rw- M 55 bill trog     411 Dec 23 05:51 /n/9fat/PLAN9.INI

Plan9.ini of venus is as foolows:
	# Celereon 366, 512MB, Fossil+Venti+Auth
	#bootfile=sdC0!fs!/386/9pcauth
	bootfile=sdC0!9fat!9pcvnsf
	#bootfile=sdC0!9fat!9pcvnsfJ
	#bootfile=fd0!9pcvnsf.gz
	sysname=venus
	*nomp=1
	#ether0=type=ne2000 port=0x6500 irq=9
	#ether0=type=83815
	ether=type=i82557
	audio0=type=sb16 irq=5 port=0x220 dma=5
	#audio0=type=sb16 irq=7 port=0x220 dma=5
	mouseport=ps2
	#mouseport=0
	monitor=multisync
	vgasize=1376x1024x8
Don't bother with audio0 line. ☺

===============================
3) make 9pcdntf under /sys/src/9/pc
===============================
You have to add an item of pcvnsf to mkfile, of course. My pcvnsf file is as follows:
-----------cut here--------

dev
	root
	cons
	arch
	pnp		pci
	env
	pipe
	proc
	mnt
	srv
	dup
	rtc
	ssl
	tls
	cap
	kprof

	ether		netif
	ip		arp chandial ip ipv6 ipaux iproute netlog nullmedium pktmedium ptclbsum386 inferno

	draw		screen vga vgax
	mouse		mouse
	vga

	sd
	floppy		dma
	lpt

	audio		dma
	pccard
	i82365		cis
	uart
	usb

link
	devpccard
	devi82365
	apm		apmjump
	ether2000	ether8390
	ether2114x	pci
	ether589	etherelnk3
	ether79c970	pci
	ether8003	ether8390
	ether8139
	ether82543gc	pci
	ether82557	pci
	ether83815	pci
	etherec2t	ether8390
	etherelnk3	pci
	etherga620	pci
	etherigbe	pci ethermii
	ethersink
	ethersmc	devi82365 cis
	etherwavelan	wavelan devi82365 cis pci
	ethermedium
	pcmciamodem
	netdevmedium
	loopbackmedium
	usbuhci

misc
	archmp		mp apic

	sdata		pci sdscsi
	sd53c8xx		pci sdscsi
	sdmylex		pci sdscsi

	uarti8250
	uartpci		pci

	vga3dfx		+cur
	vgaark2000pv	+cur
	vgabt485	=cur
	vgaclgd542x	+cur
	vgaclgd546x	+cur
	vgact65545	+cur
	vgacyber938x	+cur
	vgaet4000	+cur
	vgahiqvideo	+cur
	vgai81x	+cur
	vgamach64xx	+cur
	vgamga2164w	+cur
	vgamga4xx	+cur
	vganeomagic	+cur
	vganvidia	+cur
	vgargb524	=cur
	vgas3		+cur vgasavage
	vgat2r4		+cur
	vgatvp3020	=cur
	vgatvp3026	=cur
	vgavmware	+cur

ip
	il
	tcp
	udp
	ipifc
	icmp
	icmp6

port
	int cpuserver = 1;

boot cpu boot #S/sdC0/
	il
	tcp
	local

bootdir
	/386/bin/rc
	/rc/lib/rcmain
	/386/bin/bind
	/386/bin/cat
	/386/bin/cp
	/386/bin/echo
	/386/bin/mount
	/386/bin/sleep
	/386/bin/ip/ipconfig
	/386/bin/auth/factotum
	/386/bin/fossil/fossil
	/386/bin/venti/venti
	/sys/lib/sysconfig/venusf/boot
	/sys/lib/sysconfig/venusf/vnsfproto
	/sys/lib/sysconfig/venusf/venti.conf
------cut here-----------

And, mk 'CONF=pcvnsf' install, and copy 9pcvnsf(.gz) to 9fat partition, too. You have to edit following three files under /sys/lib/sysconfig/venusf directory before compile 9pcvnsf. My /sys/lib/sysconfig/venusf/boot, vnsfproto, venti.conf files are:

========
3-1) boot
========

--------cut here-------

#!/boot/rc -m /boot/rcmain

cpuserver=yes
cd /boot
cp '#r/rtc' '#c/time'
bind -a '#I' /net
bind -a '#l0' /net
bind -a '#S' /dev
bind '#p' /proc
bind '#d' /fd
bind -a /boot /
ipconfig loopback /dev/null 127.1
ipconfig -g 192.168.2.100 ether /net/ether0 add 192.168.2.10 255.255.255.0
if(~ $cpuserver yes){
	factotum -sfactotum -S
#	factotum -sfactotum -S -k
}
if not{
	factotum -sfactotum -u
	# add a key so mount and fossil can authenticate each other
	# remove this key once factotum is initialized with other keys
	factotum -g 'proto=p9sk1 user=sys dom=jitaku.localdomain !password=localhost'
}
# raw block cache(B), venti block chache(C) and index cache(I) are all 8 Mega bytes
venti -c venti.conf -B 16m -C 16m -h tcp!127.1!8000 -I 16m -w -a tcp!127.1!17034 &
sleep 10
venti=tcp!127.0.0.1!17034
fossil -c '. vnsfproto'
mount -c /srv/boot /root
bind -ac /root /
rootdir=/root
rootspec=''
echo dma on >/dev/sdC0/ctl
echo dma on >/dev/sdC1/ctl
if(~ $cpuserver yes)
	/386/init -c
if not
	/386/init -t
exec ./rc -m/boot/rcmain -i
----------cut here----------

============
3-2) vnsfproto
============
-----cut here------

srv -p fscons
srv -p fscmd
srv boot
fsys main config /dev/sdC0/fossil
# 36864 = (312MB - 8MB*3)*1024*1024/8192
# 29696 = (256MB - 8MB*3)*1024*1024/8192
#124928 = (1024MB - 16MB*3)*1024*1024/8192
# 59392 = (512MB - 16MB*3)*1024*1024/8192
fsys main open -c 36864
fsys main
users -r /active/adm/users
snaptime -s 60 -a 0500
listen il!*!17008
listen tcp!*!564
fsys other config /dev/sdC0/other
fsys other open -c 2000
#fsys main
--------cut here--------

============
3-3) venti.conf
============
-------cut here-------

index main
isect /dev/sdC0/isect
arenas /dev/sdC1/arenas
-----cut here-------

=======================================
4) edit /lib/ndb/local file, and mine is as follows:
=======================================
----------cut here--------

#
#  files comprising the database, use as many as you like, see ndb(6)
#
database=
	file=/lib/ndb/local
	file=/lib/ndb/common
	file=/lib/ndb/auth

#
#outside domain
#
dom=
	ns=A.ROOT-SERVERS.NET
dom=A.ROO-SERVERS.NET ip=210.141.128.10 ip=210.141.128.13

auth=sources.cs.bell-labs.com authdom=outside.plan9.bell-labs.com

#systems on the local network
#
#auth=venus.jitaku.localdomain authdom=jitaku.localdomain

dom=jitaku.localdomain soa
	refresh=3600 ttl=3600
	ns=venus
	mx=venus
	mbox=okamoto@venus.jitaku.localdomain
	smtp=venus.jitaku.localdomain

#install this network
#
ipnet=takakura ip=192.168.2.0 ipmask=255.255.255.0
	ipgw=192.168.2.100
	auth=venus authdom=jitaku.localdomain
	fs=192.168.2.10
	dns=192.168.2.10
	dnsdomain=jitaku.localdomain
#END

# gateway of local
# Plan 9 venus ether0
#ip=192.168.2.10 ether=xxxxxxxxxxxx sys=venus
#	dom=venus.jitaku.localdomain

# INSTALL fileserver

# AUTH server
# //NS DP83815 network card//
# ip=192.168.2.10 ether=xxxxxxxxxxxx sys=venus
# Intel XPRES-PRO/100
ip=192.168.2.10 ether=0002b3cbb91d sys=venus
	dom=venus.jitaku.localdomain
	bootf=/386/9pcvnsf
	proto=il
#END

#=====Terminals======
#
# Plan 9 terminal by floppy boot (DELL Opitilex)
ip=192.168.2.100	ether=xxxxxxxxxxxx sys=mars
	doms=mars.jitaku.localdomain
	bootf=/386/9pcJ.gz
	fs=venus
	proto=il

# Plan 9 terminal from floppy boot
# and (RedHat Linux 7.2J)
# Network card Corega FEther PCI-TXS (Realtek 8139)
ip=192.168.2.20 ether=xxxxxxxxxxxx sys=surveyor
	dom=surveyor.jitaku.localdomain
	bootf=/386/9pc.gz
	fs=venus
	proto=il

# Terminal mercury  (Cube PC Pen4 1.8GHz, RTL8139)
ip=192.168.2.15 ether=xxxxxxxxxxxx sys=mercury
	dom=mercury.jitaku.localdomain
	bootf=/386/9pcJ.gz
	fs=venus
	proto=il

# Terminal venus
#ip=192.168.2.10 ether=xxxxxxxxxxxx sys=venus
#	dom=venus.jitaku.localdomain
#	bootf=/386/9pcdisk
#	proto=il

# gateway to chigaklu6.co.jp
#
#ip=192.168.1.3 ether=xxxxxxxxxxxx sys=p9gate
#	dom=p9gate.chigaku6.co.jp
#	bootf=/386/9pcdisk
#	proto=il

# Terminal Tecra 720CT Notebook
ip=192.168.2.12 ether=xxxxxxxxxxxx sys=kenprvt
	dom=kenprvt.jitaku.localdomain
	bootf=/386/9pcdiskJ.gz
	fs=venus
	proto=il
----------cut here------------ The ether=xxxxxxxxxxxx should be replaced by an approapriate number.

==================
5) edit /rc/bin/cpurc
==================
Mine is as follows:
--------cut here---------

#!/bin/rc -x

echo -n cpu >/env/service
date -u >/env/boottime

fileserver=venus
# replace FACEDOM with the local domain to be used in the faces database
facedom=FACEDOM
TIMESYNCACCURACY=1000000	# accuracy in nanosec

#ip/ipconfig -g 192.168.2.100 ether /net/ether0 192.168.2.10 255.255.255.0 >/dev/null >[2=1]

ndb/cs
sysname=`{cat /dev/sysname}
ndb/dns -r

NPROC=`{wc -l /dev/sysstat}
NPROC=`{echo $NPROC|sed 's/ .*//'}

prompt=($sysname^'# ' ' ')

for(i in H w f t m v L S P U '$' Σ)
	/bin/bind -a '#'^$i /dev >/dev/null >[2=1]

ip/dhcpd
ip/tftpd

aux/timesync -a $TIMESYNCACCURACY

auth/keyfs -w p -m /mnt/keys /adm/keys >/dev/null >[2=1]

aux/listen -q -t /rc/bin/service.auth -d /rc/bin/service il
aux/listen -q -t /rc/bin/service.auth -d /rc/bin/service tcp

if(~ $mouseport ask){
	echo -n 'mouseport is (ps2, ps2intellimouse, 0, 1, 2)[ps2]: '
	mouseport=`{read}
	if(~ $#mouseport 0)
			mouseport=ps2
}
if(~ $vgasize ask){
	echo -n 'vgasize [640x480x8]: '
	vgasize=`{read}
	if(~ $#vgasize 0)
		vgasize=640x480x8
}
if(~ $monitor ask){
	echo -n 'monitor is [xga]: '
	monitor=`{read}
	if(~ $#monitor 0)
		monitor=xga
}
if(test -f /dev/mousectl){
	switch($mouseport){
	case ps2 ps2intellimouse 0 1 2
		if(~ $sysname VENUS)
			aux/mouse -b 1200 $mouseport
		if not
			aux/mouse $mouseport
		# parse vgasize into fields
		vgasize=`{echo $vgasize}
		if(! ~ $"monitor '' && ! ~ `{cat /dev/user} none){
			aux/vga -l $vgasize
#			aux/vga -ip $vgasize > /usr/okamoto/mars.$vgasize
		}
		if(~ $accupoint 1)
			pipefile -dr /bin/aux/accupoint /dev/mouse
	}
}

auth/cron >> /sys/log/cron >[2=1]&

swap /dev/sdC0/swap
mount -c /srv/boot /n/venusother other
------cut here-----

==============================
6) reboot the machine without floppy
==============================

It'll boot from the sdC0, and reads plan9.ini thre, and you'll be promted to enter authID, authdomain and key etc, and do it which will be written to /dev/sdC0/nvram, and from next time, it'll be read automatically. good luck! Kenji

					December 24, 2003, 岡本健二 okamoto@granite.las.osakafu-u.ac.jp



Go to Next Section

Back to INDEX