From owner-freebsd-questions@FreeBSD.ORG Sat Jul 26 21:36:53 2014 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5071B353 for ; Sat, 26 Jul 2014 21:36:53 +0000 (UTC) Received: from mail.cyberleo.net (mtumishi.cyberleo.net [216.226.128.201]) by mx1.freebsd.org (Postfix) with ESMTP id 2F1BB23E3 for ; Sat, 26 Jul 2014 21:36:52 +0000 (UTC) Received: from [172.16.44.4] (vitani.den.cyberleo.net [216.80.73.130]) by mail.cyberleo.net (Postfix) with ESMTPSA id E61EF1933; Sat, 26 Jul 2014 17:27:56 -0400 (EDT) Message-ID: <53D41D5C.1010003@cyberleo.net> Date: Sat, 26 Jul 2014 16:27:56 -0500 From: CyberLeo Kitsana User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: Mike Clarke , freebsd-questions@freebsd.org Subject: Re: Backing up zfs system to external disk References: <1947386.pOQVzt1YdP@curlew.lan> In-Reply-To: <1947386.pOQVzt1YdP@curlew.lan> X-Enigmail-Version: 1.6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Jul 2014 21:36:53 -0000 On 07/26/2014 07:14 AM, Mike Clarke wrote: > > I've put together a script that backs up my zfs system to a zfs pool > on an external ESATA drive. > > The script imports the backup pool with the -N option to avoid > mounting filesystems on top of the running system, updates the backup > pool to the latest snapshot with zfs send | zfs receive and then > exports the backup pool. > > This normally works fine except in the rare cases when the system is > shut down or crashes while the backup pool is still imported. If this > happens then problems arise on the next reboot because filesystems > will be mounted from both the system and backup pools using identical > mountpoints. > > I tried creating the backup pool with the "-m none" option to avoid > this but it didn't help. It only appears to apply to datasets created > with "zfs create" - datasets resulting from "zfs receive" retain their > original mountpoints. > > As a workaround I've created the following rc script which checks for > and exports the backup pool before the local filesystems are mounted > and seems to work OK. Since this isn't part of the base system I ought > to put it in /usr/local/etc/rc.d but it needs to run before /usr is > mounted so I had to put it in /etc/rc.d. > > I was wondering if there was a better way of solving this problem > without breaking to the normal file system hierarchy? Set canmount=off or noauto on the backup datasets. Beware that this property is not inherited, so you must explicitly set it on every dataset for which you wish to avoid auto-mounting. -- Fuzzy love, -CyberLeo Technical Administrator CyberLeo.Net Webhosting http://www.CyberLeo.Net Furry Peace! - http://www.fur.com/peace/