Hi Team
I am trying to put together a nice small script to mount my lvm snapshot
Here are my objectives
1 Check whether snapshot is currently mounted. If so echo umount snapshot and exit from the script.
2 If it's not mounting, check whether the mount point exist, If so, create lvm snapshot and mount and exit
I managed to do the 2nd part of my objectives. However I am not too sure the good way to connect the 1st and 2nd part.
Here is my script with the 2nd part, but I need help with the first part.
Please help
#!/bin/bash -x
LVM_APP_SNAP_MOUNT="/sysmanage/lvm/snapshot/app"
LVM_APP_SNAP_VOL="2G"
LVM_APP_SNAP_NAME=LogVol01_SNAP
LVM_APP_FS="/dev/VG00/LogVol01"
elif [ -d "$LVM_APP_SNAP_MOUNT" ]
then
echo -e "Mount Point Exist" &&
lvcreate -s -n "$LVM_APP_SNAP_NAME" -L "$LVM_APP_SNAP_VOL" "$LVM_APP_FS" &&
mount "$LVM_APP_FS"'_SNAP' "$LVM_APP_SNAP_MOUNT"
else echo -e "Create Directory "\"$LVM_APP_SNAP_MOUNT\"" before continue"
fi