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

Reply via email to