Thanks Falko. The -f command line parameter helped get past the confirmation dialog that would appear when issuing the lvremove command.
My script works really good right now. I am moving all of my physical servers to a Xen setup using LVM. I plan on using the script to iterate through the logical volumes and perform the backup on each one.
These are the steps right now that the backup script performs:
1. Create a snapshot logical volume
2. Verify the directory where the TAR file will be stored exists
3. Mount the snapshot logical volume to a temp location
4. Perform the backup using TAR
5. Unmount the snapshot logical volume at the temp location
6. Remove (delete) the snapshot logical volume
7. Send a confirmation email
I know how to test if directories exist in my bash script (Step 2 above). How can I test if the logical volume exists before performing the backup?
Can I simplify the script by not mounting/unmounting the snapshot logical volume (Steps 3 & 5 above)?
Is there a way to determine the size of the logical volume that a snapshot volume will be created from? Currently, the size of the snapshot volume is hard coded in my script. I would rather test for the size of the logical volume prior to creating the snapshot volume and then pass the size to my lvcreate command.
Last edited by atjensen11; 7th March 2009 at 19:50.