On Nov 9, 2009, at 2:06 PM, Andrew Daugherity wrote:

I'd hoped this script would work for me as a "snapshot diff" script, but it seems that bart doesn't play well with large filesystems (don't know the cutoff, but my zfs pools (other than rpool) are all well over 4TB).

'bart create' fails immediately with a "Value too large for defined data type" error, and this is in fact mentioned in the Solaris 10 10/09 release notes:
====
Possible Error With 32-bit Applications Getting File System State on Large File Systems (6468905)

When run on large file systems, for example ZFS, applications using statvfs(2) or statfs(2) to get information about the state of the file system exhibit an error. The following error message is displayed:

Value too large for defined data type

Workaround: Applications should use statvfs64() instead.
====
from
http://docs.sun.com/app/docs/doc/821-0381/gdzmr?l=en&a=view

and in fact, if I invoke bart via truss, I see it calls statvfs() and fails. Way to keep up with the times, Sun!


Is there a 64-bit version of bart, or a better recommendation for comparing snapshots? My current backup strategy uses rsync, which I'd like to replace with zfs send/receive, but I need a way to see what changed in the past day.

find /filesystem -mtime -1
 -- richard


Thanks,


Andrew Daugherity
Systems Analyst
Division of Research & Graduate Studies
Texas A&M University






Trevor Pretty <trevor_pre...@eagle.co.nz> 10/26/2009 5:16 PM >>>
Paul

Being a script hacker like you the only kludge I can think of.

A script that does something like

ls > /tmp/foo
sleep
ls /tmp/foo.new
diff /tmp/foo /tmp/foo.new >/tmp/files_that_have_changed
mv /tmp/foo.new /tmp/foo

Or you might be able to knock something up with bart nd zfs snapshots. I did write this which may help?????

#!/bin/sh

#set -x

# Note: No implied warranty etc. applies.
#       Don't cry if it does not work. I'm an SE not a programmer!
#
###################################################################
#
# Version 29th Jan. 2009
#
#     GOAL: Show what files have changed between snapshots
#
#     But of course it could be any two directories!!
#
###################################################################
#

## Set some variables
#
SCRIPT_NAME=$0
FILESYSTEM=$1
SNAPSHOT=$2
FILESYSTEM_BART_FILE=/tmp/filesystem.$$
SNAPSHOT_BART_FILE=/tmp/snapshot.$$
CHANGED_FILES=/tmp/changes.$$


## Declare some commands (just in case PATH is wrong, like cron)
#
BART=/bin/bart


## Usage
#
Usage()
{
       echo ""
       echo ""
       echo "Usage: $SCRIPT_NAME -q filesystem snapshot "
       echo ""
       echo " -q will stop all echos and just list the changes"
       echo ""
       echo "Examples"
       echo "    $SCRIPT_NAME /home/fred    /home/.zfs/snapshot/fred "
       echo "    $SCRIPT_NAME .             /home/.zfs/snapshot/fred "
       echo ""
       echo ""
       exit 1
}

########### Main Part ###################


## Check Usage
#
if [ $# -ne 2 ]; then
   Usage
fi

## Check we have different directories
#
if [ "$1" = "$2" ]; then
   Usage
fi


##  Handle dot
#
if [ "$FILESYSTEM" = "." ]; then
   cd $FILESYSTEM ; FILESYSTEM=`pwd`
fi
if [ "$SNAPSHOT" = "." ]; then
   cd $SNAPSHOT ; SNAPSHOT=`pwd`
fi

## Check the filesystems exists It should be a directory
#  and it should have some files
#
for FS in "$FILESYSTEM" "$SNAPSHOT"
do
   if [ ! -d "$FS" ]; then
       echo ""
       echo "ERROR file system $FS does not exist"
       echo ""
       exit 1
   fi
   if [ X"`/bin/ls "$FS"`" = "X" ]; then
       echo ""
       echo "ERROR file system $FS seems to be empty"
       exit 1
       echo ""
   fi
done



## Create the bart files
#

echo ""
echo "Creating bart file for $FILESYSTEM can take a while......"
cd "$FILESYSTEM" ; $BART create -R . > $FILESYSTEM_BART_FILE
echo ""
echo "Creating bart file for $SNAPSHOT can take a while......"
cd "$SNAPSHOT" ; $BART create -R . > $SNAPSHOT_BART_FILE


## Compare them and report the diff
#
echo ""
echo "Changes...."
echo ""
$BART compare -p $FILESYSTEM_BART_FILE $SNAPSHOT_BART_FILE | awk '{print $1}' > $CHANGED_FILES
/bin/more $CHANGED_FILES
echo ""
echo ""
echo ""

## Tidy kiwi
#
/bin/rm $FILESYSTEM_BART_FILE
/bin/rm $SNAPSHOT_BART_FILE
/bin/rm $CHANGED_FILES

exit 0


_______________________________________________
zfs-discuss mailing list
zfs-discuss@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/zfs-discuss

_______________________________________________
zfs-discuss mailing list
zfs-discuss@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/zfs-discuss

Reply via email to