From owner-freebsd-fs@FreeBSD.ORG Mon Feb 16 09:54:16 2015 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 48A9A932; Mon, 16 Feb 2015 09:54:16 +0000 (UTC) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C7614D47; Mon, 16 Feb 2015 09:54:15 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.9/8.14.9) with ESMTP id t1G9sALY078481 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 16 Feb 2015 11:54:11 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.9.2 kib.kiev.ua t1G9sALY078481 Received: (from kostik@localhost) by tom.home (8.14.9/8.14.9/Submit) id t1G9sAm0078480; Mon, 16 Feb 2015 11:54:10 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 16 Feb 2015 11:54:10 +0200 From: Konstantin Belousov To: Matthew Seaman Subject: Re: About Filesystem freeze/thaw in freebsd Message-ID: <20150216095410.GH34251@kib.kiev.ua> References: <54E1B90E.8050101@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <54E1B90E.8050101@freebsd.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on tom.home Cc: freebsd-fs@freebsd.org X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Feb 2015 09:54:16 -0000 On Mon, Feb 16, 2015 at 09:31:58AM +0000, Matthew Seaman wrote: > On 02/16/15 09:07, zx zx wrote: > > Hi, I am experimenting to do a live backup of FreeBSD > > VM. Question is do we have freeze/thaw interfaces in FreeBSD? I > > searched a lot in web and freebsd source code, just could not find > > the right interface. As I know that in linux:VxFS > > provides ioctl interfaces to application programs to freeze and thaw > > VxFS file systems. The interfaces are VX_FREEZE, VX_FREEZE_ALL, and > > VX_THAW.About Freeze and thaw Freezing a file system temporarily > > blocks all I/O operations to a file system and then performs a sync > > on the file system. Current operations are completed and the file > > system is synchronized to disk. Freezing a file system is a necessary > > step for obtaining a stable and consistent image of the file system > > at the volume level. Consistent volume-level file system images can > > be obtained and used with a file system snapshot tool. The freeze > > operation flushes all buffers and pages in the file system cache that > > contain dirty metadata and user data. The operation then suspends any > > new activity on the file system until the file system is thawed. > > Any help would be appreciated, thanks a lot! Andy Zhang > > What you want is snapshotting. You can create a snapshot of UFS or ZFS > filesystems, mount the snapshot and then back it up without needing to > worry about the filesystem changing while you're trying to back it up. > > See mksnap_ffs(8) and the 'snapshot' entry in zfs(8) > > The snapshot is mounted separately from the actual filesystem which can > carry on with normal activities in the mean time. > > Snapshotting functionality is built into dump(8) for UFS filesystems > (See the -L flag in that man page) or you can use zfs send / recv to > dump filesystems to tape, which implies use of snapshots. Snapshot is different functionality from what the OP asked. Exactly requested feature is provided by UFSSUSPEND/UFSRESUME ioctls on the /dev/ufssuspend, for UFS volumes. You should consult the code to see how to use them. I suspect that the similar feature exists for ZFS, but I do not know where to start looking.