Subject: Re: /var/db/pkg
To: None <current-users@netbsd.org>
From: Greg A. Woods <woods@weird.com>
List: current-users
Date: 05/25/2000 11:11:20
[ On Thursday, May 25, 2000 at 19:05:54 (+1000), Robert Elz wrote: ]
> Subject: Re: /var/db/pkg 
>
> Somewhere?   Where.   In general, anything that the system creates, and
> wants to keep, should be in /var.   /usr is for what comes off the
> distribution is a better model (with /usr/pkg for packages, and /usr/local
> for scribbling in...)

I like those definitions very much.

Personally I simplify my life by moving /usr/local to /local (which of
course is a mount point) and when I use it I also move /usr/pkg to /pkg
(also a mount point), and on one machine I have them both under /opt
(which is a single filesystem) for fun too! ;-).

> For me it is just the opposite, /var (with its copies of what is in /)
> is the definition of the system, it and any user files that might happen to
> exist are all that really matters, the rest is all distribution stuff.
> I only rarely backup /usr - nothing there changes.  I "make package" when
> I build from kgsrc, and save the packages, so they're easy to replace, aside
> from that, and /usr/local (which is a mount point...) /usr is just what
> came from the distribution, no changes at all.

Indeed!  /var is the "safe" copy of the important localised bits of the
system.  That and user files (on /home or whatever) are all that really
matter.

In fact I'd really like to see changes made to hier(7) so that it
reflects this approach too.  I think such guidelines would be very
useful to help teach novice admins how easy it is to manage a system if
care is taken in setting it up.

Making /usr a separate filesystem is only interesting or important if
you either do lots of fiddling with basesrc and/or need the optimisation
of moving it to a different spindle.  However making /usr/local (or
wherever you might point it with a symlink) and /var and maybe
/var/spool, and probably /usr/pkg if you use it, and certainly /home,
and maybe even /usr/src and finally of course /tmp and mabye /var/tmp
all separate filesystems is much more important.

In an ideal world an upgrade (or reinstall after major damage to /)
would be simply a matter of booting from a CD and then running something
like the following:

	newfs /dev/sd0a		# root and /usr filesystem on system
	mount /dev/sd0a /mnt
	# also newfs /usr/pkg, or wherever, if you use it
	cd /mnt
	pax -r -z -p e -f distribution.tar.gz
	# mount /usr/pkg, or wherever, if you use it
	mount /dev/sd0f /mnt/var
	pkg_add $(cd /mnt/var/db/pkg; ls)
	etcupdate /mnt/var/backups /mnt/etc
	reboot			# and eject the CD ;-)

"etcupdate" would be a program for which there are several almost
ready-to-use prototypes available from FreeBSD which does an intelligent
three-way merge between /etc/somefile, /var/backups/somefile.orig, and
/var/backups/somefile.current and which then copies the original
distribution /etc/somefile to /var/backups/somefile.orig so the next
upgrade can do the same.  This of course implies that an install does
similar and initialy makes backup copies of the virgin distribution
files into /var/backups/*.orig before the admin gets a chance to
"corrupt" any of them.

-- 
							Greg A. Woods

+1 416 218-0098      VE3TCP      <gwoods@acm.org>      <robohack!woods>
Planix, Inc. <woods@planix.com>; Secrets of the Weird <woods@weird.com>