1756007 Members
3120 Online
108839 Solutions
New Discussion юеВ

Re: lvcreate script

 
SOLVED
Go to solution
Dan Matlock_1
Regular Advisor

lvcreate script

Does anyone know if there is a command and/or script somewhere that can generate a 'lvcreate' type script from a live system. I would like to do this to make igniting to another system easier to build the non-vg00 groups/volumes. I was hoping there was something like the mount -p for fstab recreation.
5 REPLIES 5
Devender Khatana
Honored Contributor

Re: lvcreate script

Hi,

It is not recommended to scriptize the configuration part like file system creation, as it has to be done only once and not to repeated. Another reason for that is that it could be having some difference in device files.

Morover if you restore or recvoer using ignite you should not be requiring to recreate LVs/VGs. Only import for them should be enough & it even should not require to restore data.

HTH,
Devender
Impossible itself mentions "I m possible"
Mel Burslan
Honored Contributor
Solution

Re: lvcreate script

vgdisplay -v | grep "LV Name" | awk {'print $3'} > /tmp/vgdisp.out

for lv in `cat /tmp/vgdisp.out`
do
vgname=`echo $lv | cut -d/ -f3`
lvname=`echo $lv | cut -d/ -f4`

lvsize=`lvdisplay ${lvname}|grep "LV Size"|awk {'print $4'}`

echo "lvcreate -L ${lvsize} -n ${lvname} ${vgname}" >> /tmp/lvcr_scr.sh
done

this script is a quick hack. it has not been tested (my VPN to office is down) and it does not do any error checking.

Also it assumes the volume groups are there with sufficient space prior to running lvcr_scr.sh

It is not a total solution but it may give you a point to start writing your own most probably or improving on this one.

Hope it helps


________________________________
UNIX because I majored in cryptology...
Dan Matlock_1
Regular Advisor

Re: lvcreate script

great feedback!!!

this is what i need, the 2nd DR system will have diff. raid/dsk and I plan on creating the same size VG, and just need something to whip together quickly to lvcreate..... unfortunetly all non-vg00 groups are on new and diff. disks/raid units. will try to clone/map w/ignite, but this will script will be a plan B.
thanx,
Ronald Schwartz_1
Frequent Advisor

Re: lvcreate script

I know you closed the thread but...
Here is a set of scripts that can be used for DR. I got these from the net and tweaked them a little. It is set to work with EMC disks but should run with others. Only problem I have had is when there are multiple CD-ROMs on the system.
The way to impliment is have a cron job that runs build_vg_conf.sh and then ignite. On the DR server after igniting you would run recreate_vg.sh.
Dan Matlock_1
Regular Advisor

Re: lvcreate script

Thanks for the respone!!! Your scripts are what I am looking for, unfortunetly our Sungard test was last weekend and I didn't see the response. I did make a script using some of the other suggestions, and my DR was successful. Recovered 11 systems in about 6-7 hours = very busy..... We have another one by end of the year, so will try another approach. I would like to use a ignite server instead of tapes as well.....