-   Linux - General (
-   -   lvm snapshot using script (

Ammad 11-15-2009 01:28 AM

lvm snapshot using script

I am writing a script to create backup of data on LVM. when i try to put variable in place of size number it stops, and put error on console.


[root@swd data]# lvcreate --size $sumM --snapshot -n backup /dev/vg_swd/LogVol02
  Invalid argument --snapshot
  Error during parsing of command line.


whereas same command works without any error.
[root@swd data]# lvcreate --size 510M --snapshot -n backup /dev/vg_swd/LogVol02

catkin 11-15-2009 07:24 AM

The variable is $sum but the variable name given on the command is $sumM. Any of these will work


The forms in which $sum (or $sum}) are in double quotes are more a little more robust in case $sum does not contain the expected integer but a value including whitespace such as space.

Ammad 11-15-2009 08:35 AM

thanks, catkin. i will check this.

All times are GMT -5. The time now is 01:54 AM.