Not doing this anymore. But leaving this post in case it could help others
First suspend the VM. I’ve read that some get away without doing this but there is a danger of corruption. This suspension only lasts for a few seconds since we’re only keeping it suspended to create a LVM snapshot which doesn’t take long at all.
Line 1: vmware-cmd "/vmware/srv/NetWare 6.vmx" suspend
Will this command return once it’s suspended or does it send the signal to suspend and returns to the next command. I need to make sure it’s suspended before taking a snapshot. Running at the command prompt and watching vmware console, it appears not to return control until it’s suspended..
Need to know how much free space is left on my volume group. I intentionally left some free to be able to perform snapshots. One needs enough free space to hold changed data. A snapshot volume only holds the changed data…but it looks to the user that it is a copy of the entire volume he/she snapshotted. Did a
vgdisplay and saw that I had 22 GB free. That should be enough!
So now create the snapshot volume (I wonder if it would be worth created a separate LVM volume to hold virtual disks that I have created for paging files and/or other temporary data that does not need backup…I’m sure a lot of the changed data will be changes in the paging file and such)
Line 2: lvcreate -L22G -s -n lv01snap /dev/vg01/lv01
Line 3: mkdir /media/snapshot
Line 4: mount /dev/vg01/lv01snap /media/snapshot
Ok. Now I can start my VM backup up
Line5: vmware-cmd "/vmware/srv/NetWare 6.vmx" start
Now use the magic of rsync to synchronize the VM to my Ext hard drive
Line 6: rsync -r -a -v --delete /media/snapshot/srv /media/exthd/srv
Now it’s to say goodbye to the LVM snapshot volume
Line 7: umount /media/snapshot
Line 8: lvremove -f /dev/vg01/lv01snap
-f to force..not ask if okay
Added the following to the end of some of these commands to capture its output and error messages to a log
The “2>&1” redirects stderr (2) stream to the stdout (1) stream so it all goes in that log file.
I also added the following before and after certain commands, so I could see how long things were taking
Things I’d like to add:
* check state of VM. Send alert if problem.
* verify directories are identical. If not, send alert.
* log times, transfer rates, etc.