Data Backup and Recovery Articles and Resources

Snapdrive Wrapper to support file systems on unpartitioned LUNs on RHEL with Snapmanager for Oracle

This is a work around for this Knowledge base article:

https://kb.netapp.com/support/index?page=content&id=3011226https://kb.netapp.com/support/index?page=content&id=3011226

#!/bin/bash
VERSION=2
# snapdrive wrapper to allow proper handling of raw luns on RedHat linux
#
# Specifically, this script intercepts snap connect commands that do not
# make use of the nopersist option, insert the -nopersist, and emulate the
# expected default behaviour of updating /etc/fstab with the newly applied
# lun.  Using this wrapper will allow scripts/utilities (eg SMO) that do not
# handle snapdrives handling of raw luns on RedHat to function as expected.
#
# Installation:
# Make a bin_real directory in your snapdrive installation directory (ie, the
# directory level just beneath the bin directory containing the snapdrive
# executable), and move the snapdrive executable to the bin_real directory.
# Place this script where the snapdrive executable was originally installed
# and don't forget to chmod it.  If necessary, change the SD_BASE variable
# below to reflect the correct snapdrive base directory. 
#
# Disclaimer:
# This is in no way supported by NetApp, use at your own risk.
#
# 2013-06-18 - Initial version
# 2013-06-19 - v2 - changed options for fstab insertion
#
# Cheers,
# Warren M. Landon (wlandon@thig.com)

# Update to use the snapdrive installation directory
SD_BASE=/opt/NetApp/snapdrive/

if [[ $1 = "snap" ]] && [[ $2 = "connect" ]] && [[ ! $@ =~ "-nopersist" ]]
then
    cat /proc/mounts > /tmp/sd_mnt.before
    ${SD_BASE}/bin_real/snapdrive $@ -nopersist
    result=$?
    cat /proc/mounts > /tmp/sd_mnt.after
    if [[ $(diff /tmp/sd_mnt.before /tmp/sd_mnt.after | grep '>' | wc -l) -eq 1 ]]
    then
        diff /tmp/sd_mnt.before /tmp/sd_mnt.after |grep '>' | awk '{print $2,"\t",$3,"\t",$4,"\tdefaults,noatime,nodiratime,data=ordered","1","1"}' >> /etc/fstab
    fi
else
    ${SD_BASE}/bin_real/snapdrive $@
    result=$?
fi

exit $result

Please Note:

All content posted on the NetApp Community is publicly searchable and viewable. Participation in the NetApp Community is voluntary.

In accordance with our Code of Conduct and Community Terms of Use, DO NOT post or attach the following:

  • Software files (compressed or uncompressed)
  • Files that require an End User License Agreement (EULA)
  • Confidential information
  • Personal data you do not want publicly available
  • Another’s personally identifiable information (PII)
  • Copyrighted materials without the permission of the copyright owner

Continued non-compliance may result in NetApp Community account restrictions or termination.

All Community Forums