From owner-freebsd-fs@FreeBSD.ORG Thu Jun 9 21:57:17 2011 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E35A51065674 for ; Thu, 9 Jun 2011 21:57:17 +0000 (UTC) (envelope-from rsimmons0@gmail.com) Received: from mail-gx0-f182.google.com (mail-gx0-f182.google.com [209.85.161.182]) by mx1.freebsd.org (Postfix) with ESMTP id A28818FC2C for ; Thu, 9 Jun 2011 21:57:17 +0000 (UTC) Received: by gxk28 with SMTP id 28so1516416gxk.13 for ; Thu, 09 Jun 2011 14:57:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type:content-transfer-encoding; bh=lkwpAIbfWgGPMPKfZVgtkXKrATukmD2OUJytWW0gqGs=; b=O5LR5DxsRLzWbwVuhPx8lKVHFL5lekQoTeRaDPEIbFg1f7FQYIebovpfJ2sjfPcXQ3 R492eQ5R1DxEKxUBQp1eAQNKwEEDMXIoRzTq8Z8LMoHnibHYG9QGf8W9kTOdGS8a1Yaw Y19PYwBiDINaAJ8dSwvOvnhSgYtXyGriNYKFo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=EbWZu+IakadmZtF6JdWQsohysxSTsZHb66jBW9UGxxp0I+g+9yCPO3WAaNjp86BkR2 4v8ywO1lUGINO0WHJooiTDGHlczFKz0SP2pRY3LihIDT3sLJ2VlPsAJnrfgyvXhElOLz 365/+UEZ3cDLyPJoznEaikz5zUy0JeRtE6VSo= MIME-Version: 1.0 Received: by 10.100.17.35 with SMTP id 35mr1259923anq.1.1307656636767; Thu, 09 Jun 2011 14:57:16 -0700 (PDT) Received: by 10.100.243.35 with HTTP; Thu, 9 Jun 2011 14:57:16 -0700 (PDT) In-Reply-To: <4DF11BB8.5030805@dannysplace.net> References: <4DF11BB8.5030805@dannysplace.net> Date: Thu, 9 Jun 2011 17:57:16 -0400 Message-ID: From: Robert Simmons To: freebsd-fs@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: Getting access to checksums. X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Jun 2011 21:57:18 -0000 On Thu, Jun 9, 2011 at 3:15 PM, Dan Carroll wrote: > I'm currently working on a system that monitors file changes. > I'd like to calculate the checksums on each file both to see if a change = has > occured as well as looking for duplicate files. > > I'm not sure what algorithm I'll end up using but I was wondering if it w= as > possible to get access to ZFS' checksumming? > Does it happen on a file level or is it block level only? =A0And if it do= es, > is there an easy way to obtain this information from the system? You may not want to reinvent the wheel. There are quite a few ports that do what you want, more or less. You may want to start there, and if they don't serve your purpose, then maybe do it the hard way. ;) The main one is the famous Tripwire: http://www.freebsd.org/cgi/url.cgi?ports/security/tripwire/pkg-descr http://www.freebsd.org/cgi/url.cgi?ports/security/tripwire12/pkg-descr http://www.freebsd.org/cgi/url.cgi?ports/security/tripwire-131/pkg-descr Then there are some replacements for Tripwire that you may want to look at as well: http://www.freebsd.org/cgi/url.cgi?ports/security/aide/pkg-descr http://www.freebsd.org/cgi/url.cgi?ports/security/yafic/pkg-descr Also, if you really want to roll your own, just write a script and use the built-in checksum utilities: http://www.freebsd.org/cgi/man.cgi?query=3Dsha256&apropos=3D0&sektion=3D0&m= anpath=3DFreeBSD+8.2-RELEASE&format=3Dhtml And find(1): http://www.freebsd.org/cgi/man.cgi?query=3Dfind&apropos=3D0&sektion=3D0&man= path=3DFreeBSD+8.2-RELEASE&format=3Dhtml