aix上面如何批量创建所需要的lv?

比如我有一个文件file.txt。cat  file.txttestlv01testlv02userlv01costlv02costlv03如何用脚本一次性创建这个file.txt里面的所有lv。!/bin/sha=$(cat /test.txt)for b in $adomklv -t raw -y $a  Testvg 4Gdone用这个创建报错。0516-306 getlvodm: Unable to ...显示全部

比如我有一个文件file.txt。

cat  file.txt

testlv01
testlv02
userlv01
costlv02
costlv03
如何用脚本一次性创建这个file.txt里面的所有lv。

!/bin/sh

a=$(cat /test.txt)
for b in $a
do

mklv -t raw -y $a  Testvg 4G

done
用这个创建报错。0516-306 getlvodm: Unable to find volume group testlv02 in the Device
        Configuration Database.
0516-822 mklv: Unable to create logical volume.
0516-306 getlvodm: Unable to find volume group testlv02 in the Device
        Configuration Database.
0516-822 mklv: Unable to create logical volume.
0516-306 getlvodm: Unable to find volume group testlv02 in the Device
        Configuration Database.
……这里省略多个类似报错
0516-822 mklv: Unable to create logical volume.
请问下要如何调整下脚本?

收起
参与28

查看其它 3 个回答crazy_cc的回答

crazy_cccrazy_cc系统运维工程师As

明显你这个循环就没带进去啊! 你把$a echo 下看看是啥...

你可以改为$b.

IT分销/经销 · 2023-05-15
  • 还是会报错。但是可以创建lv。感觉语句哪里有点问题。报错如下: 0516-360 getlvname: The device name is already used; choose a different name. 0516-822 mklv: Unable to create logical volume. 0516-358 getlvname: Illegal name; the prefix of the name is reserved. Choose a different name. 0516-822 mklv: Unable to create logical volume. 0516-358 getlvname: Illegal name; the prefix of the name is reserved. Choose a different name. 0516-822 mklv: Unable to create logical volume. 0516-358 getlvname: Illegal name; the prefix of the name is reserved. Choose a different name.
    2023-05-16

回答者

crazy_cc
系统运维工程师As
擅长领域: 服务器AIXUnix

crazy_cc 最近回答过的问题

回答状态

  • 发布时间:2023-05-15
  • 关注会员:5 人
  • 回答浏览:763
  • X社区推广