Search the VMware Knowledge Base (KB)
View by Article ID

Using crontab to Schedule vmsnap Backups (2030)

  • 4 Ratings


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

How do I stop these errors?


In an environment where multiple ESX Server hosts share the same SAN LUN, and is executed simultaneously on several servers, SCSI reservation conflicts may occur and cause 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/ similar to:
    echo "----------------------------------------";
    echo "$(date): VMSNAP_ALL STARTED"
    echo "----------------------------------------";
    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:
    15 20 * * * root /usr/sbin/ >/var/log/vmsnap.log
    In this example, 15 20 means that the script runs at 8:15 p.m. Adjust the time to suit your environment. /usr/sbin/ 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.

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.


  • 4 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)

Please enter the Captcha code before clicking Submit.
  • 4 Ratings