From owner-freebsd-questions@freebsd.org Wed Jan 18 03:26:27 2017 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 19264CB413C for ; Wed, 18 Jan 2017 03:26:27 +0000 (UTC) (envelope-from brandon.wandersee@gmail.com) Received: from mail-io0-f195.google.com (mail-io0-f195.google.com [209.85.223.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E38C413E2 for ; Wed, 18 Jan 2017 03:26:26 +0000 (UTC) (envelope-from brandon.wandersee@gmail.com) Received: by mail-io0-f195.google.com with SMTP id 101so370214iom.0 for ; Tue, 17 Jan 2017 19:26:26 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:user-agent:from:to:cc:subject :in-reply-to:date:message-id:mime-version; bh=1ULYqLBYJwcA1QSfiB9NedlLWM1ITP8uS3oDg4fN4bM=; b=gu4i3W4PFCiTW9GxKMTdvC+dfYSjCMuCgMXIOkO8LCvxcjl+cn9MPRMPi9dZMHyt7E e8fOCrrETdCjGvamtEod5HfN5FJcC9tnaKL1jCRrNDaPgn7ZSp16AHUon26GayqvS+Mo XT/zIevBEPHoPGMBTUbSVtyY2Efv+d3uLnCrnJEUEEQwJy0K9drm/GjObRvWPjnrEIMT DFlyOtLa0Msupg+Kvd7dAmoBFMburG2HDPyUGcT5gBU4lU1JkhXXClVU/bEpHSUSSqO7 cqOUjqaaY8euMyMEttndj9q9clBACEK6iKTJd/bel/CJq9519DGFwX8Yq7hrfXocQ/tH EDzg== X-Gm-Message-State: AIkVDXJf167MZicR1vNAcal+FX6YG1JDDd/igkuXeaahrt8rUtCy/hEx2PHHbE2ksqaAiQ== X-Received: by 10.107.129.222 with SMTP id l91mr1246420ioi.194.1484704014554; Tue, 17 Jan 2017 17:46:54 -0800 (PST) Received: from WorkBox.homestead.org ([184.97.235.250]) by smtp.gmail.com with ESMTPSA id l3sm201046iof.33.2017.01.17.17.46.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 17 Jan 2017 17:46:53 -0800 (PST) Received: from localhost (WorkBox.homestead.org [local]) by WorkBox.homestead.org (OpenSMTPD) with ESMTPA id baec65d8; Tue, 17 Jan 2017 19:46:52 -0600 (CST) References: User-agent: mu4e 0.9.16; emacs 25.1.1 From: Brandon J. Wandersee To: Arthur Chance Cc: FreeBSD-Questions Subject: Re: Boot environments and /var - what should be shared/unshared? In-reply-to: Date: Tue, 17 Jan 2017 19:46:51 -0600 Message-ID: <86h94xcf78.fsf@WorkBox.homestead.org> MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jan 2017 03:26:27 -0000 Arthur Chance writes: > I've been using beadm boot environments for a while now, but still > haven't seen a definitive reference for which parts of /var should be > shared across boot environments and which should be per environment. Is > there such a document, or is everybody still busking it? > > Some top level directories in /var seem fairly obviously in need of > sharing, others less so, and /var/db seems to be a horrible mix of stuff > that could be shared across releases and stuff that might break horribly > if shared over major revisions. (That's "might" because I have no idea > if it would in practice.) > > I doubt whether any of this would matter (except for space) if one > simply rolled forward monotonically, but a roll back because of > problems, or simply switching between development environments, could > lose necessary updates if the directory hadn't been shared when it > should have been. I suppose I can't give you a "definitive reference," but I selected things to omit from boot environments based on advice in the book /FreeBSD Mastery: Advanced ZFS" by Michael W. Lucas and Alan Jude. Here's what I've got, follow by the reasoning behind it: | NAME USED AVAIL REFER MOUNTPOINT | workbox/VARIABLE 3.82M 72.5G 144K none | workbox/VARIABLE/crash 144K 72.5G 144K /var/crash | workbox/VARIABLE/log 2.86M 497M 1.80M /var/log | workbox/VARIABLE/mail 340K 72.5G 196K /var/mail | workbox/VARIABLE/tmp 360K 72.5G 144K /var/tmp 1. /var/crash, /var/tmp: The contents of these directories are supposed to store non-volatile data, some of which is relevant to recovery. You don't want it disappearing after a reboot, or want to have to find and mount an extra ZFS dataset in order to access it. 2. /var/mail, /var/log: Mail and logs are generated by applications as well as the base system, and are time-sensitive. You don't want these skipping around through time at all, but it's more egregious if you lose a day's worth of logs for your web server because something in the base system got messed up. That's exactly the sort of thing the BSD filesystem hierarchy was designed to prevent in the first place. I've also got a couple datasets mounted in /var, but as children of another tree: | workbox/APPS 6.26G 72.5G 5.42G /usr/local | workbox/APPS/config 7.17M 72.5G 6.22M /usr/local/etc | workbox/APPS/pkgCache 238M 2.77G 236M /var/cache/pkg | workbox/APPS/pkgDB 162M 72.5G 81.5M /var/db/pkg This way I can roll back package upgrades all at once without touching anything else on the system. I used to handle packages/ports within boot environments, but decided to separate them once I realized that doing so could make them grow pretty large with successive upgrades. Having your ports/packages tied to boot environments is really only useful when tracking -CURRENT or performing a major version upgrade, so I see it as a waste to constantly take up space in preparation for something that happens once every couple years, for which I'll have ample warning and preparation. Someone else might come along with better ideas, but I suspect a lot of it depends on taste and personal need. -- :: Brandon J. Wandersee :: brandon.wandersee@gmail.com :: -------------------------------------------------- :: 'The best design is as little design as possible.' :: --- Dieter Rams ----------------------------------