VMware Cloud Community
cmap16
Contributor
Contributor

Vsphere 5.1 pre-freee and post-thaw on snapshots


Hi

I have /usr/sbin/pre-freeze-script and /usr/sbin/post-thaw-script working fine with snapshots taken through netbackup. However when I run by rightclicking "take snapshot" in vsphere it doesn't execute the scripts. linux os. I have the latest vmtools installed and ticking snapshot vm memory and quiesce guest file system. I am hoping to run some database shutdown/start commands in it and take the odd backup on the fly. Thanks for any input.

Elaine

0 Kudos
11 Replies
admin
Immortal
Immortal

can you run the scripts manually on the Guest OS and check if it works. Suspect the execute permissions on scripts.

0 Kudos
cmap16
Contributor
Contributor

HI

They work ok manually as root. I set to 777 just in case and still didn't happen on the vsphere client snapshot.

So to recap, ok manually, ok through netbackup initiating the snapshot but not vsphere 5.1 right click "take snapshot". Takes one but doesn't run the scripts.

Elaine

0 Kudos
admin
Immortal
Immortal


Please provide the location in VM of pre freeze and post thaw and scripts file.

0 Kudos
cmap16
Contributor
Contributor

hi

/usr/sbin/pre-freeze-script

/usr/sbin/post-thaw-script

0 Kudos
admin
Immortal
Immortal

Please send the contents of the scripts

0 Kudos
cmap16
Contributor
Contributor

pre-freeze-script /opt/SYMCquiesce/bin/freeze LogDir=/`uname -n`/logs echo "`date` - stop slave" > $LogDir/vm.log /usr/local/mysql/bin/mysql -u root -ppass -e 'STOP SLAVE SQL_THREAD;' /usr/local/mysql/bin/mysql -u root -ppass -e "SHOW SLAVE STATUS\G"| grep -i  "Log" >> $LogDir/vm.log post-thaw-script /usr/local/mysql/bin/mysql -u root -ppass -e 'START SLAVE SQL_THREAD;' LogDir=/`uname -n`/logs /usr/local/mysql/bin/mysql -u root -ppass -e "SHOW SLAVE STATUS\G"| grep -i >  "Log" $LogDir/vm.log echo "`date` - start slave" >> $LogDir/vm.log cat $LogDir/vm.log | mail -s "VM" mymail

0 Kudos
admin
Immortal
Immortal

Check kb 2038606

0 Kudos
cmap16
Contributor
Contributor

Don't think this is the answer as it does take a snapshot just doesn't run the scripts.

Also SLES 11 SP2 = kernel 3.0.74-0.6.8


0 Kudos
MKguy
Virtuoso
Virtuoso

When taking a snapshot manually, do you have the quiesce filesystem checkbox enabled? If not then it should not execute pre-freeze and post-thaw scripts.

-- http://alpacapowered.wordpress.com
0 Kudos
cmap16
Contributor
Contributor

hi

Yes I do have it ticked.

Elaine

0 Kudos
d4v1dk
Contributor
Contributor

I just want to add my notes to this issue for those who are trying to get this to work.

To create the pre-freeze-script and post-thaw-script on Linux, do the following:

     1. Create /usr/sbin/pre-freeze-script

$ sudo echo "echo \"\$(date) pre-freeze\" >> /tmp/snapshot.log" > /usr/sbin/pre-freeze-script

     2. Create /usr/sbin/post-thaw-script

$ sudo echo "echo \"\$(date) post-thaw\" >> /tmp/snapshot.log" > /usr/sbin/post-thaw-script

     3. Change the owner

$ sudo chown root.root /usr/sbin/pre-freeze-script /usr/sbin/post-thaw-script

     4. Change the permissions

$ sudo chmod 0700 /usr/sbin/pre-freeze-script /usr/sbin/post-thaw-script

     5. Test by creating a snapshot in vcenter (make sure you CHECK "Quiesce guest file system" and UNCHECK "Snapshot the virtual machine's memory")

     6. Look in the log file when the snapshot is complete (with memory option turned off, the snapshot should be very quick) you should see 2 new lines

$ cat /tmp/snapshot.log

I tested this on ESXi 5.1 in the following guest OS's:

RHEL 6.6 64-bit

Ubuntu 14.04 64-bit

Ubuntu 14.04 32-bit

The one piece that was causing the scripts to NOT be triggered for me was the "Snapshot the virtual machine's memory" option when creating the snapshot in vcenter. As soon as I unchecked that and checked the quiesce option, it started working perfectly.

HTH

Dave

0 Kudos