Re: use md device in /etc/rc.diskless{1,2}

2001-03-26 Thread Falco Krepel

I sent a patch request:

http://www.freebsd.org/cgi/query-pr.cgi?pr=25730

-- 
Falco KrepelPhone:  +49-(0)30 - 34 63 - 7 276
GMD-FOKUS   Fax:+49-(0)30 - 34 63 - 8 276
Kaiserin-Augusta-Allee 31   e-mail: [EMAIL PROTECTED]
10589 BerlinWWW:http://www.fokus.gmd.de/usr/krepel

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: use md device in /etc/rc.diskless{1,2}

2001-03-26 Thread Falco Krepel

I have sent a patch request:

http://www.freebsd.org/cgi/query-pr.cgi?pr=25730

-- 
Falco KrepelPhone:  +49-(0)30 - 34 63 - 7 276
GMD-FOKUS   Fax:+49-(0)30 - 34 63 - 8 276
Kaiserin-Augusta-Allee 31   e-mail: [EMAIL PROTECTED]
10589 BerlinWWW:http://www.fokus.gmd.de/usr/krepel

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: use md device in /etc/rc.diskless{1,2}

2001-03-26 Thread Mike Smith

 Hi.
 
   I have diskless-PC which was used /boot/pxeboot.  But latest
 FreeBSD-current is output below messages and some fsck_nfs problem.
 
 WARNING: MFS is being phased out in preference for md devices
 WARNING: Please see mdconfig(8) for details
 WARNING: Continuing in 15 seconds
 
   Does someone already rewrite and use mdconfig in /etc/rc.diskless1
 and diskless2?

Yes, please find attached; if someone wants to clean these up and commit 
them, I'd be greatly indebted.

You also need to apply this diff to /etc/rc (warning, cut-n-paste damage):

--- rc  Sun Dec 17 00:24:49 2000
+++ /local0/pxeroot5/etc/rc Tue Jan 23 17:52:20 2001
@@ -201,7 +201,7 @@
 # Run custom disk mounting function here
 #
 if [ -n "${diskless_mount}" -a -r "${diskless_mount}" ]; then
-   sh ${diskless_mount}
+   . ${diskless_mount}
 fi



# $FreeBSD: src/etc/rc.diskless2,v 1.6 2000/04/27 08:43:48 sheldonh Exp $
#
# rc.diskless2
#
# Build filesystems for diskless operation, potentially more complicated
# than can be handled by /etc/fstab.
#

# Reconstruct /var
mkmd ${diskless_var_size} /var
mtree -p /var -eU -f /etc/mtree/BSD.var.dist 21 /dev/null
touch /var/log/messages

# Copy the templated /dev into a locally-writable version
mkmd ${diskless_dev_size} /mnt
cp -Rp /dev/* /mnt
umount /mnt
mount $md_filesystem /dev

# Build a small /tmp
mkmd ${diskless_tmp_size} /tmp


# $FreeBSD: src/etc/rc.diskless1,v 1.5 2000/01/06 18:17:38 luigi Exp $
#
# /etc/rc.diskless1 - general BOOTP startup
#
# BOOTP has mounted / for us.  Assume a read-only mount.  We must then
# - figure out our IP by querying the interface
# - fill /mnt (writable) with files from /etc, and then update
#   per-machine files from /conf/*/ where * is the IP of the host,
#   the IP of the subnet, "default", or nothing.
# - mount /mnt over /etc so we can see the new files.
#
# WARNING: I think you should not change /etc/rc or strange things could
# happen.
#
# The operator is in charge of setting /conf/*/etc/* things as appropriate.
# Typically rc.conf and fstab need to be changed, but possibly
# also other files such as inetd.conf etc.

# chkerr:
#
# Routine to check for error
#
#   checks error code and drops into shell on failure.
#   if shell exits, terminates script as well as /etc/rc.
#
chkerr() {
case $1 in
0)
;;
*)
echo "$2 failed: dropping into /bin/sh"
/bin/sh
# RESUME
;;
esac
}

# mkmd:
#
# Builds an md(4) disk of the size in $1
# Labels and newfs' it.
# Mounts it on the destination in $2
# Returns the name of the created md device in md_device
# Returns the name of the device containing the filesystem in md_filesystem
mkmd() {
md_device=`mdconfig -a -t malloc -s $1`
chkerr $? "configuring md device"
disklabel -rw $md_device auto
chkerr $? "labelling md device"
md_filesystem=/dev/$md_device"c"
newfs $md_filesystem 21 /dev/null
chkerr $? "making md device filesystem"
mount $md_filesystem $2
chkerr $? "mounting md filesystem on $2"
}

# DEBUGGING
#
# set -v

