xfs
[Top] [All Lists]

RE: xfsdump sample scripts

To: "'Ian Cumming'" <ian@xxxxxxxxxx>, linux-xfs@xxxxxxxxxxx
Subject: RE: xfsdump sample scripts
From: Murthy Kambhampaty <Murthy.Kambhampaty@xxxxxxxxx>
Date: Fri, 17 May 2002 10:59:56 -0400
Sender: owner-linux-xfs@xxxxxxxxxxx
Ian, thanks for the scripts (I was also in the process of setting up a
backup routine, and these will save me a lot of time, and they're more
polished than what I would have hacked up). A variation for those who have
sufficient backup storage/small amounts of data to backup, would be to set
the backup "level" on all days except Sunday to 1 to reduce the number of
tapes required to recover a given day's filesystem state (some vendors call
this strategy "differential backups"). Under this strategy, to recover the
filesystem state as of the Wednesday backup, for example, one would only
have to restore the Sunday xfsdump and then the Wednesday xfsdump.

This can be accomplished, for example, with the following changes (in
diff-like notation; essentially archive files are named by day rather than
level, and the get_dump_level() function is defaults to 1, setting Sunday's
level to 0):

### Begin code snippet: ###
# it all starts here
main()
{
        # Perform pre backup operations
        pre_backup


        # Get the level of the backup (can be overriden with argv[1])
        if [ "$1" != "" ] ; then
                echo "Overriding dump level with $1"
                LEVEL=$1
        else 
                LEVEL=`get_dump_level`
        fi

        # Perform the backups
        # These commands could be rolled into a separate function, but I
decided against this to improve readability.
        
        echo "dumping /"
-       $XFSDUMP -l $LEVEL -F -L "/" -M "$MEDIA_LABEL" - / | gzip - >
"$BACKUP_PATH/root/root_xfsdump$LEVEL.gz"
+       $XFSDUMP -l $LEVEL -F -L "/" -M "$MEDIA_LABEL" - / | gzip - >
"$BACKUP_PATH/root/root_xfsdump$(date +%A).gz"
        
        echo "dumping /usr"
-       $XFSDUMP -l $LEVEL -F -L "/usr" -M "$MEDIA_LABEL" - /usr | gzip - >
"$BACKUP_PATH/usr/usr_xfsdump$LEVEL.gz"
+       $XFSDUMP -l $LEVEL -F -L "/usr" -M "$MEDIA_LABEL" - /usr | gzip - >
"$BACKUP_PATH/root/root_xfsdump$(date +%A).gz"
        
        echo "dumping /var"
-       $XFSDUMP -l $LEVEL -F -L "/var" -M "$MEDIA_LABEL" - /var | gzip - >
"$BACKUP_PATH/var/var_xfsdump$LEVEL.gz"
+       $XFSDUMP -l $LEVEL -F -L "/var" -M "$MEDIA_LABEL" - /var | gzip - >
"$BACKUP_PATH/root/root_xfsdump$(date +%A).gz"

        echo "dumping /pub"
-       $XFSDUMP -l $LEVEL -F -L "/pub" -M "$MEDIA_LABEL" - /pub | gzip - >
"$BACKUP_PATH/pub/pub_xfsdump$LEVEL.gz"
+       $XFSDUMP -l $LEVEL -F -L "/pub" -M "$MEDIA_LABEL" - /pub | gzip - >
"$BACKUP_PATH/root/root_xfsdump$(date +%A).gz"

        echo "dumping /home"
-       $XFSDUMP -l $LEVEL -F -L "/home" -M "$MEDIA_LABEL" - /home | gzip -
> "$BACKUP_PATH/home/home_xfsdump$LEVEL.gz"
+       $XFSDUMP -l $LEVEL -F -L "/home" -M "$MEDIA_LABEL" - /home | gzip -
> "$BACKUP_PATH/root/root_xfsdump$(date +%A).gz"


        # Perform post backup operations
        post_backup
}


# Return the dump level, indexed from Sunday (level 0)
get_dump_level()
{
        case `$DAY` in
                Sun) echo 0;;
+               *) echo 1;;
-               Mon) echo 1;;
-               Tue) echo 2;;
-               Wed) echo 3;;
-               Thu) echo 4;;
-               Fri) echo 5;;
-               Sat) echo 6;;
        esac
}
### End code snippet ###

Thanks again for sharing your shell scripts,
        Murthy


> -----Original Message-----
> From: Ian Cumming [mailto:ian@xxxxxxxxxx]
> Sent: Friday, May 17, 2002 01:43
> To: linux-xfs@xxxxxxxxxxx
> Subject: Re: xfsdump sample scripts
> 
> 
> Hi Greg,
> 
> Thu, May 16, 2002 at 04:24:01PM -0400, Greg Freemyer wrote:
> > Are there any sample scripts which are designed to be 
> called from cron and do something like the following:
> 
> I posted this script to the list last month (I've since tidied it up a
> little bit), which might be what you are looking for.
> 
> Basically, I do full (level 0) dumps every Sunday, with incremental
> backups every other day of the week.
> 
> I've been running this script for a few weeks. It does the 
> job for me :)
> 
> See the attached files, and the brief documentation within.
> 
> Ian.
> 
> -- 
> Ian Cumming, ian@xxxxxxxxxxxxxx
> 
> "The number of Unix installations has grown to 10, with more 
> expected."
> -- The Unix Programmer's Manual, 2nd Edition, June, 1972
> 
> 


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