Knowledge Base

The VMware Knowledge Base provides support solutions, error messages and troubleshooting guides
 
Search the VMware Knowledge Base (KB)   View by Article ID
 

Using crontab to Schedule vmsnap Backups (2030)

Details

I keep getting intermittent I/O errors in my logs when I schedule vmsnap_all (vmsnap.pl) for my regular backups on different ESX Server hosts. vmsnap.pl reports an error message such as "DiskLib_Clone() failed :Input/output error".

How do I stop these errors?

Solution

In an environment where multiple ESX Server hosts share the same SAN LUN, and vmsnap.pl is executed simultaneously on several servers, SCSI reservation conflicts may occur and cause vmsnap.pl backups to fail.

To avoid this problem:

  1. Set up cron.d to run vmsnap on every ESX Server host.
  2. Make sure the timeframe window of the snap on each ESX Server host does not overlap with other ESX Server hosts. Staggering the backup windows helps eliminate I/O errors, performance issues, and backup failures.
Although the exact setup varies from site to site, here are a few pointers on setting up vmsnap in cron.d:
  1. Create /usr/sbin/vmsnap_local.sh similar to:
    echo "----------------------------------------";
    echo "$(date): VMSNAP_ALL STARTED"
    echo "----------------------------------------";
    /usr/sbin/vmsnap_all
    echo "----------------------------------------";
    echo "$(date): VMSNAP_ALL FINISHED"
    echo "----------------------------------------";
  2. Create a file under /etc/cron.d named vmsnap. The contents of /etc/cron.d/vmsnap should look like the following example:
    #!/bin/bash
    15 20 * * * root /usr/sbin/vmsnap_local.sh >/var/log/vmsnap.log
    2>&1
    In this example, 15 20 means that the script runs at 8:15 p.m. Adjust the time to suit your environment. /usr/sbin/vmsnap_local.sh is a local shell script, which you previously created in step 1. The script contains all shell commands relevant to the backup process.
  3. Use the following command to change permissions on the file and enable it:
    chmod 755 /etc/cron.d/vmsnap; touch /etc/cron.d
If you are not sure which LUNs are shared, avoid running vmsnap simultaneously on different hosts altogether. You can achieve this by:
  • Manually checking /var/log/vmsnap.log for the exact start and end times on every host.
  • Scheduling backups on all ESX Server hosts without overlap of timeframes.
  • Checking log files systematicaly for errors and streches in the backup timeframes, which might lead to overlap.

As an alternative to this method, you can implement some kind of locking scheme. For example, you can use NFS mounts on all ESX Server hosts, with a shared file system for storing the lock information or file.

Keywords

2030

Request a Product Feature

To request a new product feature or to provide feedback on a VMware product, please visit the Request a Product Feature page.

Feedback

  • 0 Ratings

Did this article help you?
This article resolved my issue.
This article did not resolve my issue.
This article helped but additional information was required to resolve my issue.
What can we do to improve this information? (4000 or fewer characters)
  • 0 Ratings
Actions
KB: