Amanda-Users

Re: Amanda and ZFS

2008-04-25 14:18:50
Subject: Re: Amanda and ZFS
From: Pieter Bowman <bowman AT math.utah DOT edu>
To: Nick Smith <nick.smith AT techop DOT ch>
Date: Fri, 25 Apr 2008 11:41:32 -0600 (MDT)
I started using ZFS in a big way over a year ago on our main file
server.  Since there is no ufsdump replacement to use with ZFS, I
elected to use GNU tar.  I know this doesn't yet cover backing up
things like ACLs, but we don't use them in our very heterogeneous
environment.  The main idea I had was to take a snapshot and point tar
at the snapshot so it had a nice static, read-only copy of the
filesystem to work from.

I created a shell script to run as a cron job, just before amdump is
run, which cleans up the previous snapshots and takes new snapshots of
each of the pools (effectively):

        zfs destroy -r pool01@AMANDA
        zfs snapshot -r pool01@AMANDA

Fortunately, amanda has a nice way to specify that the filesystem name
is something like "/local", but the point to have tar start at is a
different location.  A disklist entry such as:

        foo.math.utah.edu /local /local/.zfs/snapshot/AMANDA user-tar

The final issue I found was that the inode numbers in the snapshots
change each time a new snapshot is created.  This is a problem with
GNU tar's listed-incremental facility.  To work around this I ended up
hacking GNU tar to make it ignore the inodes stored in the listed
incremental files.  This was just a simple change, to have ZFS
filesystems treated the same as NFS.  The patch was submitted to the
GNU tar developers, but was rejected.  Here is the patch as applied to
GNU tar 1.16 (this patch also contains what I consider a fix for an
actual coding bug):

diff -r -c tar-1.16/src/incremen.c tar-1.16-local/src/incremen.c
*** tar-1.16/src/incremen.c     Fri Sep  8 10:42:18 2006
--- tar-1.16-local/src/incremen.c       Fri Dec  8 14:53:37 2006
***************
*** 71,77 ****
  
  #if HAVE_ST_FSTYPE_STRING
    static char const nfs_string[] = "nfs";
! # define NFS_FILE_STAT(st) (strcmp ((st).st_fstype, nfs_string) == 0)
  #else
  # define ST_DEV_MSB(st) (~ (dev_t) 0 << (sizeof (st).st_dev * CHAR_BIT - 1))
  # define NFS_FILE_STAT(st) (((st).st_dev & ST_DEV_MSB (st)) != 0)
--- 71,77 ----
  
  #if HAVE_ST_FSTYPE_STRING
    static char const nfs_string[] = "nfs";
! # define NFS_FILE_STAT(st) (strcmp ((st).st_fstype, nfs_string) == 0 || 
strcmp ((st).st_fstype, "zfs") == 0)
  #else
  # define ST_DEV_MSB(st) (~ (dev_t) 0 << (sizeof (st).st_dev * CHAR_BIT - 1))
  # define NFS_FILE_STAT(st) (((st).st_dev & ST_DEV_MSB (st)) != 0)
***************
*** 247,253 ****
         directories, consider all NFS devices as equal,
         relying on the i-node to establish differences.  */
  
!       if (! (((DIR_IS_NFS (directory) & nfs)
              || directory->device_number == stat_data->st_dev)
             && directory->inode_number == stat_data->st_ino))
        {
--- 247,253 ----
         directories, consider all NFS devices as equal,
         relying on the i-node to establish differences.  */
  
!       if (! (((DIR_IS_NFS (directory) && nfs)
              || directory->device_number == stat_data->st_dev)
             && directory->inode_number == stat_data->st_ino))
        {


I hope this helps other people with using amanda and ZFS.

I'm happy to clear up any unclear issues.

Pieter

<Prev in Thread] Current Thread [Next in Thread>