How to recover/reinitialize a trashed /var partition?

Brandon D. Valentine brandon at
Wed Jul 28 18:19:30 PDT 2004

On Thu, Jul 29, 2004 at 01:43:29AM +0100, David Kreil wrote:
> I am writing in the hope that someone can give me a hint of how to either 
> recover or recreate a virgin FreeBSD /var partition in an otherwise 
> (apparently) functioning system.

If you've still got /usr/obj around from your last buildworld you can
boot to single user mode and installworld again.  If not, you can use
mtree(8) to recreate the hierarchy for /var.  This should work:

# mtree -deU -f /etc/mtree/BSD.var.dist -p /var

You may have to touch/chown/chmod a few files here and there to make
sure the appropriate users have permissions to write to/from them.  See
/usr/src/etc/Makefile for some more information on that.

Unfortunately I don't think there is a 'var' target in any of those


Brandon D. Valentine
brandon at                 
Pseudo-Random Googlism:  brandon is gummmmy

More information about the freebsd-fs mailing list