# Figure out our interface and IP.
#
bootp_ifc=""
bootp_ipa=""
bootp_ipbca=""
iflist=`ifconfig -l`
for i in ${iflist} ; do
set `ifconfig ${i}`
while [ $# -ge 1 ] ; do
if [ "${bootp_ifc}" = "" -a "$1" = "inet" ] ; then
bootp_ifc=${i} ; bootp_ipa=${2} ; shift
fi
if [ "${bootp_ipbca}" = "" -a "$1" = "broadcast" ] ; then
bootp_ipbca=$2; shift
fi
shift
done
if [ "${bootp_ifc}" != "" ] ; then
break
fi
done
echo "Interface ${bootp_ifc} IP-Address ${bootp_ipa} Broadcast ${bootp_ipbca}"

# Build a writable copy of /etc from the initial /etc and files obtained
# from /conf/ip address/etc or /conf/broadcast/etc or /conf/etc.
#
mkmd 4m /mnt
cp -Rp /etc/* /mnt
chkerr $? "copy /etc template"

if [ -d /conf/${bootp_ipa} ] ; then
cp -Rp /conf/${bootp_ipa}/etc/* /mnt
elif [ -d /conf/${bootp_ipbca} ] ; then
cp -Rp /conf/${bootp_ipbca}/etc/* /mnt
else
cp -Rp /conf/default/etc/* /mnt
fi

# Make the new filesystem available as /etc
#
umount /mnt
mount $md_filesystem /etc

# Tell /etc/rc to run the specified script after
# it does its mounts but before it does anything
# else.
#
# This script is responsible for setting up the
# diskless mount environment.  This can be
# overriden by /conf/ME/rc.conf.local if, for
# example, you do not want to run the standard
# system /etc/rc.diskless2

diskless_mount="/etc/rc.diskless2"


... every activity meets with opposition, everyone who acts has his
rivals and unfortunately opponents also.  But not because people want
to be opponents, rather because the tasks and relationships force
people to take different points of view.  [Dr. Fritz Todt]
   V I C T O R Y   N O T   V E N G E A N C E



Re: use md device in /etc/rc.diskless{1,2}

2001-03-26 Thread Falco Krepel

This is a fine solution. I hope it's OK when I add this to my patch
request.

But I have two remarks.

1. For example you could use the diskless boot procedure for smart
clients with a small disk used as swap space. So I think it is better to
use swap instead of malloc for var,dev, and tmp. This could be done with
a variable (e.g. diskless_swap_enable). What do think about it?

2. Building a dev dir is obsolete when you use DEVFS. So you should
distinguish between these two  situations. I don't know if you could use
one of the "vfs.devfs.*" variables to determine the usage of DEVFS.

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: use md device in /etc/rc.diskless{1,2}

2001-03-26 Thread Warner Losh

In message [EMAIL PROTECTED] Falco Krepel writes:
: 1. For example you could use the diskless boot procedure for smart
: clients with a small disk used as swap space. So I think it is better to
: use swap instead of malloc for var,dev, and tmp. This could be done with
: a variable (e.g. diskless_swap_enable). What do think about it?

I think it is a bad idea.  rc.diskless* is often used in cases where no
swap exists.  This is a very popular way to run of cf where you cannot
configure swap due to excess wear and tear on the cf which has a very
limited number of writes.

Warner

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: use md device in /etc/rc.diskless{1,2}

2001-03-26 Thread Harti Brandt

On Tue, 27 Mar 2001, Warner Losh wrote:

WLIn message [EMAIL PROTECTED] Falco Krepel writes:
WL: 1. For example you could use the diskless boot procedure for smart
WL: clients with a small disk used as swap space. So I think it is better to
WL: use swap instead of malloc for var,dev, and tmp. This could be done with
WL: a variable (e.g. diskless_swap_enable). What do think about it?
WL
WLI think it is a bad idea.  rc.diskless* is often used in cases where no
WLswap exists.  This is a very popular way to run of cf where you cannot
WLconfigure swap due to excess wear and tear on the cf which has a very
WLlimited number of writes.

Well, the idea is to have a config knob, where you can tell to mdconfig
whether it should use 'swap' or 'malloc'. This should, of course, default
to malloc.

harti
-- 
harti brandt, http://www.fokus.gmd.de/research/cc/cats/employees/hartmut.brandt/private
  [EMAIL PROTECTED], [EMAIL PROTECTED]


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



use md device in /etc/rc.diskless{1,2}

2001-03-25 Thread MIHIRA Sanpei Yoshiro

Hi.

  I have diskless-PC which was used /boot/pxeboot.  But latest
FreeBSD-current is output below messages and some fsck_nfs problem.

WARNING: MFS is being phased out in preference for md devices
WARNING: Please see mdconfig(8) for details
WARNING: Continuing in 15 seconds

  Does someone already rewrite and use mdconfig in /etc/rc.diskless1
and diskless2?

Cheers.
---
MIHIRA, Sanpei Yoshiro
Yokohama, Japan.

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message