Why not use  some of the standard hooks in the dirvish.conf?

pre-server
pre-client
post-client
post-server

Check the dirvish docs: http://www.dirvish.org/FAQ.html#pre_and_post_configuration_scripts

JP


[email protected] wrote:
Send Dirvish mailing list submissions to
	[email protected]

To subscribe or unsubscribe via the World Wide Web, visit
	http://www.dirvish.org/mailman/listinfo/dirvish
or, via email, send a message with subject or body 'help' to
	[email protected]

You can reach the person managing the list at
	[email protected]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Dirvish digest..."


Today's Topics:

   1. dirvish and an lv snapshot (Jenny Hopkins)
   2. Re: dirvish and an lv snapshot (Eric Searcy)


----------------------------------------------------------------------

Message: 1
Date: Wed, 14 Jul 2010 22:40:06 +0100
From: Jenny Hopkins <[email protected]>
Subject: [Dirvish] dirvish and an lv snapshot
To: Dirvish user and developer mailing list <[email protected]>
Message-ID:
	<[email protected]>
Content-Type: text/plain; charset=ISO-8859-1

Hullo,

I'm having problems with making a backup of an lvm partition on a xen server.
I have a working script that creates an lvm snapshot of the partition
and mounts it. In the dirvish cronjob script I have placed the script
to run before dirvish expire and dirvish runall is called, then the
same script with an unmount parameter is called.
Like this:


## Example of how to mount and umount a backup partition...
# mount_check /backup
lvmsnapshot.sh create scafell

/usr/sbin/dirvish-expire --quiet && /usr/sbin/dirvish-runall --quiet
rc=$?

# umount /backup || rc=$?

lvmsnapshot.sh remove scafell || rc=$?


exit $rc

The problem is that the command to umount and remove the snapshot from
the mount point is run immediately after the dirvish is called, so
that there is no image to backup found.
I sort of assumed that the rc=$?  was to ensure the "lvmsnapshot.sh
remove scafell || rc=$?" wasn't called until after dirvish had done
its thing, but I must be wrong.  I comment out this line and the
backup runs fine.
I could put that line in a separate script and call it from cron a few
hours later but that's kind of messy.

Can anyone offer advice?

Thanks,

Jenny


------------------------------

Message: 2
Date: Wed, 14 Jul 2010 16:20:03 -0700
From: Eric Searcy <[email protected]>
Subject: Re: [Dirvish] dirvish and an lv snapshot
To: Dirvish user and developer mailing list <[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii

On Jul 14, 2010, at 2:40 PM, Jenny Hopkins wrote:

  
Hullo,

I'm having problems with making a backup of an lvm partition on a xen server.
I have a working script that creates an lvm snapshot of the partition
and mounts it. In the dirvish cronjob script I have placed the script
to run before dirvish expire and dirvish runall is called, then the
same script with an unmount parameter is called.
Like this:


## Example of how to mount and umount a backup partition...
# mount_check /backup
lvmsnapshot.sh create scafell

/usr/sbin/dirvish-expire --quiet && /usr/sbin/dirvish-runall --quiet
rc=$?

# umount /backup || rc=$?

lvmsnapshot.sh remove scafell || rc=$?
    

Couple thoughts:

I wouldn't have dirvish-runall conditional on dirvish-expire succeeding (&&).  Running your scheduled backup is (presumably) too important to skip just because some old copies might have failed deleting (actually I'm not sure what conditions would cause dirvish-expire to return non-zero, but I'd want to press on with the backups regardless).

While you're at it, put dirvish-expire before your lvm snapshot creation.  Expiring could take awhile, and you'd just be making the snapshot volume store more blocks (if it's a write-heavy LV) by increasing the time between LV snapshot creation and deletion.

That done, you'd get rid of the && before the dirvish-runall line, and you could have:

dirvish-runall --quiet
rc=$?

Which hopefully wouldn't have the error ...

the rc=$? doesn't actually cause the rest of the script to block, you shouldn't hit that line until dirvish-runall finishes, and it just saves the return code.  In other words, I don't know why the script, as you have it, appears to run dirvish-runall asyncronously as if you had & at the end of the line.

Another thought: after making the changes I mentioned above, try:

time dirvish-runall --quiet
rc=$?

Assuming you're getting cron email, it would be interesting to verify how quickly dirvish-runall is returning while you're debugging.  Thinking along similar lines, remove the --quiet and make sure the vault name is echoing.

Last thought would be to switch to post/pre-server commands for the vault in question (assuming a local dirvish backup from the looks of it? ... otherwise pre/post-client).  Would be "cleaner" if you have other vaults to backup that don't need to be inside the snapshot critical-space. :-)

Eric

------------------------------

_______________________________________________
Dirvish mailing list
[email protected]
http://www.dirvish.org/mailman/listinfo/dirvish


End of Dirvish Digest, Vol 68, Issue 2
**************************************

  
_______________________________________________
Dirvish mailing list
[email protected]
http://www.dirvish.org/mailman/listinfo/dirvish

Reply via email to